This is so basic and i can’t figure out why it won’t work. i asume it has to do with the fetch_mysql_array($row). here is my code and $user_id is set:
$posts=mysql_query("SELECT title, description FROM posts WHERE user_id = '$user_id'") or die(mysql_error()) ;
while ($row=fetch_mysql_array($posts, MYSQL_NUM)) {
for ($i=0;$i < count($row); $i++) {
echo $row[$i]." ";
}
echo"<br /> <br />";
}
thanks in advance for any help…
It’s
mysql_fetch_array; notfetch_mysql_array, which you shouldn’t be using anyway.mysql_functions are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi – this article will help you decide which. If you choose PDO, here is a good tutorial.You also don’t need the
forloop inside thewhileloop.