Hi,
I've looked through a few posts similar to this and still can't find my answer. I have two databases and i wanna select information from each, only the rows i want to select from have the same name, i think that is what's causing the poblem, heres an example:
table1:
| row1 | row 2
| this is row 1 of table 1 | this is row 2 of table 1 |
table2:
| row1 | row 2 |
| this is row 1 of table 2 | this is row 2 of table 2 |
$test = "row";
$db = mysql_connect("localhost","username","password");
mysql_select_db("demo",$db);
$query = mysql_query("SELECT a.*, b.* FROM table1 AS a, table2 AS b WHERE a.row1 LIKE '%$test%' AND b.row1 LIKE '%$test%'",$db);
while($get=mysql_fetch_array($query))
{
echo $get['row1'];
// prints this is row one of table two
echo $get['row2'];
// prints this is row two of table two
}
I'm trying to get all values in the $get array for both tables. This obviously isn't right as its only selecting the info from table 2. Anyone able to help me?
Thanks
Ant