[PHP] while...

2002-06-12 Thread Phil Reid
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

[PHP] while() query

2002-04-11 Thread Caspar Kennerdale
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/

RE: [PHP] while...

2002-06-12 Thread Lazor, Ed
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

[PHP] while loop

2001-04-09 Thread Jacky
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

[PHP] While on array?

2002-01-20 Thread Daniel Alsén
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).

RE: [PHP] while() query

2002-04-11 Thread Christoph Starkmann
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-

RE: [PHP] while() query

2002-04-11 Thread Caspar Kennerdale
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) {

Re: [PHP] while() query

2002-04-11 Thread Jason Wong
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

[PHP] while...if statements???

2001-12-18 Thread Jay Fitzgerald
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

[PHP] while loops [ newbie ]

2001-05-17 Thread charles
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

Re: [PHP] while loop

2001-04-09 Thread Lindsay Adams
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

Re: [PHP] while loop

2001-04-09 Thread David Robley
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

Re: [PHP] while loop

2001-04-09 Thread Michael Hall
$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

Re: [PHP] while loop

2001-04-09 Thread Zeus
> $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

RE: [PHP] while loop

2001-04-09 Thread Jason Murray
> 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

Re: [PHP] while loop

2001-04-09 Thread David Robley
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

Re: [PHP] while loop

2001-04-09 Thread Zeus
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

Re: [PHP] while loop

2001-04-09 Thread [EMAIL PROTECTED]
- 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

Re: [PHP] while loop

2001-04-09 Thread Brian Clark
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

Re: [PHP] while loop

2001-04-09 Thread Brian Clark
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

Re: [PHP] while loop

2001-04-09 Thread Jack Dempsey
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

Re: [PHP] while loop

2001-04-09 Thread [EMAIL PROTECTED]
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

Re: [PHP] while loop

2001-04-09 Thread Brian Clark
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

Re: [PHP] while loop

2001-04-09 Thread Zeus
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

Re: [PHP] while loop

2001-04-09 Thread Jack Dempsey
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

Re: [PHP] while loop

2001-04-09 Thread Philip Olson
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 '='

Re: [PHP] while loop

2001-04-10 Thread Yasuo Ohgaki
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

Re: [PHP] While on array?

2002-01-20 Thread Bogdan Stancescu
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

Re: [PHP] While on array?

2002-01-21 Thread anders nawroth
> 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.

[PHP] mysql php - while loops

2002-02-26 Thread Craig Westerman
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:

[PHP] while loop and modulus?

2001-02-27 Thread James, Yz
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

Re: [PHP] while loops [ newbie ]

2001-05-17 Thread Christian Reiniger
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

Re: [PHP] while loops [ newbie ]

2001-05-17 Thread Steve Werby
<[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

RE: [PHP] mysql php - while loops

2002-02-26 Thread Martin Towell
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

RE: [PHP] mysql php - while loops

2002-02-27 Thread Stewart G.
> 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

RE: [PHP] mysql php - while loops

2002-02-27 Thread Craig Westerman
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

[PHP] Re: mysql php - while loops

2002-02-28 Thread bill
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)) > { > ?

Re: [PHP] while loop and modulus?

2001-02-27 Thread Ron Wills
"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

RE: [PHP] while loop and modulus?

2001-02-27 Thread DanO
[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'];

[PHP] while statements output to variables

2001-05-23 Thread adam
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)); .' ';

[PHP] while loop with if statement

2001-08-20 Thread sgibbs
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

Re: [PHP] while loop: detect next loop?

2002-03-27 Thread Erik Price
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

Re: [PHP] while loop: detect next loop?

2002-03-27 Thread Jason Wong
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

Re: [PHP] while loop: detect next loop?

2002-03-28 Thread Tom Rogers
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

[PHP] while() looping over query results twice?

2001-10-25 Thread Kurt Lieber
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

Re: [PHP] while statements output to variables

2001-05-23 Thread David Robley
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

Re: [PHP] while() looping over query results twice?

2001-10-25 Thread Mike Eheler
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_

Re: [PHP] while() looping over query results twice?

2001-10-25 Thread Jim Lucas
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

Re: [PHP] while() looping over query results twice?

2001-10-25 Thread Kurt Lieber
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

Re: [PHP] while() looping over query results twice?

2001-10-25 Thread Jim Lucas
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.

Re: [PHP] while() looping over query results twice?

2001-10-25 Thread Kurt Lieber
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

[PHP] while loop question - problem (new set of eyes needed)

2002-05-19 Thread Lee P Reilly
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)

RE: [PHP] while loop with if statement - here's the attachment

2001-08-20 Thread sgibbs
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

Re: [PHP] while loop with if statement - here's the attachment

2001-08-20 Thread Steve Brett
> > > -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

RE: [PHP] while loop with if statement - here's the code

2001-08-20 Thread sgibbs
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

Re: [PHP] while loop with if statement - here's the code

2001-08-20 Thread Steve Brett
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

Re: [PHP] while loop with if statement - here's the code

2001-08-20 Thread Steve Brett
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

RE: [PHP] while loop with if statement - here's the code

2001-08-20 Thread Alnisa Allgood
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

Re: [PHP] while loop question - problem (new set of eyes needed)

2002-05-19 Thread Julie Meloni
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

RE: [PHP] while loop question - problem (new set of eyes needed)

2002-05-19 Thread Martin Towell
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

RE: [PHP] while loop question - problem (new set of eyes needed)

2002-05-19 Thread David Freeman
> 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:/

Re: [PHP] while loop question - problem (new set of eyes needed)

2002-05-20 Thread Rasmus Lerdorf
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: > > ---

[PHP] while($fbuffer=fread($fp,4096)) and xml_parse($xml_parser,$fbuffer,feof($fp))

2001-05-06 Thread Dominique Hermsdorff
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