Jump to content

mysql_fetch_array() error


Bentley4

Recommended Posts

Hi guys!

I inputted text into the field 'TSuperQuestion' of my table. Now I am trying to echo that text.

I get the following error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /webusers/ph6theo/public_html/Code-sandbox.php

This is my code:

<?PHP  
$con = mysql_connect("localhost","ph6theo", "xxxx");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("ph6theo_testDB") or die(mysql_error());
$result = mysql_query("SELECT * FROM Q&ATable");
$row = mysql_fetch_array($result);
echo $row['TSuperQuestion'];
?>

 

Can anyone help?

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

first off get rid of

or die(mysql_error()) or replace with or die(mysql_error("oops"))

don't want hackers getting you secret information.

 

Can you get to the database directly with something like phpMyAdmin and test

SELECT * FROM Q&ATable

directly.

 

Do you realy want all (*)

 

Desmond.

 

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.