Re: mysqli prepapred SELECT statement

From: Date: Sat, 17 Jul 2004 02:02:51 +0000
Subject: Re: mysqli prepapred SELECT statement
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-190801@lists.php.net to get a copy of this message
* Thus wrote Support: > Anyone working with php5/mysql 4.1 yet with the new ext/mysqli? > > This has me stumped: > > $stmt = $mysqli->prepare('SELECT * FROM users WHERE userid=?'); > > $stmt->bind_param('i', $userID); > > $stmt->execute(); > > ...now how to get the results??? I can't use bind_result() since I have no > clue how many columns `*' will retreive. I have been reading the docs now > for over two hours and need to get back to work :-) The documentation might be a bit in error. In normal, prepare, bind, execute method of doing queries usually returns true/false or a result handle. true/false if it is an action query ie insert, update, delete or a result handle when using select or a stored procedure that returns a resultset. So going by that logic you should be able to do something like: $result = $stmt->execute(); which should be a mysqli_result class if the query executed properly. I havn't touched mysqli stuff but hopefully that will help with something. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid!

« previous php.general (#190801) next »