i manually add a customer number to a user in my users table when they sign up for services.
i am able to use php to go into the usertable and echo the number i assign, but i also want to then take that number and use it in mysql queries across multiple tables all on the same page.
using User Cake if that helps
here is the code that successfully prints the customer number out
[php]
mysql_connect(‘connectiondetails’) or die (mysql_error());
mysql_select_db(‘tablename’) or die (mysql_error());
$result = mysql_query("SELECT * from uc_users WHERE email = ‘$loggedInUser->email’ ");
while($row = mysql_fetch_array($result)){
echo “” . $row[‘customernumber’] . “”;
}
?>[/php]
what i dont know how to go about is using that customer number as the criteria to search my other tables/databases to then only display fields across all tables/db that WHERE customer number = $loggedinuser->customernumber
when i attempt this same script on another table on either the same DB or separate i receive this error
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:\Hosting\11440413\html\lastaudit.php on line 6
[php][php]
mysql_connect(‘connectiondetails’) or die (mysql_error());
mysql_select_db(‘tablename2’) or die (mysql_error());
$result = mysql_query("SELECT * from uc_users WHERE email = ‘$loggedInUser->email’ ");
while($row = mysql_fetch_array($result)){
echo “” . $row[‘customernumber’] . “”;
}
?>[/php][/php]