Error in recalling Data from Link SQL statement

Ok today i have been running into a problem in PHP MySQl.

PHP will not query the information out of the linking statement in the query line.

Query Line:
[php]$data = mysql_query(“SELECT * FROM bs_cat,bs_forums WHERE bs_cat.catid = bs_forums.catid”) or die(mysql_error());[/php]

When i try and echo the data out of this query i just get a blank return.

Echo Information:
[php]while($row = mysql_fetch_array($data))
{
?>

 
<?php echo "view all"; echo "

".$row['cattitle']. "

"; ?>
 
 
 
<?php echo "
"; ?>
<?php echo "

".$row['postname']."> post by," .$row['postername']. "

"; echo "

".$row['postbody']."

"; ?>
 
<?php } ?>[/php]

A snippet or a fix to make this work would be really helpful thanks.

Try to: echo mysql_error() after your mysql_query to see if database server return any error. Also, probably your query will work fine (this may depend on MySQL version), but I would suggest to use this syntax:

SELECT * FROM bs_cat LEFT JOIN bs_forums ON bs_cat.catid = bs_forums.catid

I just tried that and i still get no echo and there is no error in the sql i did the echo mysql_error(); and still there is no error at all. But it will not allow me to view the data still

Are you sure there are data to be retuned by this query? Check if mysql_num_rows($data) == 0

When i navagate to the included page for the data to show it just shows this

[php]
Server error.

The website encountered an error while retrieving http://127.0.0.1/temp/files/forums.php. It may be down for maintenance or configured incorrectly.

Here are some suggestions:
Reload this web page later.
More information on this error
Below is the original error message

HTTP Error 500 (Internal Server Error): As unexpected condition was encountered while the server was attempting to fulfill the request.[/php]

Yet the IIS7.5 is up

Navigating to included php files was probably not supposed. If you want to view data in your database you can use phpMyAdmin, or any similar script/program.

Sponsor our Newsletter | Privacy Policy | Terms of Service