cant select from different tables when switching pages
Posted: Sun Jul 11, 2004 1:20 pm
I have 2 tables one called eventslist and one called photogallery
My problem is that using this code it will only let me select from eventslist and not from photogallery
i will be left with id= or details=
if i changed the code to select from eventslist it will find id=1 or details=1
so can someone please tell me how to make it select from the other table
My problem is that using this code it will only let me select from eventslist and not from photogallery
i will be left with id= or details=
if i changed the code to select from eventslist it will find id=1 or details=1
so can someone please tell me how to make it select from the other table
Code: Select all
<?php
echo "<table width="798" height="30" border="0" cellpadding="0" cellspacing="0">";
if (!$id && !$details){ $result = mysql_query("SELECT * FROM eventslist");
$num_rows = mysql_num_rows($result);
while ($u = mysql_fetch_array($result)) {
extract($u);
$f_price = number_format($price,2);
echo"
<tr>
<td valign="top" onmousedown="LmDown(this, 'menuentry_hovere')" onmouseup="LmUp('events6.php?id=$id')" onmouseover="LmOver(this, 'menuentry_hovere')" onmouseout="LmOut(this, 'menuentrye')">
<table border="0" cellpadding="0" cellspacing="0" class="eventstable">
<tr>
<td width="200" class="eventname">$eventname</td>
<td width="498" class="eventdescription">$description</td>
<td width="100" class="eventdate">$date</td>
</tr>
</table></td>
</tr>
";
}
}
elseif ($id && !$details) { $result = mysql_query("SELECT * FROM photogallery WHERE id='$id'");
$num_rows = mysql_num_rows($result);
while ($u = mysql_fetch_array($result)) {
extract($u);
$f_price = number_format($price,2);
echo" <table width="818" height="232" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><table width="818" height="192" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10"> </td>
<td width="192" align="center" valign="middle" background="$pic1"><img src="camera.jpg" width="190" height="190"></td>
<td width="10"> </td>
<td width="192"align="center" valign="middle" background="$pic2"><img src="camera.jpg" width="192" height="192"></td>
<td width="10"> </td>
<td width="192" align="center" valign="middle" background="$pic3"><img src="picbg.gif" width="192" height="192"></td>
<td width="10"> </td>
<td width="192" align="center" valign="middle" background="$pic4"><img src="picbg.gif" width="192" height="192"></td>
<td width="10"> </td>
</tr>
</table>
<table width="818" height="40" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><table width="818" height="20" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10"> </td>
<td width="192" align="center" valign="middle" background="textbg.gif"><a href="events6.php?details=$details">Click for more Information</a></td>
<td> </td>
<td width="192" align="center" valign="middle" background="textbg1.gif">Lovely
Camera</td>
<td> </td>
<td width="192"> </td>
<td> </td>
<td width="192"> </td>
<td width="10"> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
";
}
}
elseif (!$id && $details) {
$result = mysql_query("SELECT * FROM photogallery WHERE details='$details'");
$num_rows = mysql_num_rows($result);
while ($u = mysql_fetch_array($result)) {
extract($u);
$f_price = number_format($price,2);
echo"<table width="798" height="400" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="300">$pic</td>
</tr>
<tr>
<td height="100">$description</td>
</tr>";
}
}
echo "</table>\n";
?>