I have a function in my script which sends an e-mail to my client
company with details of a shopping cart order. I was wondering if it is
possible to use a while loop inside the mail function so that I can send
details of multiple items in one e-mail.
Here is the code I am using. And bear in mi
This may be a baisc programming query, to which I dont have the ansa,
but can you do a while () loop, but set a condition so that it misses one
ie
$counter = -1;
while(++$counter <50){
do a task on all between 1 and 50 except on 39
}
Thanks
--
PHP General Mailing List (http://www.php.net/
quot;;
-Original Message-
From: Phil Reid [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 12, 2002 1:27 PM
To: [EMAIL PROTECTED]
Subject: [PHP] while...
I have a function in my script which sends an e-mail to my client
company with details of a shopping cart order. I was wondering if it i
Hi people
I am more like ASP programmer and new to PHP, In ASP, when we want to take all records
in dayabase to display. After we did do the query, we call " Do while not RS.EOF (
mean do while not end of record file) , and display record accroding to the query.
Is there anything that do teh sa
Hi,
i am fiddling with a script and need to change a while-loop from running on
mysql_fetch_array to a "normal" array?
ie - i have:
while($myrow=mysql_fetch_array($result)) { etc...
But i want the loop to run with an array i created earlier ($anotherarray =
[key1] => value1, [key2] => value2).
Hi Caspar!
$counter = -1;
while(++$counter <50)
{
if ($counter != 39)
{
do a task on all between 1 and 50 except on 39
}
}
This should do...
Cheers,
Kiko
--
It's not a bug, it's a feature.
christoph starkmann
mailto:[EMAIL PROTECTED]
http://www.gruppe-
Thanks to all
-Original Message-
From: Christoph Starkmann [mailto:[EMAIL PROTECTED]]
Sent: 11 April 2002 07:22
To: 'Caspar Kennerdale'; '[EMAIL PROTECTED]'
Subject: RE: [PHP] while() query
Hi Caspar!
$counter = -1;
while(++$counter <50)
{
On Friday 12 April 2002 06:15, Caspar Kennerdale wrote:
> This may be a baisc programming query, to which I dont have the ansa,
>
> but can you do a while () loop, but set a condition so that it misses one
> ie
>
> $counter = -1;
> while(++$counter <50){
>
> do a task on all between 1 and 50 excep
Does anyone know why this isn't working?? What I am trying to do is display
photos from a database based on each month. This part works fine when I set
it to the current month of December (today) as that is when I uploaded the
photos.
However, when I manually set the date to a month that has n
be forewarned that a bash fan is writing this message with little to no
perl/c++ experience.
i have a file $file that is full of usernames and descriptions, one per
line. i have another variable $username that i would like to compare against
each line in the file and remove the line that matches
On 4/10/01 6:22 AM, "Jacky" <[EMAIL PROTECTED]> wrote:
> Hi people
> I am more like ASP programmer and new to PHP, In ASP, when we want to take all
> records in dayabase to display. After we did do the query, we call " Do while
> not RS.EOF ( mean do while not end of record file) , and display
On Tue, 10 Apr 2001 22:52, Jacky wrote:
> Hi people
> I am more like ASP programmer and new to PHP, In ASP, when we want to
> take all records in dayabase to display. After we did do the query, we
> call " Do while not RS.EOF ( mean do while not end of record file) ,
> and display record accrodin
$query = mysql_query("some SQL here");
while ($row = mysql_fetch_array($query)) {
do stuff;
}
Mick
On Tue, 10 Apr 2001, Jacky wrote:
> Hi people
> I am more like ASP programmer and new to PHP, In ASP, when we want to take all
>records in dayabase to display. After we did do the query
> $query = mysql_query("some SQL here");
> while ($row = mysql_fetch_array($query)) {
> do stuff;
> }
Isn't this suppose to be an infinite loop?
while ($row is assigned to mysql_fetch_array($query)) {
do stuffs;
}
someone correct me if I'm wrong?
Zeus
--
PHP General Mailing List (http://ww
> Isn't this suppose to be an infinite loop?
>
> while ($row is assigned to mysql_fetch_array($query)) {
> do stuffs;
> }
>
> someone correct me if I'm wrong?
They key here is that there's a single "=" in the condition.
... this is actually "while 'row equals the result of
mysql_fetch_array
On Tue, 10 Apr 2001 15:16, Zeus wrote:
> > $query = mysql_query("some SQL here");
> > while ($row = mysql_fetch_array($query)) {
> > do stuff;
> > }
>
> Isn't this suppose to be an infinite loop?
>
> while ($row is assigned to mysql_fetch_array($query)) {
> do stuffs;
> }
>
> someone correct me if
ROTECTED]>; Jacky
<[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, 10 April, 2001 1:53 PM
Subject: Re: [PHP] while loop
> On Tue, 10 Apr 2001 15:16, Zeus wrote:
> > > $query = mysql_query("some SQL here");
> > > while ($row = mysql_fetch_arra
-
From: Zeus <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; Michael Hall <[EMAIL PROTECTED]>;
Jacky <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, April 10, 2001 12:58 AM
Subject: Re: [PHP] while loop
> Isn't the '=' operator suppose to b
Hi Jacky,
@ 1:58:40 PM on 4/10/2001, Jacky@lilst wrote:
> Here I got this script:
> $queryoffers = "SELECT * FROM MiniOffers WHERE hotel_id = '$hotelID'
> ORDER BY start_date ASC";
> $resultofrs = mysql_query($queryoffers, $connection) or die(mysql_error());
> while($row = mysql_fetch_arra
Hi Zeus,
@ 1:58:56 AM on 4/10/2001, Zeus wrote:
> Isn't the '=' operator suppose to be used for assigning and not for
> evaluation.
In this case, it /is/ used for assignment.
print $row['some_column'];
...
>> > Isn't this suppose to be an infinite loop?
>> >
>> > while ($row is assigned to m
Zeus wrote:
>
> Isn't the '=' operator suppose to be used for assigning and not for
> evaluation.
>
yup.
> I thought '==' should be used in this context?
nope.
Thing is, you ARE assigning. Here's a breakdown of the controlling part
of the loop in english:
--->while ($row = mysql_fetch_array
t for
yourself"
- Original Message -
From: Brian Clark <[EMAIL PROTECTED]>
To: PHP is not a drug. <[EMAIL PROTECTED]>
Sent: Tuesday, April 10, 2001 1:05 AM
Subject: Re: [PHP] while loop
>
> Hi Jacky,
>
> @ 1:58:40 PM on 4/10/2001, Jacky@lilst w
Hi Jacky,
@ 2:11:06 PM on 4/10/2001, Jacky@lilst wrote:
> Not in the actual code, sorry, I did not copy the opnneing bit, but there is
> one in the code.
> So the same question, I got error said, maximum execution time exceed, am I
> doing something time consuming here?
Unless I'm blind this m
That was detailed :)
Thanks Jack, it fixed my misconception of the = and == operators.
BUT ...
> mysql_fetch_array keeps track of where it is in the array.
> after each while loop it moves a 'step ahead' in the result
the mysql_fetch_array fetches the results in an array but should it be an
on
Zeus wrote:
>
> That was detailed :)
>
> Thanks Jack, it fixed my misconception of the = and == operators.
>
> BUT ...
>
> > mysql_fetch_array keeps track of where it is in the array.
> > after each while loop it moves a 'step ahead' in the result
>
> the mysql_fetch_array fetches the results
lt;[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; Michael Hall <[EMAIL PROTECTED]>;
> Jacky <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Tuesday, April 10, 2001 12:58 AM
> Subject: Re: [PHP] while loop
>
>
> > Isn't the '='
valuation.
>
> I thought '==' should be used in this context?
>
> Zeus
> - Original Message -
> From: David Robley <[EMAIL PROTECTED]>
> To: Zeus <[EMAIL PROTECTED]>; Michael Hall <[EMAIL PROTECTED]>; Jacky
> <[EMAIL PROTECTED]>
> C
You should probably take a look at each() for that... The functionality is not
the same but it's the only answer I can think of for your question (i.e.
mysql_fetch_row() _returns_ a key-value array while each() _walks_ a key-value
array).
Bogdan
Daniel Alsén wrote:
> Hi,
>
> i am fiddling with
> ie - i have:
> while($myrow=mysql_fetch_array($result)) { etc...
>
> But i want the loop to run with an array i created earlier ($anotherarray =
> [key1] => value1, [key2] => value2).
>
use foreach($anotherarray as $key => $value) { .
A Nawroth
--
PHP General Mailing List (http://www.
The following lists 12 items from a fruits table.
$results = mysql_query("SELECT ID, date, appleprice, orangeprice, pearprice
FROM fruits");
while ($data = mysql_fetch_array($results))
{
?>
- -
-
<>
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
OK, using this code:
\n";
echo "\n";
$photocount = 0;
while($row = mysql_fetch_array($result)) {
$smallpic = $row['smallpic'];
echo "$smallpic\n";
if (($photocount % 3) == 2) {
echo "\n\n";
}
$photocount++;
}
echo "\n";
echo "";
?>
And 8 photos in the table, I'm getting
On Thursday 17 May 2001 13:58, [EMAIL PROTECTED] wrote:
> i would think that a while loop could do this and possibly write the
> output, minus the line i want to take away to a temp file and then copy
> it over. in bash i would use a statement like:
>
> while read i; do
> < blah >
> done < $fil
<[EMAIL PROTECTED]> wrote:
> i have a file $file that is full of usernames and descriptions, one per
> line. i have another variable $username that i would like to compare
against
> each line in the file and remove the line that matches the
> username field identically.
>
> $filename
>
> charles r
with a bit of cheating... use a table...
(nb: this code not tested, but logic has)
"
?>
-
-
";
$i++;
}
?>
-Original Message-
From: Craig Westerman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 27, 2002 11:43 AM
To: php-general-list
Subject: [PHP] mysql p
> From: Craig Westerman [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 27, 2002 11:43 AM
> To: php-general-list
> Subject: [PHP] mysql php - while loops
>
>
> The following lists 12 items from a fruits table.
>
> $results = mysql_query("SELECT ID, date, appl
M
To: 'Craig Westerman'; php-general-list
Subject: RE: [PHP] mysql php - while loops
with a bit of cheating... use a table...
(nb: this code not tested, but logic has)
"
?>
-
-
";
$i++;
}
?>
-Original Message-
From: Craig Westerman [mailto:[EMAIL PROTECTE
Keep track of rows, and add images at rows 4 & 8. See below
Craig Westerman wrote:
> The following lists 12 items from a fruits table.
>
> $results = mysql_query("SELECT ID, date, appleprice, orangeprice, pearprice
> FROM fruits");
$x=1;
>
> while ($data = mysql_fetch_array($results))
> {
> ?
"James, Yz" wrote:
OK, using this code:
echo "\n";
echo "\n";
$photocount = 0;
while($row = mysql_fetch_array($result)) {
$smallpic = $row['smallpic'];
echo "$smallpic\n";
if (($photocount % 3) == 2) {
echo "\n\n";
}
$photocount++;
}
This should fill in the remaining cells yo
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 27, 2001 11:18 AM
To: [EMAIL PROTECTED]
Subject: [PHP] while loop and modulus?
OK, using this code:
\n";
echo "\n";
$photocount = 0;
while($row = mysql_fetch_array($result)) {
$smallpic = $row['smallpic'];
i need to write a while statement to a variable that will later be echoed
again on another page after including this file to it. i need to repeat a
statement over and over in it and i do not know how.
' .
do {
'data to be outputted'
}while ($something = mysql_fetch_array($query));
.'
';
I can't figure out why the if statement isn't working. The page displays
the same with or without the if statement. Any idea what I'm doing wrong?
I attached the code in a word document.
Thank you, Shawna
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTEC
On Wednesday, March 27, 2002, at 04:11 PM, Matt Friedman wrote:
> When you have all your items in an array use implode to add a character
> in between every item.
>
> $str = implode($yourArray, $separator);
>
> This will add the separator to the end of each string except the last
> one.
I like
On Thursday 28 March 2002 05:20, Erik Price wrote:
> On Wednesday, March 27, 2002, at 04:11 PM, Matt Friedman wrote:
> > When you have all your items in an array use implode to add a character
> > in between every item.
> >
> > $str = implode($yourArray, $separator);
> >
> > This will add the sep
Hi
add the newline and white space first like this
$data_printed = "";
while ($row = mysql_fetch_assoc($result)) {
if($data_printed != ""){
$data_printed .= " \n";
}
$data_printed = "" .
$row['file_name'] . "";
}
That will add to all except the last on
I'm executing a query that returns some a UID and a company name. I'm using
the following code to loop over that query result set:
$result = mysql_query($myQuery) //$myQuery gets defined earlier
$resultCount = mysql_num_rows($result);
$companyID = array();
wh
On Thu, 24 May 2001 10:40, adam wrote:
> i need to write a while statement to a variable that will later be
> echoed again on another page after including this file to it. i need to
> repeat a statement over and over in it and i do not know how.
>
>
>
> $variable = '
>
> ' .
>
> do {
> 'data
Trying using mysql_fetch_array, and using the field names. This is the
recommended behaviour in PHP4:
$result = mysql_query($myQuery) //$myQuery gets defined earlier
$resultCount = mysql_num_rows($result);
$companyID = array();
while($query_data = mysql_fetch_
me_string .= "," . $query_data[1];
}
Jim
ps. try using the mysql_fetch_array() and calling to the vars as
$query_data[] instead.
- Original Message -
From: "Kurt Lieber" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 25, 2001 1
OK, so I defined the variables before using them and that solved the problem.
(Thanks!)
I'm still curious as to why not defining them ahead of time would cause the
data within each string to get duplicated. In other words, if the query
results are "a,b,c,d", then by not defining the variable
ieber" <[EMAIL PROTECTED]>
To: "Jim Lucas" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, October 25, 2001 1:17 PM
Subject: Re: [PHP] while() looping over query results twice?
> OK, so I defined the variables before using them and that solved the
problem.
I don't think so, but if I have to suspect my code or a bug in php, I'll
suspect my code. :)
I did a quick "if (isset($companyID_string)) { print "true"; } else { print
"false";} and that didn't turn up anything, but I didn't spend a whole lot of
effort on it.
Like I said, I'm pretty sure I s
Hi,
I wonder if someone could have a quick look at this for me? It's a
simple while loop, but it's not acting the way (I think) it should. If I
break down the while loop, it reads:
// $result contains 3 rows
while($row = mysql_fetch_array($result)
Here's the attachment - I hate it when I do that! :)
-Original Message-
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 8/20/01 10:25 AM
Subject: [PHP] while loop with if statement
I can't figure out why the if statement isn't working. The page
displays
the same
>
>
> -Original Message-
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Sent: 8/20/01 10:25 AM
> Subject: [PHP] while loop with if statement
>
> I can't figure out why the if statement isn't working. The page
> displays
> the same with or without the
Thanks Steve! :) Here's the code:
$title$description\n
\n
";
};
if($results <= 0)
{
print "
NO
RESULTS\n
\n
";
}
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EM
try using mysql_num_rows() to get the number of rows returned by the query.
you need to supply it with the identifier for the query not the sql you sent
to the query. not exactly sure what you're trying to do though ...
Steve
<[EMAIL PROTECTED]> wrote in message
BB6D932A42D6D211B4AC0090274EBB1D2
okay - read all the code now.
this might be a better way:
0)
{
for ($x=0;$x<$numrows;$x++)
{
$id=$one["id"];
$title=$one["title"];
$description=$one["description"];
print "
$title$description\n
\n
";
} // end of for
}
else
{
print "
NO
RESULTS\n
\n
";
}
?>
--
PHP Ge
At 11:02 AM -0400 8/20/01, [EMAIL PROTECTED] wrote:
>
>
>$results = mysql_db_query("$db", "select * from $table where $query order
>by update_datetime desc limit $offset, 10");
>
>while($one = mysql_fetch_array($results)){
> $id=$one["id"];
> $title=$one["title"];
> $description
LPR>
LPR> while($row = mysql_fetch_array($result))
LPR> {
LPR> $pri = $row['pri'];
LPR> $fg = $row['fg'];
LPR> $molw = $row['molw'];
LPR> $density = $row['density'];
LPR> $denstype = $row['denstype'];
LPR> $pctd = $row['pctd
uot;Y")
23 $html .= "$concentration $concunit $compname";
24else if ($pri=="Y")
25 $html .= " $concentration $concunit
$compname";
26else
27 $html .= " $concentration $concunit $compname";
28 }
-Original Message-
From: Lee P
> while($row = mysql_fetch_array($result))
> {
So, your while loop is based on values of $row.
> $row = mysql_fetch_array($result);
Now within your while loop you've altered the value of $row - poor thing
is probably a tad confused.
CYA, Dave
--
PHP General Mailing List (http:/
You are resetting $row inside your loop. Don't do that.
On Sun, 19 May 2002, Lee P Reilly wrote:
> Hi,
>
> I wonder if someone could have a quick look at this for me? It's a
> simple while loop, but it's not acting the way (I think) it should. If I
> break down the while loop, it reads:
>
> ---
Hi,
Using PHP 4.0.4pl1 (I did not try with PHP 4.0.5).
While parsing a large file (>100MB) and using the following (simplified)
piece of code:
while(($fbuffer=fread($fp,4096)) && $continue){
//
// ...
//
if(xml_parse($xml_parser,$fbuffer,feof($fp))){
} else {
// report err
63 matches
Mail list logo