Page 1 of 1

two variables with same value bind_param mysqli statement

Posted: Sat Sep 05, 2009 3:59 am
by chidge
so if I have the following:

Code: Select all

 
$i = $_GET['user_id']
$e = $_GET['user_email']
 
 
 
$query = "SELECT maintable.name, maintable.last, ideas.wicked, maintable.past_email, maintable.present_email
          FROM maintable
          LEFT JOIN ideas ON maintable.user_id = ideas.ideas_id
          WHERE (maintable.user_id=? AND maintable.present_email=?)
          OR (maintable.user_id=? AND maintable.past_email=?)";
 
 
$stmt = $conn->stmt_init();
if ($stmt->prepare($query)){
$stmt->bind_param("ssss", $i, $e, $i, $e);      
 
is there a better way to add the bind_param variables that have the same value?
(note this is just a snippet of code to illustrate this point)

thanks in advance