For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > April 2007 > Re: Subject: auto_increment









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Subject: auto_increment
Neil Smith [MVP, Digital media]

2007-04-15, 7:57 am

At 03:04 14/04/2007, you wrote:
>From: Ron Piggott <ron.php@actsministries.org>
>Reply-To: ron.php@actsministries.org
>To: PHP DB <php-db@lists.php.net>
>Content-Type: multipart/alternative; boundary="=-xK5L7HjLIUaeMS/bzYQr"
>Date: Fri, 13 Apr 2007 22:03:59 -0400
>Message-Id: <1176516241.32635.118.camel@localhost.localdomain>
>Mime-Version: 1.0
>Subject: auto_increment
>
>Does anyone see anything wrong with the $query syntax? Ron
>
> mysql_connect(localhost,$username,$passw
ord);
>@mysql_select_db($database) or die( "Unable to select database");
>$query="ALTER TABLE sessions auto_increment = '1'";
>mysql_query($query);
>mysql_close();



Is "sessions" table supposed to have a column which is auto increment ?
That column must be a PRIMARY KEY for autoincrement to be applied.

<sighs>Though as-ever you haven't posted the error message</sighs>
presumably you haven't got a PK yet.
Since we don't magically know your table structure since you didn't
post that either, it's kind of hard to tell.

Ron - in future please could I ask you to post both table structure
and error message, when asking "what's wrong" ?

Cheers - Neil
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com