Hi there,
The following code does exactly what I want but I was wondering if there's a cleaner, neater way to do it:
$dbresult = db_query("
SELECT
ID_MEMBER
FROM {$db_prefix}store_transactions
WHERE ID_MEMBER = $ID_MEMBER", __FILE__, __LINE__);
$found = db_affected_rows();
mysql_free_result($dbresult);
// If the record exists
if ($found == true)
{
$dbresult = db_query("
SELECT
ID_MEMBER
FROM {$db_prefix}store_group_log
WHERE ID_MEMBER = $ID_MEMBER", __FILE__, __LINE__);
$found = db_affected_rows();
mysql_free_result($dbresult);
// If the record exists
if ($found == true)
echo 'Something found';
else
echo 'Nothing found';
}
The logic is, see if the current member is found in store_transactions, if yes, then see if the current member is found in store_group_log.
Now, is there a way to combine the two?
=== Update (failed attempted) ===
I tried this following but did not work:
$dbresult = db_query("
SELECT t.ID_MEMBER, i.ID_MEMBER
FROM ({$db_prefix}store_transactions AS t, {$db_prefix}store_group_log AS i)
WHERE t.ID_MEMBER = $ID_MEMBER AND i.ID_MEMBER = $ID_MEMBER", __FILE__, __LINE__);
$found = db_affected_rows();
mysql_free_result($dbresult);
// If the record exists
if ($found == true)
echo 'Something found';
else
echo 'Nothing found';