$html = ' some html here <br>';
function sql($mysqli,$html){
$stmt = $mysqli->prepare("SELECT * FROM `jobs` WHERE `out` is null");
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($job_id,$vin,$yr,$mk,$mdl,$color,$miles_in,$miles_out,$quoted,$price,$phone,$customer,$bal,$tax,$msg,$in,$out);
$stmt = $mysqli->prepare("SELECT * FROM jobs a WHERE a.in between ? and ?");
$stmt->bind_param('ss', $startday, $endday);
$startday = '2013-01-01';
$endday = '2013-12-31';
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($job_id,$vin,$yr,$mk,$mdl,$color,$miles_in,$miles_out,$quoted,$price,$phone,$customer,$bal,$tax,$msg,$in,$out);
while($stmt->fetch()){
Below is the same line with two different approaches: the commented part works but I cannot get the function to add the same values to the html string and then return it to the script when done with the php code.
$html.= $vin.' - '.$count.' <br> '; // echo $vin.' - '.$count.' <br> ';
$count++;
}
return $html;
}
sql($mysqli,$html);
echo $html;
My output from this is 'some html here' this is because that is how the string was defined. I'm hoping to get this function to add values pulled from the mysql query and then add them to a string that I can print out at the end of all the php. the output of the function if we use echo instead of $html concatenation is
12345 - <br>
123 - 1 <br>
1236485 - 2 <br>
any ideas?