Re: new set of eyes?

From: Date: Sat, 06 Dec 2003 18:59:47 +0000
Subject: Re: new set of eyes?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-172079@lists.php.net to get a copy of this message
On Sat, 06 Dec 2003 11:38:18 -0700, you wrote: >I think I am loosing my mind this afternoon... could someone review this >snippit and tell me why it isn't working? > >$sql = mysql_query("SELECT $i FROM $table WHERE $i = $i",$db)or >die(mysql_error()); > while($b = mysql_fetch_array($sql)) { > while($ar = current($b) != 0) { > $v = array(); > list($v) = explode("}",$ar); } >print_r($v); } > >I am hoping to get something like >array([0]=>first row of data[1]=>second row of data) Your code doesn't have any context, so I can't be sure whether you're doing something very smart or very dumb with the SQL statement. The explode() is kinda weird, too. Try running this: <? $sql = "SELECT $i FROM $table WHERE $i = $i"; echo ($sql); $rs = mysql_query ($sql, $db) or die (mysql_error ()); $result = array(); while ($row = mysql_fetch_array ($rs)) { $result[] = $row; } print_r ($result); ?> and let us know how close it comes.

« previous php.general (#172079) next »