-
January 22nd, 2009, 12:56 AM
#1
mysqli retrieve unspecified amount of fields
hi
i faced this problem since yesterday and I still haven't got the right solution yet
to cut it short, here's my preparedstatement query
Code:
$query = "select * from ingredients where id=? and language=?";
$stmt = $dbi->prepare($query);
$stmt->bind_param('ss', $ID,$language);
$stmt->execute();
the table has the field name that starts with ingredients1, ingredients2,quantity1,quantity2 and so on until ingredients50 and quantity50.
my problem is how do I read all those returned fields? I need the returned fields to be set to its respective variable name, for example the field ingredients1 assigned to variable $ingredients1 and so on?
i tried the solution at http://forums.devshed.com/php-develo...ay-568982.html but still can't get it working as I want it
any help is greatly appreciated! thanks!
-
January 22nd, 2009, 11:10 AM
#2
Re: mysqli retrieve unspecified amount of fields
no one understand my prob?
-
January 22nd, 2009, 11:51 AM
#3
Re: mysqli retrieve unspecified amount of fields
Learn patience. It hasn't even been 12 hours. Not everyone who helps out here checks in every day.
Concerning your problem, if you convert your result to an array, you can use PHP's extract() function to convert them to respective variable names.
EDIT: Also, if you are using a SELECT command, you shouldn't be using a prepared statement, but instead perform a simple query.
Last edited by PeejAvery; January 22nd, 2009 at 11:54 AM.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
March 19th, 2009, 11:22 PM
#4
Re: mysqli retrieve unspecified amount of fields
Originally Posted by PeejAvery
Learn patience. It hasn't even been 12 hours. Not everyone who helps out here checks in every day.
Concerning your problem, if you convert your result to an array, you can use PHP's extract() function to convert them to respective variable names.
EDIT: Also, if you are using a SELECT command, you shouldn't be using a prepared statement, but instead perform a simple query.
ouh..thanks... simple select should be OK it seems..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|