1. tableA (a_id, a_name, a_data)
2. tableB (b_id, b_name, a_id, a_name, b_data)
(all same columns have same data ; a_id=a_id, a_name=a_name in both tables!!!) listed on page1 as hrefs. The href leads to a result page2 with page2.php?id=$row['b_id'].
on page2 i use:
Code: Select all
if (isset($_GET['id'])) {
$id = intval($_GET['id']); {Code: Select all
$query = "SELECT * FROM tableB WHERE b_id = $id";I used:
Code: Select all
$query = "SELECT * FROM tableB WHERE b_id <> $id ";Can someone help me with proper second IF statement?
Something like this? (this isn't working
Code: Select all
if (isset($_GET['id'])) {
$id = intval($_GET['id']); {
$aid = intval($_GET['a_id']); {
//conn//
$query = "SELECT * FROM tableB WHERE b_id <> $id AND b_id = $aid ";
$sql = mysql_query($query)or die(mysql_error());
while ($row = mysql_fetch_assoc($sql))
{
echo $row['b_name']. "<br>";
}
}
}
}I tried :
Code: Select all
SELECT * FROM tableB JOIN tableA ON tableA.a_id=tableB.a_id WHERE tableB.b_id <> $id AND tableB.b_id = $aid";p.s. do i have to close every { in one php or if I leave it open it will transcend to another for future use?
I would appreciate if you show me how to untangle this!
Thanx!