array question

From: Date: Thu, 19 Jul 2001 17:37:02 +0000
Subject: array question
Groups: php.general 
Request: Send a blank email to php-general+get-58754@lists.php.net to get a copy of this message
Hi All, I am trying to pull info out of a table and assign a var name to each field... I seem to be having trouble. I have tried to do $var = $row[0] but that does not seem to do it. I have included what is working below. I would like to have each element of the array stored in a seperate variable for use on a web page. Thanks JG <?php $stmt = 'SELECT * FROM custdata WHERE UserName like "fred"'; mysql_connect($localhost,test,testme); $result = mysql_db_query("test",$stmt) ; while($row = mysql_fetch_object($result)) { //** doing this now**// printf("%s", $row->UserName) ; // **Would like to do something like**// // $user = $row[0]; // } mysql_free_result($result); ?>

« previous php.general (#58754) next »