Jump to content

New to mysqli


Go to solution Solved by dodgeitorelse3,

Recommended Posts

It's been many years since I did any of this stuff and just getting back into it. I did think of posting this in the mysql section but it's more of a code problem. I have the following...

$db=new mysqli(host,username,password,database);
$sql="SELECT * FROM users WHERE username=? AND password=?";
$stmt=$db->stmt_init()

That last line where I call $db->stmt_init() I get an empty browser - absolutely nothing where I should have a load of HTML appear. I have written the rest (just in case it matters) which is:

if ($stmt->prepare($sql)) {
  $stmt->bind_param("ss",$uname,$pword)
  $stmt->execute();
  $stmt->fetch();
  echo "id: ".$id."<br>Added: ".$added."<br>";
  $stmt->close();
}
Edited by Yesideez
Link to comment
https://forums.phpfreaks.com/topic/320053-new-to-mysqli/
Share on other sites

If you miss a semi-colon then no code runs because of the syntax error. It doesn't get as far as any errors that may occur. (set "diplay_startup_errors" ON in your php.ini file to be informed of any syntax errors.

Post your error messages - it helps us.

Link to comment
https://forums.phpfreaks.com/topic/320053-new-to-mysqli/#findComment-1621862
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.