the_oliver Posted July 24, 2007 Share Posted July 24, 2007 Hello, Im getting an error: Warning: mysql_fetch_arrey(): supplied argument is not a valid MySQL result in /usr/home/blaaa on line 29 This is becaue one of the feilds thats being selected form the database contains a '. All of the data that i ask for in the select still arives and works, i just dont want the warning! Is there a way to deal with this? (I need it to be in the datbase as ' not \' or the html code for ') Thanks Quote Link to comment Share on other sites More sharing options...
trq Posted July 24, 2007 Share Posted July 24, 2007 Post your code. Quote Link to comment Share on other sites More sharing options...
the_oliver Posted July 24, 2007 Author Share Posted July 24, 2007 (starting at row 27) $query_send = "select * from template where cid = '" . $_SESSION['cid'] . "' and tid = '" . $_SESSION['tid']. "'"; $result_send = @mysql_query($query_send, $connection); $row_send = mysql_fetch_array($result_send); if ($row_send[type] == 't') { $text = nl2br($_SESSION['text_body']); $text = str_replace("<br />\n<br />","<br />", $text); echo $text; } else { echo $_SESSION['output']; } Thanks! Quote Link to comment Share on other sites More sharing options...
fert Posted July 24, 2007 Share Posted July 24, 2007 change $result_send = @mysql_query($query_send, $connection); to $result_send = @mysql_query($query_send, $connection) or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
per1os Posted July 24, 2007 Share Posted July 24, 2007 This is becaue one of the feilds thats being selected form the database contains a '. Why do you think that, it is not true btw. The issue is arising in that there is something going wrong with the select statement, as fert pointed use that to generate the error. My bet is that either the table is misspelled, or the session variables contain improperly formed data. Can tid or cid be anything but a number? If not than no need to use single quotes around them. Also try adding back ticks around the table name and cid and tid (backticks are ` by the 1 key). Another tip, on the MySQL_Query portion you are using the error suppressor, this should not be used unless by some weird circumstance your php data always throws an error on the mysql_query function. It is a result of bad programming as code should work without having to surpress errors. Report back with what fert suggest to try and what the error is. Note this may be helpful to try too: $result_send = mysql_query($query_send, $connection) or die("SQL WAS:" . $query_send . "<Br />Error Was:" . mysql_error()); Quote Link to comment 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.