Jump to content

[SOLVED] Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result reso


Aureole

Recommended Posts

I'm getting that error for some reason unknown to me...here's my code.

 

<?php
$h='localhost';
$u='Username';
$p='Password';

$conn = mysql_connect($h, $u, $p)
or die("mysql_connect() - Failure!<br />");
print "mysql_connect() - Success!<br />";

$which = mysql_select_db(veraci7y_website)
or die("mysql_select_db() - Failure!<br />");
print "mysql_select_db() - Success!<br />";

$select = mysql_query("SELECT * FROM news")
or die ("mysql_query() - Failure!<br />");
print "mysql_query() - Success!<br />");

while($row = mysql_fetch_array($result)) {
echo $row['author'];
echo $row['shortstory'];
}

mysql_close($conn);
?>

 

Thanks a lot.

$result should be $select for this line:

while($row = mysql_fetch_array($result)) {

 

Also mysql_select_db does not return any value so need to setup a variable ($which) to hold the returned value.

Oops typo! I meat:

Also mysql_select_db does not return any value so no need to setup a variable ($which) to hold the returned value.

 

Which means change this line

$which = mysql_select_db(veraci7y_website)

to this:

mysql_select_db('veraci7y_website')

Sorry for double post. Ok well that fixed that but now something strange is happening...

 

At the bottom right of the page I am seeing:

 

IPS Driver Error

There appears to be an error with the database.

You can try to refresh the page by clicking here

 

That's an Invision Power Board error and the thing is...

 

1) My Forum is working fine...

2) My site is connected to my forum in ways like the latest posts are shown on the site and I am using the IPB SDK but they are both working fine so why is there an error.

 

ALSO the error has some style information associated with it so it's messing with my font sizes making everything small.  ???

 

 

http://www.veraci7y.net/index.php just in case.

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.