Saving database data into Array!!!

From: Date: Sun, 20 Feb 2000 16:12:18 +0000
Subject: Saving database data into Array!!!
Groups: php.dev 
Request: Send a blank email to php-dev+get-15707@lists.php.net to get a copy of this message
Hi everyone, I can't get the following code to work. Please tell me what i did wrong on it. Thank You.. Mysql_pconnect("localhost","user_name","password"); Mysql_select_db("database"); $query="select first_name, last_name from table; $result=mysql_query($query); $numrows=mysql_num_rows($result); The problem starts here... $x=0; for ($index=0; $index<$numrows; $index++) { $first=mysql_result($result, $index, "table.first_name"); $first[$x]=$first; $x+=1; } When the $x reached the value of 2.... I got this error message....from the web page... Warning: Illegal string index in .....on line 18 which is ($first[$x]=$first;)

« previous php.dev (#15707) next »