php/mysql counter

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

php/mysql counter

Post 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
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post 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
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post 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 :?
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

o sorry :oops: . 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)
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

Thank you

Smackie
Post Reply