php - Mysqli vs mysql, different result -


i have created script local (windows, xampp) , after checking if works moved online server (linux). have problem collection results database. have written using mysqli, prepared statements , first insert statement works perfect, when go @ results program tells can't find result.

i've got table: session columns: id, createdon , name when using following lines of code don't results

if ($stmt = $mysqli->prepare("select id, name `session` name = ?;")) {     $stmt->bind_param('s', $name);     $stmt->execute(); } 

no results , no errors. variable $stmt->num_rows have 0 value. variable $name contains: 'red'. when performing query:

select id, name `session` name = 'red'; 

in phpmyadmin results want, when test code using orginal mysql functions (mysql_connect, mysql_query , mysql_fetch_assoc). results want.

thus, program able fetch results want, mysqli not able fetch them. i'm doing wrong? or forgetting something?

try this:

if ($stmt = $mysqli->prepare("select id, name `session` name = ?")) {     $stmt->bind_param('s', $name);     $stmt->execute();     $stmt->store_result();  // add line     echo $stmt->num_rows; } 

also might want check documentation on mysqli first.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -