Re: [PHP] mysqli prepapred SELECT statement

2004-07-16 Thread Curt Zirzow
* 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!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mysqli prepapred SELECT statement

2004-07-16 Thread 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 :-)

$stmt->close();

Jim Grill

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php