Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Keeping Total


I have a loop that runs through the reults of a query and it does
$tot_feet += $feet(which keeps a running total).

For some reason it will not process 110 rows of data so I had to break it down into three seperate queries with three seperate loops.

I am wanting to keep a sum of all the loops. Im programming I would just create a global variable and use it but how would I do it in php? Since $tot_feet is withing the loop the value cannot be accessed outside the loop due to scope.




View Complete Forum Thread with Replies

Related Forum Messages:
Keeping Session ID In Url...
How do I do this? Obviously I have to set a session var called "sessionID" (I think) - and then use sess_id or something to put it into the url?

View Replies !
Keeping Spamers Out?
I'm building a web site for myself and some friends using php and
MySQL. All I have coded so far are the index.php, the membership
registration screen, and the log-in screen. Myself and one other person
are the only two registered members because we are the only people in
the world who even know the site exists yet. I'm an experienced C++
coder, but a php beginner, and my friend is a SQL expert but has no
knowledge of php.

But only two days after putting up the registration page I noticed the
welcome screen said we had 3 members, instead of the 2 people who are
working on the page. When I looked at the users table in MySQL the user
name was this huge long string that read like a typical spam email, so
obviously a bot saw a form on my page and tried to fill it with spam.

What is the usual procedure for validating members to prevent bots from
"registering"? Membership number (auto-indexed) is kind of a status
thing, so we don't want the primo low numbers to get chewed up by bots
before the site even goes live for the rest of the membership. How can
I keep them out?

View Replies !
Keeping Value Static
Is there a way that I can keep the value at 0 (value="<? echo $wt_fee;?>">)rather than having to put the zero in every time before the form is commited to the database.

<input name="wt_fee" type="text" id="wt_fee" value="<? echo $wt_fee;?>">

View Replies !
Keeping HTML And PHP Seperated?
Could anyone explain the different ways there are to keeping HTML and PHP seperated?

View Replies !
Keeping Passwords Secure
I'm hosting on a shared server. I need to know how I can keep my passwords, that are currently in the world readable scripts, secure. The problem isn't through the web, but rather that other users have telnet/ssh access to the machine. So they could cd to the directory and copy it see the plaintext password.

View Replies !
Keeping MySQL Connection
Is there a way to open a mysql connection and have it remain open while a user is at my site? Is it better to just keep a connection throughout their visit or connect only when the database is needed? Right now I have these two lines at the beginning of most pages (about 6 pages):

mysql_connect($host, $user, $pwd)
mysql_select_db($dbase)

I was thinking something involving sessions would work, but I am having trouble with it...

View Replies !
Keeping Texts Outside Php Files
I want to keep all messages etc outside php to create a multilanguage site later. What is the best way to do this?

I was thinking of a session variable language, and call the text output with a function that receives the messageid and language id and so returns the text.

Is it wise to store all these messages in mysql or inside the function (if messageid=1 etc)? Does it make a difference in speed if the function handles all or if the message content is received by mysql query?

View Replies !
Keeping Connection Alive.
I wrote an irc bot,but even if i run it from command prompt as php bot.php,if there is no activity,it disconnects.

View Replies !
Keeping An Array In Memory
I'm afraid I don't know PHP well enough
to figure this out.

What I would like is to keep an array in
memory so that it doesn't have to be
reloaded each time a .php script is run.

Is this possible?

In Java, I could load the array from a file
in the init() method of a servlet and it would
stay in memory until the server is shutdown
or restarted, etc.

View Replies !
Keeping Spam Bots Out
Is there a PHP-way of entering an email address on a .php webpage (as in "If you need info, email us at URL") with this address as a mailto link yet is NOT readable by spam bots who visit the site? I've searched the forum and found lots of "spam' references, but none of them talked about how to obfuscate a regular mailto link.

View Replies !
Keeping A User Authenticated
I've looked through most threads here about user authentication against a mySQL database, but I still have not figured out how to "keep" the authentication as the user browses through the restricted pages.

Sessions and cookies seems to be involved, but I still don't understand how it is implemented and checked when a user goes to a different page after being authenticated. I got as far as authenticating the user against the database, but then...

View Replies !
Keeping The 'check' In 'checkbox'
I have a list of checkboxes that are built on the fly from the db.

"SELECT id, name FROM $table_name WHERE name !='$startlocation'";

$boxes.="<input type='checkbox' name='attend[]' value='$id' $isChecked>$choosename<br>";

When the user checks one or many and then submits - I loop through the checkbox array to see which values get returned Like so ...

$attend[] is the dynamic array
for ($i=0;$i<count($attend);$i++) {
$boxres.= "$attend[$i]";}

Question is - when the user submits the form (to same page) - the checkboxes reset and selections are lost. Is there a way to "mark" checked to those initial selections after the user submits?

View Replies !
Keeping Session Alive
I've built an app for a client that allows selected users to input a load of product sales data, from which returns some handy stats.

What's happening is that users are spending a long time over the form input so when the user hits submit (in one case over an hour later) the session has died, the user logged out and the data is lost.

Is it possible to maintain a session for that length of time, either via .htaccess or some other cunning piece of PHP ingenuity?

or do i have to go away and write a script which captures the form input when it times them out, so it's back there when the log in.

View Replies !
Keeping Scroll Position
I want to keep the scroll position after reload. I tried this:

View Replies !
Keeping Values In Forms
I'm trying to process a form. In my data validation function i try and check for errors in the user submitted fields. In the fields in which are fine i want to be able to keep the values in the form when there are errors and clear the fields that have errors in them. 

For some reason i cannot get this to work.  Here's my code, i've cut it down to the relevant parts.  The first file is the index.php file which shows the form but first checks for errors.  The second file has all the relevant php functions i call defined.  In form.php i just show a small piece of the show form function where i try and present a text field with its default value. Code:

View Replies !
Keeping FTP Connections Open
I'm using PHPs FTP functions to transfer files etc to another server from an interactive environment. So I can put and get files, delete files, rename files etc. and after each action the PHP scripts displays the FTP UI.

Currently for each action I do the following steps:

Open connection
Login
Do action (delete, rename, ...)
Close connection

Is it possible to keep the connection open, doing step 1 and 2 only for the first action and skip them for all consecutive actions and step 4 only when I'm ready with all actions?

View Replies !
Keeping Form Data
o/s = xp
php5, myqsl 4.1, apache 2

I have a small form for creating a new user. The page is setup to display the form for 3 possible situations:

1 first visit to page
2 if user name already exists in db
3 if any fields are empty

The form action selects "check.php" for authorised session, existing user or empty fields. If all is ok the data is inserted in the db, else it returns to the form page with a variable sent with the URL which if set builds the correct form with a message to show the problem. Code:

View Replies !
Keeping Out Malicious Code
I have a "contact me" form which allows users to send comments. The form uses three fields: name, email, and comments. It's the "comments" field:

Occasionally I get some junk coming through that contains URL's, or whatnot, and I'd like to filter those things out. (I can't tell if these junk contacts are human or machine generated). Ideally, I want to recognize the content and kill the process, perhaps redirecting the user. Code:

View Replies !
Keeping Selection Lists
I would like to create 2 single-select drop-down selection boxes on a page

box1 - select academic year from 2001, 2002 , 2003 etc

box2 - select semester from 1, 2, 3 etc

As a result course details for all courses that satisfy these selection values get displayed below the boxes. The boxes remain availabel on the page. The user should be able to re-set these boxes to different values to generate different results. The boxes remain visible on the page. Is this possible ?

View Replies !
Keeping Form Fields Set
How can I ensue that if a user does not fill in a certain form field, that when I redirect the user back to the form, that the fields which he had filled in originally are still filled in? I presume that you might have to send the variable back to the form?
For example,

$email = $_POST['Email'];
if (empty($email)) header( "Location: http://www.example.com/form.htm" );

If any other fields were filled out by the user, that data would be lost by reloading the form.htm.

View Replies !
Keeping Count In MySQL
I'm using checkboxes and trying to figure out how to keep a running total of what people have checked off after they hit the submit button. I posted a little bit of the script (below) that pulls the products from a table and provides a checkbox for each one. Works pretty good.

I'm thinking about creating an extra column in my Products table. That extra column would just keep a total of the number of votes each product gets - like a survey or poll. I'm not sure what to do to insert a number or value for the checkbox and then insert that into the new column to keep score. I'm new to this stuff so I hope I'm making sense.

while ($row=mysql_fetch_assoc($result)) {

echo '<input name="checkboxName" type="checkbox" value="1" />'
echo $row["product"];echo "<br>";

View Replies !
Keeping Code In MySQL DB
I would like to enter PHP code in a textarea and keep it in a DB field. When the time comes I would like to be able to call the code from the DB and use it (execute or include it). Is this possible?

View Replies !
Experimenting With Records Keeping With PhpWiki
How this would work in essence:

User would be presented with, say, a "members" page containing an
alphabetised list of member name links and an add member link. Each
member name link would lead to the member's page and would provide for
updating information about that member in the usual way for a wiki.

However, the add member link would arrange to create a link for a new
member--with initial contents in the linked page set from another file
thereby making it possible to provide for collecting the same
information about each member.

I assume that this is not somehow built into PhpWiki. Does it seem
possible (or would subvert some mechanism on which PhpWiki depends)?
Does anyone know of an example of a system that works in this general way.

View Replies !
Move & Rename File Keeping Same Ext
I'm trying to move a file and rename it at the same time put keep its extension. PHP Code:

View Replies !
Keeping Script From Printing A New Row For Each Entry
My current script prints out a new row for each song title that matches the album_id and the list_id (or playlist id#). What I want to do is to have each song title printed on one row for each album in a given playlist, followed by a comma and a space (except for the last entry).

Example--->http://www.twcfan.com/music/playlist.php3?id=1

In the case of this playlist, I would like the song titles "Weekend In Monaco" and "St. Tropez" to be in ONE row, not TWO. So the output on the line that says "Song(s):" would be like this....

Song(s): Weekend In Monaco, St. Tropez

SQL query--->$result2=mysql_query("SELECT * FROM albums, songs WHERE album_id='$id' AND songs.song_id=albums.id order by 'artist' asc") or die("No Albums");
while ($row=mysql_fetch_array($result2))

{$bid = $row['album'];

if(empty($bid)) {
$bid=""; }
else {
$artist = $row['artist'];
$album = $row['album']; ...etc....

I then have a variable called "$bid" that contains the HTML for each row....which I then print $bid.

View Replies !
Keeping The Variables From Form To New Page
On a web page that I am working on there is a lead generator on the left side that asks for the persons name, phone number and email address. Currently when someone fills in that information and clicks "continue" it will send an e-mail as well as inputs that data into mySQL database.

What I want it to do is just that but then take the person to a continued form asking more questions, but without them having to re-fill in their name/phone/email. Basically this "continued form" can be accessed seperately, so it cannot be something where the continued form only works once someone fills out the mini form on the left side of any page on the site. Code:

View Replies !
Keeping The Same Session_id When A Page Is Refreshed
I have the following script:

<?PHP
session_start();
echo session_id();
?>

But it gives a different session_ID() everytime the page is reloaded.
Is there any way to keep the same session_ID() until the browser window
is closed?

View Replies !
Keeping Select Option Value Selected
I'm trying to learn how to keep the value "selected" once a form is set to read the values and then f-write them (all within a loop). The part that's giving me a problem is the part which would return the value of the form as "selected". PHP Code:

View Replies !
Keeping Your Site Secure From Users
I've got textareas for my users to input descriptions etc into. The problem is that when they enter HTML or PHP code, it comes out like that, which means they could potentially access the database and mess around with the page.

How can I keep my pages secure when displaying this text. IE: How can I make it actually say on screen: "Hello, I'm <strong>Grego</strong>" rather than "Hello, I'm Grego"?

View Replies !
Keeping Track Of Page While Logging In
When you try to go to a page that you need to be logged in to see, it first takes you to a login page. Once you successfully log in, it takes you to that original page that you tried to access instead of the default home page.

I've been doing PHP for a little while (oh about... 6 or 8 months) so I don't think I need any code, just some structure/pointers because I can't really think it through.

View Replies !
Keeping PHP Database Passwords Secure
I need to save important information, namely my MySQL Database Password in a secure manner somehow. I've looked all around for clues to do this, some things that I found were using config files but I don't know much about them and I couldn't find anything on them here or anywhere else.

View Replies !
Keeping Current Query String
I send a query string to a page where what I want to do is allow the user to sort the data based on what they want from a drop down menu. Here is what I have so far and its not working. PHP Code:

<form name="form1" method="get" action="results.php<?php if (isset($_SERVER['QUERY_STRING'])) { echo "?".$_SERVER['QUERY_STRING']; } ?>">
            <div align=center><span class=style12>Sort by</span>
                <select name=select>
                  <option>name</option>
                  <option>family</option>
                  <option>level</option>
                </select>
                <input type=submit name=Submit value=Sort />
              </div>
          </form>
how to get it working? Or other ways to do this...?

View Replies !
Keeping Form Variable In Memory
I have a page where users enter a "control panel" by entering a secret ID into a form. The control panel displays an edit record form. The recordset is filtered with the $ID variable that was passed by the login screen.

When people update a record, the site stays on the same page. How do I get the $ID variable to stay with it without using sessions? I tried using a hidden field, but it didn't work.

View Replies !
Strip_tags While Keeping The Font COLOR
Big thanks for the help in my last thread! One last question for this go around --- I want to strip all html tags, EXCEPT want to keep the BOLD and the actual font color= , while getting rid of font size and font face, so where right now I get

<font face="Verdana" size=2>
<b><font color="#00FFFF">rodin</font></b>

I've accomplished keeping the bold, by using the strip_tags then <b>, but haven't accomplished keeping just the font COLOR and closing the font COLOR. Is this possible as well?

View Replies !
Keeping Text In A Chatbox On Refresh
When using a pop up chatbox that auto-refreshes. What is the formula to keep the text in it? Because everytime you type a message it refreshes and erases it?

View Replies !
Keeping Connection Details Secure
I currently have a php file, that holds all my sql connection data, ie server, username, password etc, which I call into a file, when I need to connect to the database. I noticed that if I type in the URL of the php file (ie: connect.php), It displays all my connection data. Is there anyway I can stop this from happening?

View Replies !
Keeping Select List Persistent
I grab data from an Oracle database and create a select list as follows:

while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS)) {
   print '<option value="'.$row[0].'">'.$row[1].'</option>'       
  }

The problem I have is that my error handling functions send the user back to the same form if there is a data entry problem. When this happens, I get an error that the login information (that I use to build the select list) is incorrect; basically because it is gone.

Rather than going back to the database each time the user is sent back to the form for a data entry error, is there a way to make this list persistent.

View Replies !
Keeping External File Structure
I was curious if it is possible to create a file with a structure and then read it with php and display it like it is saved.What is the best text format to use for this purpose.

View Replies !
Keeping Variables Through Multiple Pages
I am coding a site where i take customer's information on the first page they visit but i don't want to really do anything with that information for a couple of pages.

I'm pretty sure that this would have something to do with session variables but i'm not sure if this is correct or really how i would call them in the page i want to use.

View Replies !
Keeping Track Of Logged In Users
The first step, before viewing or posting in the forum is to log in. Now, the trouble i am having is how do i keep track of who the user is logged in as. Like on this forum, you log in and it knows who you are but then next time you come to the site, you have to log in again. I need something like this.

View Replies !
Sending Password To Different Pages While Keeping It Hidden
I'm trying to make a very simple administrator's interface for a project I'm working on.

The member account information is stored in the MemberTable table and the characters of the members are stored in the CharacterTable table.

On admin.php, I want the administrator to enter a password. If it's correct, he can chose what to do. He can either check out the member accounts or the characters. Basically I have 2 links to other pages (users.php and characters.php) from admin.php

Here's my code:

View Replies !
Keeping Credit Card Details Secure
I'm building a shopping cart for a small site that need to accept credit card payments. The problem is that payment details need to be sent securly by e-mail, or retreived by the store owner from a secure page for manual processing because the sales volume is too low to pay the setup costs for an online system. What is the best way to do this? Currently they use a PERL script that send half of the details by e-mail (not secure) and stores the other half in a file on the host's server. Is this the best way to do it?

View Replies !
Keeping Users Informed In Lengthy PHP Processes
Often PHP processes take a long time, such as wildcard searching a PostgreSQL database, or generating thumbnails.

The PHP host page does not display until the script is complete, so you can not effectively use code such as

echo "Converting file ".$Infile;
exec(convert $Infile $O8utfile);

for realtime feedback to the user.

How have others implemented a "progress meter" in PHP processes , one thought I had was to use Javascript redirection to call a PHP page with differing parameters each time .

View Replies !
Forms: Keeping Form Data After Error
WHen using forms, what's the best way to check a database(mysql) for duplicates and return the same form and data if a duplicate is found. Basically, if a user submits a form and an error occurs, let them correct the data instead of entering all data over again.

View Replies !
Keeping Track Of Read Posts (forum)
I have created a forum system and I would like a way to mark forums as read. The problem is at the moment new posts are marked if they have been posted since the user last logged in, this leaves no easy way to mark a particular forum as read.

This forum keeps track of which actual posts you have read does it literally keep a list of all the posts and when you last viewed it? Would this table in the database not be huge and require updating and writing to a lot, how else would it work.

Maybe my system is wrong, does anyone have any other ideas on this. I would either like the ability for users to mark a forum as read or for the forum to keep track of which posts have been viewed.

View Replies !
Reading (and Keeping) Accented And Special Characters
I'm using the php 'file' command to read the contents of an ASCII text
file to a variable. The original text file contains some accented and
special characters. The problem arises when I echo this variable: the
accented characters are messed up. And not only accented characters, for
example, the special characters ª is printed as ª. What can I do to
correct this issue? I have tried, without success, to use the 'setlocale'
command.

View Replies !
Keeping Track Of What A User Has Read On A Web Site
The goal is to keep track of what a user has and hasn't read and present him or
her with new material

I am currently doing this by aggregating new content from all databases into a
single indexed database and then saving a timestamp in the account database
(for the current user) that tells me when the user last read items in the
aggregated database.

This works as designed, but I don't have detailed control. If the user opens
the page where new items are listed and reads on of the items (and don't reset
the timestamp), that item won't be removed from the list.

This is evident when I want to have a function in my page that alerts the user
if there is new content of a specific kind (for example: "1 new articles on
cooking"). That function will report that until the user has reset the
timestamp (by visiting the 'what's new?' page that lists all new articles). I
can't mark just this article as 'read'.

So, what options do I have? Well, each item have an ID, so if I should keep
track of read/unread I should base that on the IDs in the aggregation database.

Looking at how newsreaders (specifically those that make use of a .newsrc file)
do it, they keep track of series of ID's, like "12,14-67,69" - which in my case
could mean that the user has read the items with ID 13 and 68.

The aggregation database looks something like this:

ID | Kind | Headline | Original ID
------+-------------+-------------------------------+------------
1 | article | Home made pie | 23
2 | article | Hamburgers a'plenty | 24
3 | forum | Anyone likes strawberries? | 298
4 | comments |*Re: Home made pie | 67

Get the idea? The ID is the id in the aggregated database, the kind is from
what original database the content came from and the original ID is the id in
that database

So, if I go and read "Hamburgers a'plenty", it should perhaps update my profile
to say "1,3-4" or somesuch to note that I have read id number 2. Or perhaps I
should just keep track of all the IDs I have read? The aggregate database keeps
content around for about a month, which could mean thousands of items.

I am guessing that a MySQL query that looked like this:

"select * from aggregate where id not in(1,2,3,4,5,6,7,8.....1678)"

would be bad.

So, I am wondering how YOU would have done - Or are you already doing this in
one way or the other?

One way - I suppose - would be to make on SQL query that fetches all the
(potentially thousands) of ID's and all the headlines and puts them in an array
and then I run that array in a PHP function that filters out items based on the
"1,4-7,12-78" filter. I would also have to build PHP functions to maintain
these lists, but that's a minor problem.

View Replies !
Using A Set Of Arrays Togther And Keeping Data In Sync?
Im using arrays generated from my records displayed in a table on my site to
update the corresponding records in a mysql database ie

on the web page
col1 col2 col3
1 2 2
1 6
2 7 4

which I post to next page as col1array col2array col3array problem is some
of the fields in the site's table are blank
so the arrays are not in sync

ie
col1array col2array col3array
1 2 2
1 7 6
2 4

so when I loop through the arrays feeding the values into an update sql the
wrong data is going into the wrong rows in the mysql table ie

field1 field2 field3
row1 1 2 2
row2 1 7 6
row3 2 4

instead of

field1 field2 field3
row1 1 2 2
row2 1 6
row3 2 7 4

how do I get the data in the arrays to stay in sync, in otherwords how can
I get the arrays to somehow recognise blanks in the site's table

View Replies !
Keeping Values In Form Inputs After Validation.
How do you put posted values back into form inputs if validation fails. I've tried this:

<input type='text' name='title' size='30' maxlength='70' value='<?php echo $_SERVER['title']; ?>' />

This causes '
' to appear in the input box though. I have no idea why.

I figure this is an easy question. I'm not the only one who doesn't want their users to have to fill in a whole new for because of one mistake and not be able to see the mistake.

View Replies !
Forum Soft To Be Used For Keeping Member Stuff
OK, I want to make a small community-based site (and can't afford spending much time on it). I'd like to have a forum installed, but I'd love to use login info (nick, to be precise) in one of the tools I'll make.

So I'd like to have this forum somehow apart from the site, but sessions would be opened when a user enters the site (and not the forum itself). Code:

View Replies !
Keeping Data Alive After The Submit Button Is Hit
I have a website where the user inputs some data, hits the submit button, and some results are returned. I want the results to stay on the page when the user hits the submit button again. In other words, when the user hits the submit button the first time he gets this: Code:

View Replies !
Keeping SESSION Alive Switching To SSL Connection
I use a session script which should pass all variables to a secure connection.

Like when someone enters http://www.mydomain.com he is able to to fill a shopping cart (no ssl) and can switch to a secure connection (let's assume it's https://www.mydomain.com)

but however all my session data is lost once I switch to an SSL connection. How can I get the session data to be available through both connections?

My session script looks like this: ....

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved