Re: Variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the query only ever returns 1 row then like this:

$sql = "SELECT caa44340041, caa442400042 FROM caa44340, caa44240 WHERE caa443400018 = caa442400018; $result = ifx_query($sql, $connect_id) or die ("couldn't execute the query");
$row = fetch_assoc_array($result);

$first_name = $row['caa44340041'];

Dan Shirah wrote:
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.


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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux