Problems with mysql query
Posted: Sun Sep 21, 2003 7:16 pm
I have a simple script to get a row in a mysql database and put it into an array like this:
But it gives me this error: [] Operator not supported blablabla. I had it echo $sql and I did the query via phpMyAdmin and it got the whole table fine. But if I tried to do mysql_result() i would get the first cell in the row. Any ideas?
Code: Select all
<?php
$sql = 'SELECT `username`, `posts`, `theme` FROM `'.$prefix.'chat_prefs` WHERE `username` = '''.$_GET[userinfoname].''' LIMIT 1';
$result = mysql_query($sql) or die("Query 1 Failed ". mysql_error());
$userinfo[] = mysql_fetch_array($result);
mysql_free_result($result);
?>