I am trying to select a message from a table in a database. the message will will be in column 'msg' and will be in same row as id='0'. I need that msg put to the screen. With the code below I get the error: Resource id #2
Can someone please explain how I can fix this.. Thankyou in advance. <? $msgcre = "SELECT msg FROM creators WHERE id='0'"; $msg = mysql_query($msgcre); echo "<FONT color='#000000' style='font-size: 10pt; font-weight: bold'>$msg</font>"; ?> Andrew, Although the assignment statement looks as though the LHS (left-hand side) should contain the result of the query, it does not (as you have discovered). Instead of being an integer or string, it is something called a 'resource'. You have already 'met' a resource in connection with the db connect process. After issuing a query, you must then use one of the mysql_fetch_... functions to extract the data, one field, or one row at a time, from the 'resource'. Please check out the manual at http://uk2.php.net/manual/en/ref.mysql.php. Also you might consider working through one of the many excellent texts and/or online articles discussing the PHP/MySQL combination. Regards, =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]