I have a really strange problem.. my code is working locally on my machine.. when i uploaded it to the server... everything was working except this one page where im getting this error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /hsphere/local/home/tayyab/readmirror.com/showcategory.php on line 244
coud there be some setting on my hosts server that is different on my local server?
this is the code:
<?php
require("connection.php");
?>
<?php
$category = $_GET["category"];
$sql2="SELECT currentedition.editionid, editions.volume, editions.printnumber, editions.releasedate, articles.headline, articles.articleid, articles.articletext, subcategories.subcatname, authors.authorlastname, authors.authorfirstname, articles.articletext, articles.subheading, articles.datewritten, articles.ordernum, categories.catname, subcategories.ordernum
FROM (currentedition LEFT JOIN editions ON currentedition.editionid = editions.editionid) LEFT JOIN (((categories RIGHT JOIN subcategories ON categories.catid = subcategories.catid) RIGHT JOIN articles ON subcategories.subcatid = articles.subcatid) LEFT JOIN authors ON articles.authorid = authors.authorid) ON editions.editionid = articles.editionid WHERE subcategories.catid = $category ORDER by articles.ordernum ";
$mysql_result2=mysql_query($sql2,$link_id);
while ($row=mysql_fetch_array($mysql_result2))
{
$headline=$row["headline"];
$articletext=$row["articletext"];
$articleid=$row["articleid"];
$authorlastname=$row["authorlastname"];
$authorfirstname=$row["authorfirstname"];
$snippet = substr($articletext, 0, 299) . "..."; //show 250 characters plus ..
echo "<p class='MsoNormal'><font color='#000080'><span style='font-size:10.0pt;font-family:Verdana'><a href='showarticle.php?articleid=$articleid'><font color='#000080'><b>$headline</b></font></a><br></span></font>";
echo "<span style='font-size:10.0pt;font-family:Verdana'>$authorfirstname $authorlastname</span></p>";
echo "<p><span style='font-size: 10.0pt; font-family: Verdana'>$snippet</span></p>";
echo "<h1 style='text-align: left'><b><font face='Verdana'><u><font color='#000080' size='1'><a title='$headline' href='showarticle.php?articleid=$articleid'><font color='#000080'>";
echo "<h1 style='text-align: left'><span style='font-size: 8.0pt; font-family: Arial'> </span><font color='#999999' face='Verdana'>_______________________________________________</font></h1>";
}
?>
This is the connection.php code:
//This is the connection string
$link_id = mysql_connect ("something.something.com", "the_something", "something");
mysql_select_db("the_something", $link_id);