Re: Variables

From: Date: Fri, 08 Dec 2006 15:57:35 +0000
Subject: Re: Variables
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-27308@lists.php.net to get a copy of this message
Try after your line "$result = ifs_query...." $row=mysql_fetch_assoc($result); $first_name=$row[caa44340041]; $last_name=$row[caa442400042]; Below should work if you have multiple rows returned in the query and building a list box - while ($row=mysql_fetch_assoc($result)) { echo "<OPTION VALUE=".$row[caa442400042]."> ".$row[caa442400042]; } Good luck! -----Original Message----- From: mrsquash2@gmail.com To: php-windows@lists.php.net Sent: Fri, 8 Dec 2006 10:40 AM Subject: [PHP-WIN] Variables How would I assign the output of a query into variables? I have the following code: $sql = "SELECT caa44340041, caa442400042 FROM caa44340, caa44240 WHERE caa443400018 = caa442400018; // THE QUERY ITSELF TO SELECT THE DATA $result = ifx_query($sql, $connect_id) or die ("couldn't execute the query"); // ASSIGNS THE RESULTS OF THE QUERY TO THE VARIABLE $RESULT What I want to do is take the result, which would be a single record containing caa44340041 and caa442400042 and put these vaules into the variable $first_name (caa44340041) and $last_name (caa442400042) so I can use them later on to populate multiple field entries in a form. Would I do something like this? $sql = "SELECT caa44340041, caa442400042 FROM caa44340, caa44240 WHERE caa443400018 = caa442400018; // THE QUERY ITSELF TO SELECT THE DATA $result = ifx_query($sql, $connect_id) or die ("couldn't execute the query"); // ASSIGNS THE RESULTS OF THE QUERY TO THE VARIABLE $RESULT $first_name = ($result, caa44340041); ??? any help is appreciated. ________________________________________________________________________ Check Out the new free AIM(R) Mail -- 2 GB of storage and industry-leading spam and email virus protection.

« previous php.windows (#27308) next »