Re: numeric string to single digit array

From: Date: Wed, 26 Mar 2008 17:50:48 +0000
Subject: Re: numeric string to single digit array
Groups: php.db 
Request: Send a blank email to php-db+get-44814@lists.php.net to get a copy of this message
----- Original Message ----- From: Evert Lammerts <evert.lammerts@gmail.com> Date: Wednesday, March 26, 2008 5:22 pm Subject: Re: [PHP-DB] numeric string to single digit array > > > Tried that as well and got the same result. > > I tried "Select count(answer) as total from answers where > studentID='A123456789'";> from the CLI and got total = 2 as a > result. > > > > So, we got rid of the Invalid Resource error and we know that the > student id you use occurs in both rows in your table and that your > query > works fine. > > Did you get rid of the semicolon @ line 15 "while($row = > mysql_fetch_assoc($result));", as Jason suggested? Also, an: > error_reporting(E_ALL); > at the top of your code might help in backtracing. > The semi-colon is gone, although I didn't even notice it! I am using two different queries, one for count and the other to access the data itself. After running mysql_fetch_assoc, is foreach ok for accessing array members, or is there a more subtle approach?

« previous php.db (#44814) next »