php-windows Digest 9 Dec 2006 04:08:26 -0000 Issue 3086
Topics (messages 27305 through 27310):
Variables
27305 by: Dan Shirah
27306 by: Kevin Smith
27307 by: Stut
27308 by: tclorenzted.netscape.net
ftp_connect() failed
27309 by: Alek Silverstone
dynamic page caching help
27310 by: Harpreet
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
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.
--- End Message ---
--- Begin Message ---
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.
--- End Message ---
--- Begin Message ---
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.
The manual is your friend... http://php.net/ifx_fetch_row
-Stut
--- End Message ---
--- Begin 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: [EMAIL PROTECTED]
To: [email protected]
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.
--- End Message ---
--- Begin Message ---
<?php
set_time_limit(0);
$i=1;
while (TRUE)
{
$date=date('H:i:s');
$ftp=ftp_connect('127.0.0.1',21,10);
if ($ftp) $login=ftp_login($ftp,'anonymous',$i);
if ($ftp && $login)
{
if (($i % 100) === 0) echo "[$date] $i - online.\n";
} else {
echo "[$date] $i - offline.\n";
break;
}
if ($ftp!==FALSE) ftp_close($ftp);
$i++;
}
?>
This script failed after 100-10000 loops.
Tested on various servers and OSes.
What's wrong?
--- End Message ---
--- Begin Message ---
I have a search page that returns results in about 10-15 seconds. If I
refresh the page it again takes the same time as the initial search. Is
there a best way to reduce the time on a refresh.
Reading the internet I see info on caching results. Can someone point me
to a good site that explains caching in detail and how to go about using
it.
Any other ideas , please help
Regards
Harpreet
--- End Message ---