When I conduct a query within a query I get the following warning on myqsl_fetch_array.
I make my first search into one db table. Then taking the result I search the 2nd table, as you see 2 added next to the 2nd search on $con2, $sql2...
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ....php on line 36PHP Code:<?php
$bookTitle = "";
//echo "<span style='font-weight: bold; font-family: Verdana, Times New Roman, serif; font-size: 24px;'>".$bookTitle."</span><br /><br />\n";
$con = mysql_connect("","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("boti_book", $con);
$i = $_GET['page_num'];
//$keyword = "membership lists";
$sql = "SELECT * FROM boti_css WHERE fontweight LIKE '%bold%'";
$result = mysql_query($sql);
//echo $sql;
while($row = mysql_fetch_array($result))
{
echo "<span";
echo " style='font-weight: bold;' ";
echo "><a href='index.php?page_num=".$row['page_num']."' style='text-decoration: none; color: black;'";
?>
onMouseOver='this.style.color="red"; this.style.textDecoration="underline";' onMouseOut='this.style.color="black"; this.style.textDecoration="none";'
<?php
echo ">";
$searchPage = $row['page_num'].
$con2 = mysql_connect("","root","");
if (!$con2)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("boti_book", $con2);
$i = $_GET['page_num'];
//$keyword = "membership lists";
$sql2 = "SELECT * FROM boti_pages WHERE page_num = ".$searchPage;
$result2 = mysql_query($sql2);// or die(mysql_error());
//echo $sql;
while($row2 = mysql_fetch_array($result2))
{
echo $row2['content'];
echo " Page ".$row2['page_num']."</a></span><br /><br />\n";
}
//mysql_close($con2);
}
mysql_close($con);
?>




Reply With Quote