FilipKrstic Posted October 20, 2010 Share Posted October 20, 2010 Hello everybody, I have a problem selecting rows from db. Copied error message: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\scriptforsite\index.php on line 223 I have searched for this problem, and I found tons of posts but I didn't do anything. Here is a code: <?php include("include/functions.php"); db_connect(); lang_en(); lang_smiles(); lang_links(); $sql= mysql_query("SELECT msg_id,msg from messages order by msg_id desc"); while($row=mysql_fetch_array($sql)) { $msg=$row['msg']; $msg_id=$row['msg_id']; ?> <li class="bar<?php echo $msg_id; ?>"> <div align="left"> <span ><?php echo $msg; ?> </span> <span class="delete_button"><a href="#" id="<?php echo $msg_id; ?>" class="delete_update">X</a></span> </div> </li> <?php } db_close(); ?> This line 223 is this: $sql= mysql_query("SELECT msg_id,msg from messages order by msg_id desc"); ... I have tried to replace msg_id,msg with * but on this way I don't have dump from table... Quote Link to comment https://forums.phpfreaks.com/topic/216384-problem-select-from-database/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 20, 2010 Share Posted October 20, 2010 The error message means that your query failed due to an error and returned a FALSE value. If you echo mysql_error(); it will tell you why the query failed. Quote Link to comment https://forums.phpfreaks.com/topic/216384-problem-select-from-database/#findComment-1124437 Share on other sites More sharing options...
FilipKrstic Posted October 20, 2010 Author Share Posted October 20, 2010 Ohhhhhhhhhh............... "Unknown column 'msg' in 'field list'" .... To tired, I'm going to sleep. Thanks of lot... Quote Link to comment https://forums.phpfreaks.com/topic/216384-problem-select-from-database/#findComment-1124447 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.