Answer the question
In order to leave comments, you need to log in
How to make a record in 2 mysql tables?
Hello, please tell me how to do it right
, I have 2 codes,
this one gets the user's email from the table
static function getEmail($id='') {
global $db;
if(!$id) return;
$email=$db->fetchRow('select email from '.TABLE_USERS.' where id="'.$id.'"');
return $email;
}
function addHit($id=0) {
global $db;
if(!$id) $id=$this->id;
$res_del=$db->query('update '.TABLE_BANNERS.' set `clicks` = `clicks`+1 where `id`="'.$id.'"');
return 1;
}
Answer the question
In order to leave comments, you need to log in
I don't understand what the problem is to call the getEmail method in the addHit function and store the email in a variable and do whatever.
What does 2 codes mean?
Made very unclear.
And don't use global $db; globals are always bad.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question