RE: [PHP] Counter Help

From: Date: Fri, 23 Feb 2001 19:07:28 +0000
Subject: RE: [PHP] Counter Help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-41358@lists.php.net to get a copy of this message
Thank you very much :) -----Original Message----- From: Boaz Yahav [mailto:berber@netvision.net.il] Sent: Friday, February 23, 2001 4:55 AM To: 'Superbus22@home.com'; php-general@lists.php.net Subject: RE: [PHP] Counter Help Fixed. Sincerely berber Visit http://www.weberdev.com Today!!! To see where PHP might take you tomorrow. -----Original Message----- From: Navid Yar [mailto:Superbus22@home.com] Sent: Friday, February 23, 2001 10:39 AM To: php-general@lists.php.net Subject: RE: [PHP] Counter Help Actually, I couldn't find the article number for that tutorial. I did, however, place a comment directly into that specific web page with the fix. Here is a direct link to the tutorial (I left the frames out): http://www.weberdev.com/ViewArticle.php3?ArticleID=30. Thanks. Navid -----Original Message----- From: Boaz Yahav [mailto:berber@netvision.net.il] Sent: Friday, February 23, 2001 12:50 AM To: 'Superbus22@home.com'; php-general@lists.php.net Subject: RE: [PHP] Counter Help WeberDev will fix it ASAP if you tell it the number of the example :) Sincerely berber Visit http://www.weberdev.com Today!!! To see where PHP might take you tomorrow. -----Original Message----- From: Navid Yar [mailto:Superbus22@home.com] Sent: Friday, February 23, 2001 6:25 AM To: php-general@lists.php.net Subject: RE: [PHP] Counter Help Chris, It worked! Thanks so much! Weberdev needs to fix it too. Navid -----Original Message----- From: Chris Lee [mailto:lee@mediawaveonline.com] Sent: Thursday, February 22, 2001 4:46 PM To: php-general@lists.php.net Subject: Re: [PHP] Counter Help change $row[count] to $row['count'] it thinks the work [count] is some kind of conastant, it doesnt know you mean (string) 'count' -- Chris Lee Mediawaveonline.com ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 lee@mediawaveonline.com ""Navid Yar"" <Superbus22@home.com> wrote in message news:000101c09d2d$135683e0$6ae20718@alntn1.tx.home.com... > Can someone help me with this script? It is an example from weberdev.com. I > ran it and it gave me the following error... > > -- Warning: Use of undefined constant count - assumed 'count' in > c:\windows\desktop\localhost\examples\counter\counter1.php on line 27 > 25 > > The number 25 is the correct number for the counter, but how do I get rid of > that error message that keeps coming up before the counter number (25)? I am > testing and learning PHP on Windows ME and am using PHP 4.0.4 with MySQL > 3.23.33. Here is the script: > > <HTML> > <HEAD> > <TITLE></TITLE> > </HEAD> > > <BODY> > > <!-- This example from > http://www.weberdev.com/index.php3?GoTo=ShowShoppingItems.php3%3FMasterCateg > --> > > <?php > $hostname = 'localhost'; > $username = 'username'; > $password = 'password'; > $dbName = 'database'; > MYSQL_CONNECT($hostname,$username,$password) OR DIE("Unable to connect to > database"); > @mysql_select_db("$dbName") or die("Unable to select database"); > > $name = "$SCRIPT_NAME"; > > $result = MYSQL_QUERY("SELECT * FROM counter WHERE (name = '$name')") or die > ("Bad query: ".mysql_error()); > $row = mysql_fetch_array($result); > > if($row){ > MYSQL_QUERY("UPDATE counter SET count = count+1 WHERE (name = '$name')") or > die ("Bad query: ".mysql_error()); > $count = $row[count]; > }else{ > MYSQL_QUERY("INSERT INTO counter VALUES ('', '$name', > '2')") or die ("Bad > query: ".mysql_error()); > $count = '1'; > } > echo $count; > ?> > > </BODY> > </HTML> > > -- Navid > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#41358) next »