Page 1 of 1
php/mysql counter
Posted: Thu May 19, 2005 10:00 am
by Smackie
I found a php/mysql counter tutorial and I kinda am stuck on what they mean on a part of it here is what im stuck on
count varchar(255)
count_id varchar(25)
Insert a single row with the values count = 0 and count_id = 1
i found the script at
http://www.phpfreaks.com/tutorials/6/0.php
Posted: Thu May 19, 2005 10:04 am
by shiznatix
count varchar(255) is a row in the mysql table that is like any characters but can only be 255 characters in length per cell. then other can only be 25 characters in length.
then the insert a single... is just to setup the database before you begin starting the counter so it has some data to build off of, otherwise it would try to do a ++ on a NULL field and would return NULL and you would never start counting
Posted: Thu May 19, 2005 10:08 am
by Smackie
i knew the count(varchar 255) and count_id(varchar 25) was the part i dont get is the insert a single and still the way you said that it confused me more

Posted: Thu May 19, 2005 10:21 am
by shiznatix
o sorry

. i think they are just saying run a quick query like
Code: Select all
$query = '
INSERT INTO
table
(count, count_id)
VALUES
("0", "1")
';
$do_query = mysql_query($query) or die(mysql_error().__LINE__);
to setup your database but thats after you made the database and the table with the count = varchar(255) and count_id = varchar(25)
Posted: Thu May 19, 2005 10:37 am
by Smackie
Thank you
Smackie