Possible Duplicate:
mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in php
mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource
Im working with two MYSQL databases trying to gahter data from both of them to insert in to field for submission to another database. When i go and use the mysql_fetch_assoc() for the query it gives me an error. I did some research and I cannot find anything that really pertaied to my issue. I was wondering if i could get some help.
<?php
$connect = mysql_connect("localhost","***********","*********") or die ("Couldn't Connect"); //host,username,password
mysql_select_db("virtua15_jo151") or die ("Could not find database");
$query = mysql_query("SELECT jos_comprofiler.firstname, jos_comprofiler.lastname, jos_users.username, jos_comprofiler.cb_country, jos_users.email FROM jos_users LEFT JOIN jos_comprofiler ON jos_users.id=jos_comprofiler.id WHERE jos_users.id = " . mysql_real_escape_string($id));
if ($row = mysql_fetch_assoc($query))
{
$firstname = $row['firstname']; //This is whatever the field is called in your table
$lastname = $row['lastname'];
$loginname = $row['jos_users.username'];
$country = $row['cb_country'];
$email = $row['email'];
}
?>
below this is all HTML I can include that if need be,