Jump to content

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result


adam291086

Recommended Posts

what is wrong with this

 

<?php
if ($_SERVER['HTTP_REFERER'])
{
    if($_GET['id'])
    {
    $con = mysql_connect("","","");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }

    mysql_select_db("rubberduckiee", $con);

    $result = mysql_query("SELECT * FROM email_content where id=".$_GET['id']);

    while($row = mysql_fetch_array($result))
      {
   
            if($_GET['part'] == "body")
            {
                echo $row['email_content_body'];
            }
            elseif($_GET['part'] == "footer")
            {
                echo $row['email_content_footer'];
            }
            elseif ($_GET['part'] == "header")
            {
                echo $row['email_content_header'];
            }
            
      }
}
}

?>

i am getting the error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/rubberduckiee/webapps/editor/email_editor.php on line 17

Your query is failing. Try checking for errors:

 

$sql = "SELECT * FROM email_content where id=".$_GET['id']);
$result = mysql_query($sql) or trigger_error(mysql_error() . '<br />Query was:' . $sql,E_USER_ERROR);

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.