Jump to content

PHP/MySQL counter


Recommended Posts

I'm trying to follow this tutorial for a phpmysql counter script. http://www.phpeasystep.com/phptu/7.html

I looks pretty straight forward.

CREATE TABLE `counter` (
`counter` int(9) NOT NULL default '0'

But when I try to make the database in mysql it tells me I have a syntax error and says see documentation on your current mysql version. I don't know mysql well enough to understand what I'm doing wrong.

I tried looking it up but to no avail.

Link to comment
Share on other sites

It could be that you're using the wrong quotes. The example you have in your post works, but if you're copying it by hand it's easy to use an apostrophe (') when it should be a back-tick (`). The good news is that in this case you don't need the quotes at all, you can simply use:

CREATE TABLE counter (counter int(9) NOT NULL default 0); 

You'll also notice that I've dropped the TYPE parameter from the end of the line as MyISAM is usually the default engine type, you can check if this is the case in your MySQL instance with:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...