Thanks, I still remember your reply on my test post
be in touch!


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com





-----Original Message-----
From: Navid Yar [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 24, 2001 4:26 PM
To: 'PHPBeginner.com'; 'PHP (E-mail)'
Subject: RE: [PHP] Counter Help


Sounds good to me, I should, and will, always keep that in mind. Thanks for
the tips. Also I want to say PHPBeginner.com is starting off very well, keep
up the good work. I've been watching over it to see when the grand opening
would be, and it's finally here. I hope it becomes a success someday. If I
was good at PHP, I would contribute some articles, but I'm just a newbie for
now. But maybe someday. Take it easy  :)

Sincerely,
Navid Yar

-----Original Message-----
From: PHPBeginner.com [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 24, 2001 12:16 AM
To: [EMAIL PROTECTED]; PHP (E-mail)
Subject: RE: [PHP] Counter Help


Yup, you need to have your key strings in quotes '',
so it doesn't think it's a constant.

ALWAYS use $array['key']
and not
$array[key]

except for the integrers



Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com


-----Original Message-----
From: Navid Yar [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 23, 2001 9:11 AM
To: PHP (E-mail)
Subject: [PHP] Counter Help


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to