Results 1 to 2 of 2

Thread: 1st Prepared Statement is not returning results

  1. #1
    Join Date
    Jul 2006

    1st Prepared Statement is not returning results

    I have followed instructions from a tutorial, but the following will not return results. I know that the query it is performing does have corresonding values. But, the while $stmt->fetch() loop never gets entered.

    		$host = "#####";
    		$mysqli = new mysqli($host, $user, $password, $database);
    		if (mysqli_connect_errno()) {
    			printf("Connect failed: %s\n", mysqli_connect_error());
    		/* prepare statement */
    		if ($stmt = $mysqli->prepare("SELECT UserID, UserFirstName FROM User where UserEmail = ?"))
    			/* bind variables to prepared statement */
    			  /* fetch values */
    			while ($stmt->fetch()) 
    				printf("results:%s %s\n", $col1, $col2);
    			/* close statement */
    		/* close connection */
    Thank you for any insight

  2. #2
    Join Date
    Jul 2006
    The issue with my code was that i was using double quotation marks in the $stmt->bind_param() call to indicate parameter type ("ss"). Once i switched to single quotes, it is magic

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center