Re: numeric string to single digit array

From: Date: Wed, 26 Mar 2008 15:39:56 +0000
Subject: Re: numeric string to single digit array
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-44804@lists.php.net to get a copy of this message
PHP is telling me that the resource I am using for mysql_fetch_assoc is invalid: $query ="Select answer from answers where studentID ='A123456789'"; $result = mysql_query($query,$connection); $count=0; while($row = mysql_fetch_assoc($result)); { $count++; } echo $count;
Are you sure your database connection has been made? $connection = mysql_connect('localhost', 'mysql_user', 'mysql_password') or die(mysql_error()); etc.. If the connection is made alright, try: $query ="Select answer from answers where studentID ='A123456789'"; $result = mysql_query($query,$connection) or die(mysql_error()); $count=0; while($row = mysql_fetch_assoc($result)); { $count++; } echo $count;

« previous php.db (#44804) next »