Jump to content

Recommended Posts

I bet this is going to be a really simple error but i dont understand why i get thie error:

 

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /usr/home/shopinbrooklin/.public_html/index.php on line 19

 

from this code:

 


<?php

require_once("./inc/connect_db.php");
require_once("./header.html");

$index_header1 = $_GET['index_header1'];
$index_body1 = $_GET['index_body1'];
$index_header2 = $_GET['index_header2'];
$index_body2 = $_GET['index_body2'];


$query = "SELECT header, body, header2, body2
FROM index
";

//print("$mysql_link $query<br />");

$mysql_stuff = mysql_query($query, $mysql_link);
while($row = mysql_fetch_row($mysql_stuff)) {
$index_header1 = htmlspecialchars(stripslashes($row[0]));
$index_body1 = htmlspecialchars(stripslashes($row[1]));
$index_header2 = htmlspecialchars(stripslashes($row[2]));
$index_body2 = htmlspecialchars(stripslashes($row[3]));	

print("
  <table border=\"0\">
    <tr>
      <td colspan=\"2\" background=\"images/comp3_04.png\"><h1 class=\"style1\">$index_header1</h1>
          <hr />
          <div align=\"justify\" class=\"style8\">
            <p class=\"style9\"><span class=\"style10\"><img id=\"myimg\" src=\"images/shopping.png\" width=\"185\" height=\"185\" align=\"right\"/> 
		$index_body1
		</span>
          <br />
	  <br />
            *SHOP IN BROOKLIN!* <br />
            Brought to you by C&C Connections <br />
            <br />
            <br />
		<br />
            </p>
          </div>          <div align=\"left\"></div></td>
      </tr>
    
    <tr>
      <td colspan=\"2\" valign=\"top\"><h1 class=\"style1\">$index_header2</h1>
          <hr />
          <p class=\"style1 style10\">
		$index_body2
	  <a href=\"crier.html\">more ></a></p>
</td>
      </tr>
  </table>
");

}


require_once("./footer.html");

?>

Link to comment
https://forums.phpfreaks.com/topic/158297-mysql_fetch_row-error/
Share on other sites

Means your query is probably failing.

 

Change this line to 1 line:

 

$query = "SELECT header, body, header2, body2 FROM index";

 

And this line to:

 

$mysql_stuff = mysql_query($query, $mysql_link) or die(mysql_error());

 

Tell me what the output is.

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.