2009-12-07, 06:16 PM
Hello, I am writing a script and I need some help. When I retrieve a form input, do I use the $_POST[] function or does myBB have its own function? Also how do I filter the inputs (numbers and text)? I also need a list of the db functions (for a SELECT with 2 conditions in WHERE, and a 1 line INSERT).
Here's how I executed the SQL queries when i used phpBB:
Here's how I executed the SQL queries when i used phpBB:
$sql = 'SELECT user_id, pet_name FROM adoptables_pets WHERE user_id = '. $user->data['user_id'] ." OR pet_name = '". $pet_name ."' LIMIT 1";
$result = $db->sql_query($sql);
$adoption = $db->sql_fetchrow($result);
$sql_ary = array(
'user_id' => $user->data['user_id'],
'pet_name' => $pet_name,
'pet_type' => $pet_type,
'time' => time(),
'hits' => 1,
);
$sql = 'INSERT INTO adoptables_pets '. $db->sql_build_array('INSERT', $sql_ary) .';';
$db->sql_query($sql);