i need help with this code, i have two tables(tbl_title and tbl_author). i want to display both title and the author, can anyone help me? here's my code:
<?php
include 'conn.php';
$search=$_POST['search'];
$sy=explode('-',$search);
$result = mysql_query ("SELECT * FROM `tbl_title` WHERE (`year` >= $sy[0] AND `year` <= $sy[1])");
echo '<h2>Result</h2>';
if ($row = mysql_fetch_array($result))
{
do{
echo "<b>Title:</b>";
echo '<a href="">'.$row["title"].'</a>';
echo "<br>";
$result2 = mysql_query ("SELECT * FROM `tbl_author`");
if ($row2 = mysql_fetch_array($result2))
echo "<b>Author:</b>";
echo $row2["author"];
echo "<p>";
}
while($row = mysql_fetch_array($result));
}
else
{
echo 'Sorry, no records were found!';
}
?>
this code only display the title and not the title. i think theres something wrong with my tbl_author code
<?php
include 'conn.php';
$search=$_POST['search'];
$sy=explode('-',$search);
$result = mysql_query ("SELECT * FROM `tbl_title` WHERE (`year` >= $sy[0] AND `year` <= $sy[1])");
echo '<h2>Result</h2>';
if ($row = mysql_fetch_array($result))
{
do{
echo "<b>Title:</b>";
echo '<a href="">'.$row["title"].'</a>';
echo "<br>";
$result2 = mysql_query ("SELECT * FROM `tbl_author`");
if ($row2 = mysql_fetch_array($result2))
echo "<b>Author:</b>";
echo $row2["author"];
echo "<p>";
}
while($row = mysql_fetch_array($result));
}
else
{
echo 'Sorry, no records were found!';
}
?>
this code only display the title and not the title. i think theres something wrong with my tbl_author code