Re: numeric string to single digit array

From: Date: Wed, 26 Mar 2008 15:12:04 +0000
Subject: Re: numeric string to single digit array
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-44802@lists.php.net to get a copy of this message
I ran this $query ="Select answer from answers where studentID ='A123456789'"; $result = mysql_query($query,$connection); $resultArray = str_split($result,1); $count = count($resultArray);
Where's the fetch? |$result = mysql_query("SELECT answer FROM answers WHERE studentID = 'A123456789';"); $count = 0; while ($row = mysql_fetch_assoc($result)) { $count++; } |Of course you should count in the query if the result itself is not used: |$result = mysql_query("SELECT COUNT(answer) AS nr_of_results FROM answers WHERE studentID = 'A123456789';"); $row = mysql_fetch_assoc($result); $count = $row['||nr_of_results||'];|| | Evert

« previous php.db (#44802) next »