Current location: Hot Scripts Forums » Programming Languages » PHP » mysqli problem


mysqli problem

Reply
  #1 (permalink)  
Old 05-06-09, 03:34 PM
in2mobi in2mobi is offline
Newbie Coder
 
Join Date: Mar 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
mysqli problem

I am looking for help with resolving this issue. For some reason when I go to query my database using this code, I get these error messages.

Warning: mysqli_stmt: execute() invalid object or resource mysqli_stmt

Warning: mysqli_stmt: bind_result() invalid object or resource mysqli_stmt

Warning: mysqli_stmt: fetch() invalid object or resource mysqli_stmt

Warning: mysqli_stmt: close() invalid object or resource mysqli_stmt

Code:
<?php
$mysqli = new mysqli("localhost", "root", "","sampleprojects");

$query = "SELECT productid, name, price, description FROM product ORDER BY porductid";

$stmt = $mysqli->stmt_init();

$stmt->prepare($query);

$stmt->execute();

$stmt->bind_result($productid, $name, $pric, $description);

while($stmt->fetch()){
	echo "$productid, $name, $price, $description <br />";
}
$stmt->close();

$mysqli->close();

?>
The thing about it is that when I use the mysqli class to insert data everything goes fine, but it is only when I go to use the mysqli class to query the database(extract info) that everything goes crazy. Any help is greatly appreciated.

In2mobi
Reply With Quote
  #2 (permalink)  
Old 05-06-09, 04:52 PM
dgreenhouse's Avatar
dgreenhouse dgreenhouse is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: San Francisco
Posts: 457
Thanks: 0
Thanked 3 Times in 3 Posts
I don't see anything wrong with this other than not having a password.
This: "invalid object or resource mysqli_stmt", should be your indicator...
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
login, roles problem dbrook007 ASP.NET 10 11-10-06 03:42 PM
Form Display Problem neevrap02 Visual Basic 1 09-05-06 05:18 AM
Weird mysql_query and Smarty problem Canglan PHP 3 11-15-05 08:49 PM
Count problem kasic ASP.NET 1 10-20-04 12:23 AM
Asp and Microsoft Access 2002 problem gop373 ASP 2 10-06-04 09:13 AM


All times are GMT -5. The time now is 08:35 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.