Jump to content

not a valied MySQL result error


the_oliver

Recommended Posts

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

 

Link to comment
Share on other sites

(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!

Link to comment
Share on other sites

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());

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.