RE: [PHP] looping through a database

2008-06-17 Thread Ford, Mike
On 16 June 2008 21:58, Richard Kurth advised: > I am looping through a database of files that are numbers 1 through 10 > if number 1 is in the database I what to print out the first table > below if it is not then print the else section below. Then > loop through > the database to see if 2 throug

Re: [PHP] looping through a database

2008-06-16 Thread paragasu
i am not sure what u want to do, for this case you need to tell us about your database table structure. i quess you have table like this.. assume the table name is table1 and there are ten column in it file1..file10 respectively |table1 | |member_id | |file1| |file2

Re: [PHP] looping through a database

2008-06-16 Thread Wolf
Richard Kurth wrote: Wolf wrote: Richard Kurth wrote: Could you please give me an idea where to start looking while($row=mysql_fetch_array($sql_result)){ if ($row["number"]==1) { File 1 This is the file Delete }else{ File1 Add } } What is the query being executed? This is the

Re: [PHP] looping through a database

2008-06-16 Thread Richard Kurth
Wolf wrote: Richard Kurth wrote: I am looping through a database of files that are numbers 1 through 10 if number 1 is in the database I what to print out the first table below if it is not then print the else section below. Then loop through the database to see if 2 through 10 are there and

Re: [PHP] looping through a database

2008-06-16 Thread Wolf
Richard Kurth wrote: I am looping through a database of files that are numbers 1 through 10 if number 1 is in the database I what to print out the first table below if it is not then print the else section below. Then loop through the database to see if 2 through 10 are there and do the same t

Re: [PHP] looping through a $_POST variable

2007-12-30 Thread Mark Kelly
Hi. On Monday 31 December 2007 00:34, Richard Kurth wrote: > When I do a var_dump($_POST['emails']); it has all the emails in it > string(65) "[EMAIL PROTECTED] [EMAIL PROTECTED] > [EMAIL PROTECTED]" Then this simple regex should do you; just use it instead of explode: $AddressList = preg_split(

Re: [PHP] looping through a $_POST variable

2007-12-30 Thread Richard Lynch
You should use whatever is actually BETWEEN the emails, which could be anything... See the thread about Tedd's bazaar (sic) problem and use the technique there to see what you are actually getting. You may even need to resort to a split instead of explode if newlines, spaces, and carriage-returns

Re: [PHP] looping through a $_POST variable

2007-12-30 Thread Richard Kurth
looks like that is my problem it is not separating the emails string(67) "[EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]" array(1) { [0]=> string(67) "[EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]" } $array = explode(' ', $_POST['emails']); what should I use for spaces or next l

Re: [PHP] looping through a $_POST variable

2007-12-30 Thread Richard Lynch
Okay. Now var_dump($array) and see what it has. On Sun, December 30, 2007 6:34 pm, Richard Kurth wrote: > When I do a var_dump($_POST['emails']); it has all the emails in it > string(65) "[EMAIL PROTECTED] [EMAIL PROTECTED] > [EMAIL PROTECTED]" > I will validate the emails after I get the loop to

Re: [PHP] looping through a $_POST variable

2007-12-30 Thread dg
You might want to check the loop alone and check each value of $value: $array = explode(' ', $_POST['emails']); foreach($array as $value) { print "'$value'"; } if it works that way, at least you narrow down the possibilities of weirdness. On Dec 30, 2007, at 5:34 PM, Richard Kurth wr

Re: [PHP] looping through a $_POST variable

2007-12-30 Thread Richard Kurth
When I do a var_dump($_POST['emails']); it has all the emails in it string(65) "[EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]" I will validate the emails after I get the loop to work $memberid comes from a part of the script I did not show you $memberid =$_POST["members_id"]; safe_que

Re: [PHP] looping through a $_POST variable

2007-12-30 Thread Richard Lynch
On Sun, December 30, 2007 5:29 pm, Richard Kurth wrote: > I am trying to loop through a $_POST variable. It comes from a text > area and it will have data like many email address or just one listed > with a space or on a new line. I can't seam to get the data to extract > properly. I have tried

Re: [PHP] looping through a $_POST variable

2007-12-30 Thread Richard Kurth
I am trying to get one email at a time and run it through the loop and process it but if I have more than one email in the text area it gives me nothing and does not run What kind of problems are you having in extracting the data? On Dec 30, 2007, at 4:29 PM, Richard Kurth wrote: I am trying t

Re: [PHP] Looping through array

2006-11-16 Thread Paul Novitski
At 11/16/2006 12:19 PM, Ashley M. Kirchner wrote: Say I have an array containing ten items, and I want to display them in a table as follows: 5 4 3 2 1 10 9 8 7 6 What's the best way to loop through that array to do that? My thinking gets me to create a loop for 5 through 1, re

Re: [PHP] Looping through array

2006-11-16 Thread tedd
At 1:19 PM -0700 11/16/06, Ashley M. Kirchner wrote: Say I have an array containing ten items, and I want to display them in a table as follows: 5 4 3 2 1 10 9 8 7 6 What's the best way to loop through that array to do that? My thinking gets me to create a loop for 5 through 1,

Re: [PHP] Looping through array

2006-11-16 Thread Ashley M. Kirchner
Darrell Brogdon wrote: So in other words, you have an array like $arr = array(1,2,3,4,5,6,7,8,9,10) but you want it to render on the page as: 5 4 3 2 1 10 9 8 7 6 right? That would be correct. James Tu provided a solution that I think will work. I'm always open to other suggestions of

Re: [PHP] Looping through array

2006-11-16 Thread Darrell Brogdon
So in other words, you have an array like $arr = array (1,2,3,4,5,6,7,8,9,10) but you want it to render on the page as: 5 4 3 2 1 10 9 8 7 6 right? -D On Nov 16, 2006, at 1:35 PM, Ashley M. Kirchner wrote: Darrell Brogdon wrote: $arr = array(5, 4, 3, 2, 1, 10, 9, 8, 7, 6,); The

Re: [PHP] Looping through array

2006-11-16 Thread James Tu
$arr = array(...); $first_row = ''; $second_row = ''; for ($i=4; $i>=0; $i--){ $first_row = $first_row . "{$arr[$x]}"; $second_row = $second_row . "{$arr[$x + 5]}"; } print '' . $first_row . '/'; print '' . $second_row . '/'; On Nov 16, 2006, at 3:19 PM, Ashley M. Kirchner wrote

Re: [PHP] Looping through array

2006-11-16 Thread Dave Goodchild
If you know the array elements, you may not need to loop. Why not just echo the particular array elements i.e. for example?

Re: [PHP] Looping through array

2006-11-16 Thread Ashley M. Kirchner
Brad Bonkoski wrote: Something like this perhaps... $arr = array(...); $per_row = 5; $elem = count($arr); for($i=0; $i<$elem; $i++) { if( $i == 0 ) echo ""; else if( $i % $per_row == 0 ) echo ""; echo "$arr[$i]"; } That simply displays things in order, 1 through 5, then

Re: [PHP] Looping through array

2006-11-16 Thread Darrell Brogdon
'; echo ''; for ($x=0,$y=sizeof($arr); $x<$y; ++$x) { echo "{$arr[$x]}"; if ($x == 4) { echo ''; } } echo ''; echo ''; ?> On Nov 16, 2006, at 1:19 PM,

Re: [PHP] Looping through array

2006-11-16 Thread Brad Bonkoski
Ashley M. Kirchner wrote: Say I have an array containing ten items, and I want to display them in a table as follows: 5 4 3 2 1 10 9 8 7 6 What's the best way to loop through that array to do that? My thinking gets me to create a loop for 5 through 1, repeated twice, and the

Re: [PHP] Looping through array

2006-11-16 Thread Brad Bonkoski
Ashley M. Kirchner wrote: Say I have an array containing ten items, and I want to display them in a table as follows: 5 4 3 2 1 10 9 8 7 6 What's the best way to loop through that array to do that? My thinking gets me to create a loop for 5 through 1, repeated twice, and the

Re: [PHP] Looping through a Db query result twice in PEAR

2006-05-24 Thread Curt Zirzow
On Wed, May 24, 2006 at 02:28:33PM -0600, Phillip S. Baker wrote: > Greetings All, > > I have a problem that I usually solve in MySQL pretty easily, but using > PEAR identifiers are not working. > Any suggestions. > I want to loop through a result set in two different while loops that > are not

RE: [PHP] Looping through a Db query result twice in PEAR

2006-05-24 Thread Warren Vail
Shouldn't it be; $sql="Some query"; $result = $conn->query($sql); //V VVV while ($row = $conn->fetchArray($result)) { echo $row['hey']; } // V VVV while ($row2 = $conn->fetchArray($result)) { echo $row2['otherhey'];

Re: [PHP] Looping information into a table

2006-04-04 Thread Georgi Ivanov
Sorry . The correct SQL should be: $query ="select * from cforum cf INNER JOIN scforum ON cforum.id=scforum.cfid"; :) On Tuesday April 4 2006 11:58, Georgi Ivanov wrote: > A little OT but i think it is important : > I really would not write this code like this . > You are making too many que

Re: [PHP] Looping information into a table

2006-04-04 Thread Georgi Ivanov
A little OT but i think it is important : I really would not write this code like this . You are making too many queries to the database . If u have 100 rows in first table and 200 rows returned from second query , you make 100*200 queries to the database ! Try using SQL Joins. Like this :

Re: [PHP] Looping information into a table

2006-04-03 Thread tedd
i am creating a forum and i am having trouble getting the database information in to an html table i believe it has somthing to do with the placement of the while loops because they repeat the segment of code over untill the statment returns false, thus adding extra html.. you guys are the ex

Re: [PHP] Looping information into a table

2006-04-02 Thread Chris
benifactor wrote: i am creating a forum and i am having trouble getting the database information in to an html table i believe it has somthing to do with the placement of the while loops because they repeat the segment of code over untill the statment returns false, thus adding extra html.. y

Re: [PHP] Looping from A to Z

2006-02-20 Thread Jason Motes
Richard K Miller wrote: Good afternoon. I'm having trouble getting PHP to loop from A through Z. Here is what I tried, coming from a C background: for ($l = "A"; $l <= "Z"; $l++) echo $l; I use this: for($i='a'; $i != 'aa'; $i++){ print $i; | -- PHP General Mailing List (http://w

Re: [PHP] Looping from A to Z

2006-02-19 Thread Jim McIntyre
>>Good afternoon. I'm having trouble getting PHP to loop from A >>through Z. Here is what I tried, coming from a C background: >> >>for ($l = "A"; $l <= "Z"; $l++) >> echo $l; >> >>// Returns A, B, C, ..., X, Y, Z, AA, AB, AC, AD, AE, ... YX, YY, YZ. (26 * 26 results!) >> >>Interestingly, i

Re: [PHP] Looping from A to Z

2006-02-19 Thread tedd
Good afternoon. I'm having trouble getting PHP to loop from A through Z. Here is what I tried, coming from a C background: for ($l = "A"; $l <= "Z"; $l++) echo $l; // Returns A, B, C, ..., X, Y, Z, AA, AB, AC, AD, AE, ... YX, YY, YZ. (26 * 26 results!) Interestingly, if I make it a "

Re: [PHP] Looping from A to Z

2006-02-19 Thread Philip Hallstrom
Good afternoon. I'm having trouble getting PHP to loop from A through Z. Here is what I tried, coming from a C background: for ($l = "A"; $l <= "Z"; $l++) echo $l; // Returns A, B, C, ..., X, Y, Z, AA, AB, AC, AD, AE, ... YX, YY, YZ. (26 * 26 results!) Interestingly, if I make it a "les

Re: [PHP] looping through an array problem

2005-06-06 Thread Jochem Maas
Jack Jackson wrote: Forgive me if this comes twice: my ISP had a service blackout for three hours and I don't know what went: If my last post read (and I see that it did) that I was defending myself as opposed to falling ALL OVER my sword, I apologize: allow me to be clear: No, you're all cor

Re: [PHP] looping through an array problem

2005-06-05 Thread Jack Jackson
If my last post read (and I see that it did) that I was defending myself as opposed to falling ALL OVER my sword, I apologize: allow me to be clear: No, you're all correct and M. Sokolewicz doubly so: I had unintentionally selected fields from the wrong table for no reason other than lack of

Re: [PHP] looping through an array problem

2005-06-05 Thread Jack Jackson
Ah. I just remembered one reason I had done it involving the art_id field: I have more publishers in the db than are currently associated with artworks. I don't want a publisher to appear unless there is at least one image associated with it. So I did this to avoid having people see a link to

Re: [PHP] looping through an array problem

2005-06-05 Thread Jack Jackson
Forgive me if this comes twice: my ISP had a service blackout for three hours and I don't know what went: If my last post read (and I see that it did) that I was defending myself as opposed to falling ALL OVER my sword, I apologize: allow me to be clear: No, you're all correct and M. Sokolewic

Re: [PHP] looping through an array problem

2005-06-05 Thread Jochem Maas
Jack Jackson wrote: M. Sokolewicz wrote: Jack Jackson wrote: Thanks for all the replies. Jochem, thank you for this code, which will take me all night to understand (though I bet it works). I also note that SELECT DISTINCT worked here, too Also as many of you noticed before me, the art_i

Re: [PHP] looping through an array problem

2005-06-05 Thread Jack Jackson
M. Sokolewicz wrote: Jack Jackson wrote: Thanks for all the replies. Jochem, thank you for this code, which will take me all night to understand (though I bet it works). I also note that SELECT DISTINCT worked here, too Also as many of you noticed before me, the art_id was in there as a f

Re: [PHP] looping through an array problem

2005-06-05 Thread M. Sokolewicz
Jack Jackson wrote: Thanks for all the replies. Jochem, thank you for this code, which will take me all night to understand (though I bet it works). I also note that SELECT DISTINCT worked here, too Also as many of you noticed before me, the art_id was in there as a fly in the ointment. by th

Re: [PHP] looping through an array problem

2005-06-05 Thread Jack Jackson
Thanks for all the replies. Jochem, thank you for this code, which will take me all night to understand (though I bet it works). I also note that SELECT DISTINCT worked here, too Also as many of you noticed before me, the art_id was in there as a fly in the ointment. Thanks all! Jochem Ma

Re: [PHP] looping through an array problem

2005-06-05 Thread Brian V Bonini
On Sun, 2005-06-05 at 16:37, Jack Jackson wrote: > This is something dumb I am doing but: > > Trying to pull all names of publishers in db. This sql: > > SELECT art.art_id,art.publisher_id,publisher.publisher_name, > FROM art > LEFT JOIN publisher > ON publisher.publisher_id=art.publisher_id > >

Re: [PHP] looping through an array problem

2005-06-05 Thread Jochem Maas
Jack Jackson wrote: This is something dumb I am doing but: Trying to pull all names of publishers in db. This sql: its a mysql question in disguise, maybe...: SELECT DISTINCT art.art_id,art.publisher_id,publisher.publisher_name FROM art LEFT JOIN publisher ON publisher.publisher_id=art.publi

Re: [PHP] looping through an array problem

2005-06-05 Thread Paul Waring
On 6/5/05, Jack Jackson <[EMAIL PROTECTED]> wrote: > I'd like to stop the NY Sun from appearing twice! What have i missed here? There's nothing wrong with your PHP code as such (although you could filter out duplicates there if you wanted), all you should need to do is add the DISTINCT keyword to

Re: [PHP] looping through an array problem

2005-06-05 Thread Mark Cain
One way to do it is to change this : $pub_sidebar[] = " To: Sent: Sunday, June 05, 2005 4:37 PM Subject: [PHP] looping through an array problem > This is something dumb I am doing but: > > Trying to pull all names of publishers in db. This sql: > > SELECT art.art_id,art.publisher_id,publisher.p

Re: [PHP] looping through an array

2004-04-04 Thread Jason Wong
On Sunday 04 April 2004 08:22, Andy B wrote: [snip] > i tried using while($_SESSION['guestbook']) but it proves in php's mind to > be blank or that whole statement gets ignored... The above doesn't make sense, if you don't have anything inside your while-loop which alters $_SESSION['guestbook']

Re: [PHP] looping variables from a file

2004-03-24 Thread Ryan A
Hey John, > $array1 = get_defined_vars(); > include('yourfile.php'); > $array2 = get_defined_vars(); > $newvars = array_diff($array2,$array1); > foreach($newvars as $name => $value) > { echo "$name = $value\n"; } Cool, thanks, will try it out. > If there are multi-dimensional arrays, then > yo

Re: [PHP] looping variables from a file

2004-03-24 Thread John W. Holmes
Second what Rich said, keep replies to the list, please. This can benifit everyone. ---John Holmes... - Original Message - From: "John W. Holmes" <[EMAIL PROTECTED]> To: "Ryan A" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, Ma

RE: [PHP] looping variables from a file

2004-03-24 Thread Ford, Mike [LSS]
> -Original Message- > From: Ryan A [mailto:[EMAIL PROTECTED] > Sent: 24 March 2004 17:30 > > Hi, > I have a config_inc.php file which has around 60 parameters set in it. > eg: > $db_name="something"; > $db_user="root"; > $db_pass="blah"; > $x_installed_path="/home/blah/"; > etc > > I ha

Re: [PHP] looping variables from a file

2004-03-24 Thread John W. Holmes
From: "Ryan A" <[EMAIL PROTECTED]> > I have a config_inc.php file which has around 60 parameters set in it. > eg: > $db_name="something"; > $db_user="root"; > $db_pass="blah"; > $x_installed_path="/home/blah/"; > etc > > I have a requirment of echoing out these statements to the client to show > h

Re: [PHP] looping variables from a file

2004-03-24 Thread Richard Davey
Hello Ryan, Wednesday, March 24, 2004, 5:29:33 PM, you wrote: RA> as you can imagine the above loop will save a crapload of time RA> instead of "partially hard codeing" each key and value but how do RA> I do this while reading from a file? and the other big problem is RA> the file contains one or

Re: [PHP] Looping problem?

2004-01-06 Thread joel boonstra
On Tue, Jan 06, 2004 at 05:33:41PM -0500, joel boonstra wrote: > I would recommend not simply doing a select *, but rather specifying > which columns you want. That way, if your database schema changes > (e.g., you add two more columns), your code won't break. And, responding to myself, specifyi

Re: [PHP] Looping problem?

2004-01-06 Thread joel boonstra
On Wed, Jan 07, 2004 at 09:17:35AM +1100, Martin Towell wrote: > This is probably more like what you need. > I can't see why you'd need to loop through your results using two different > methods (while and for) > > require 'database.php'; > $t_02 = "subnets"; > $sql_subs = mysql_query("SELECT * FR

RE: [PHP] Looping problem?

2004-01-06 Thread Martin Towell
This is probably more like what you need. I can't see why you'd need to loop through your results using two different methods (while and for) require 'database.php'; $t_02 = "subnets"; $sql_subs = mysql_query("SELECT * FROM $t_02",$db) or die(mysql_error()); $num = mysql_num_rows($sql_subs); for (

Re: [PHP] Looping problem?

2004-01-06 Thread Brad Pauly
On Tue, 2004-01-06 at 15:04, Jas wrote: > require 'database.php'; > $t_02 = "subnets"; > $sql_subs = mysql_query("SELECT * FROM $t_02",$db)or > die(mysql_error());while(list($id,$sub,$msk,$dns01,$dns02,$rtrs,$rnge) > = mysql_fetch_array($sql_subs)) { > $num = mysql_num_rows($sql_subs); >

Re: [PHP] looping problem?

2003-12-30 Thread Hitek
Shorter version of the script: $line = file("fa.csv"); for($i=0;$i $data = explode(",", $line[$i]); echo "host $data[0] {\nhardware ethernet $data[1];\nfixed-address $data[2];\n}\n"; } ?> At 08:10 AM 12/30/2003, Jas wrote: Problem with looping over a CSV file (3 results for each l

Re: [PHP] looping problem?

2003-12-30 Thread Mike Migurski
>Problem with looping over a CSV file (3 results for each line)? > >Here is the script... >$row = 1; >$file = "fa.csv"; >$id = fopen("$file","r"); > while($data = fgetcsv($id,100,",")) { > $num = count($data); > $row++; > for($c = 0; $c < $num; $c++) { >echo "host $data[0] {\nhard

RE: [PHP] Looping through a list - Newbie question

2003-08-27 Thread James Johnson
. Holmes [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 27, 2003 7:23 AM To: James Johnson; [EMAIL PROTECTED] Subject: Re: [PHP] Looping through a list - Newbie question From: "James Johnson" <[EMAIL PROTECTED]> > I have a list contained in a session var. I want to loop throu

Re: [PHP] Looping through a list - Newbie question

2003-08-27 Thread CPT John W. Holmes
From: "James Johnson" <[EMAIL PROTECTED]> > I have a list contained in a session var. I want to loop through the list, > getting the value of the current item, then do a query based on that value. > Is there an easy way to do this, or do I need to convert the list to an > array first? In the code b

RE: [PHP] Looping through a list - Newbie question

2003-08-27 Thread Javier Tacon
There are a lot of methods. The most common is using an array: $_SESSION['sv_CampusList'] = Array ("1","2","3","4","5"); foreach($_SESSION['sv_CampusList'] as $id) { echo $id; } If you want to use sv_CampusList as string: $_SESSION['sv_CampusList'] = "1,2,4,5"; $tmpArr = explode(",",$_SESSION

Re: [PHP] Looping or what?

2003-07-09 Thread Jason Wong
On Wednesday 09 July 2003 21:12, Zac Hillier - Net Affectors wrote: > The code below is suppose to replace some images and links but when I run > it the page just seems to hang and eventually times out. > > Am I Looping somewhere and not realising it? print $i to find out? -- Jason Wong -> Greml

Re: [PHP] looping through values from a field? Need hellp.

2003-07-05 Thread Micah Montoya
That was the trick. Just the space was messing things up. Thanks. - Original Message - From: "Lars Torben Wilson" <[EMAIL PROTECTED]> To: "Micah Montoya" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Saturday, July 05, 2003 6:18 PM Subject: R

Re: [PHP] looping through values from a field? Need hellp.

2003-07-05 Thread Lars Torben Wilson
On Sat, 2003-07-05 at 17:13, Micah Montoya wrote: > Ok. I gave it a shot but have run into one other question that I wasn't > able to find that was addressed by the article. > > My select statement looks like this: > > > > When I create the php file, I am trying something like below but it isn

Re: [PHP] looping through values from a field? Need hellp.

2003-07-05 Thread Micah Montoya
not doing? $filename = $_POST["imgList"]; for each ($filename as $value) { echo $value; } thanks - Original Message - From: "Lars Torben Wilson" <[EMAIL PROTECTED]> To: "Micah Montoy" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent:

RE: [PHP] looping through values from a field? Need hellp.

2003-07-05 Thread Giz
Yeah, this is the behavior of select lists. What comes through in the form post is the item that was last selected. What I've found you have to do with javascript is populate a hidden field with the values, using some delimiter (I've used commas) and you can easily explode those values into an

Re: [PHP] looping through values from a field? Need hellp.

2003-07-05 Thread Micah Montoya
I think that will do it. thanks, - Original Message - From: "Lars Torben Wilson" <[EMAIL PROTECTED]> To: "Micah Montoy" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Saturday, July 05, 2003 4:59 PM Subject: Re: [PHP] looping through values from

Re: [PHP] looping through values from a field? Need hellp.

2003-07-05 Thread Lars Torben Wilson
On Sat, 2003-07-05 at 15:55, Micah Montoy wrote: > I have this javascript that enables browsing and selecting of a file. This > file location and name are then transferred further down in the form as an > . Multiple files may be chosen as they are just added one below the > other. Anyway, when t

Re: [PHP] Looping through the mysql_field_name function

2003-02-02 Thread Philip Olson
On Sun, 2 Feb 2003, Davy Obdam wrote: > Hi ppl, > > I have a problem that probably very simple, but i cannot figure it out > right now > I need to get the field names of my database. I have a query like select > * from books and now i wanna have both the result and the field name. I > have

Re: [PHP] Looping through directories?

2003-01-08 Thread Chris Wesley
On Wed, 8 Jan 2003, Jeff Lewis wrote: > pattern for the name if the indexes, I assume I need to create an array > holding the directory name and the associated index file name like so > $dirs = array("Sports" => "spindex.xml", "Business News" => > "business.xml") etc > > Now, I need help with the

RE: [PHP] Looping needs to re-open parm file

2002-12-19 Thread John W. Holmes
> I'm reading a paramter file and a text file. > Per line of the text file I want to check if there is a word in there from > the parameter file. > However I need to open and read the parameter file for each line in the > text > file. How can I change this? Can't you read the param file first into

Re: [PHP] Looping needs to re-open parm file

2002-12-19 Thread Wico de Leeuw
Hiya something like this if ($FileContent = file("d:\MyPhp\\test.ora") AND $IniContent = file("d:\MyPhp\initORA.ini")) { foreach($FileContent AS $line) { if (in_array($line, $iniContent)) { echo "$Line\n";

Re: [PHP] Looping needs to re-open parm file

2002-12-19 Thread Wico de Leeuw
Did you look at: http://www.php.net/manual/en/function.file.php Puts all lines in an array Gr, At 12:00 19-12-02 +0100, Jacob van Zanen wrote: Hi All, I'm reading a paramter file and a text file. Per line of the text file I want to check if there is a word in there from the parameter file. Howe

RE: [PHP] Looping through Form Elements in a form

2002-12-11 Thread John W. Holmes
> I am working on a generic JavaScript form checked, that takes the > names > of the elements, with the first two letters being the type of element, so > its checks that it is right, if not gives a generic error message e.g. YOu > Need To Fill this in and selects it, or Sorry only numbers are a

Re: [PHP] Looping through Form Elements in a form

2002-12-11 Thread Jason Wong
On Thursday 12 December 2002 04:13, Steve Vernon wrote: > Hiya, > I am working on a generic JavaScript form checked, that takes the names > of the elements, with the first two letters being the type of element, so > its checks that it is right, if not gives a generic error message e.g. YOu > Ne

RE: [PHP] Looping Addition

2002-12-06 Thread Ford, Mike [LSS]
- Original Message - From: "Chris Wesley" <[EMAIL PROTECTED]> To: "PHP List" <[EMAIL PROTECTED]> > On Wed, 4 Dec 2002, Stephen wrote: > > This is only a snippet, there is more to it but for simplicities sake... > > Then I calculate it. My question is, how would I loop the adding? I hope yo

Re: [PHP] Looping Addition

2002-12-05 Thread Stephen
PROTECTED]> Sent: Thursday, December 05, 2002 3:14 PM Subject: Re: [PHP] Looping Addition > > But then, if the user entered 5 - 6, it should be -1 but it'd return > > positive one... Is there another way? > > Come on, man... this is addition and subtraction. You c

Re: [PHP] Looping Addition

2002-12-05 Thread 1LT John W. Holmes
> But then, if the user entered 5 - 6, it should be -1 but it'd return > positive one... Is there another way? Come on, man... this is addition and subtraction. You can't figure it out? > > You simply need the absolute value of the difference. So taking Stephen's > > example below.. > > > > $tot

Re: [PHP] Looping Addition

2002-12-05 Thread Stephen
gt; Cc: "PHP List" <[EMAIL PROTECTED]> Sent: Thursday, December 05, 2002 2:51 PM Subject: Re: [PHP] Looping Addition > You simply need the absolute value of the difference. So taking Stephen's > example below.. > > $total = 0; > foreach( $_POST['nums

Re: [PHP] Looping Addition

2002-12-05 Thread Kevin Stone
riginal Message - From: "Stephen" <[EMAIL PROTECTED]> To: "Chris Wesley" <[EMAIL PROTECTED]> Cc: "PHP List" <[EMAIL PROTECTED]> Sent: Thursday, December 05, 2002 12:33 PM Subject: Re: [PHP] Looping Addition > Continuing this even more...how would I

Re: [PHP] Looping Addition

2002-12-05 Thread Stephen
AIL PROTECTED]> Sent: Wednesday, December 04, 2002 8:42 PM Subject: Re: [PHP] Looping Addition > On Wed, 4 Dec 2002, Stephen wrote: > > This is only a snippet, there is more to it but for simplicities sake... > > Then I calculate it. My question is, how would I loop the adding? I

Re: [PHP] Looping Addition

2002-12-05 Thread Jason Wong
On Thursday 05 December 2002 23:05, Stephen wrote: > So would I just put this? > > foreach(%_POST['number'] as $num) > { > $output *= $num; > } > echo $output; > > That's for multiplication. Yes. Wouldn't it have been quicker for you to try it than to ask? BTW make sure that none of $num is z

Re: [PHP] Looping Addition

2002-12-05 Thread Stephen
: "PHP List" <[EMAIL PROTECTED]> Sent: Thursday, December 05, 2002 8:24 AM Subject: Re: [PHP] Looping Addition > > One more question... If I then wanted to do this for the other operations > > (such as multiplication, division, etc), how would I do that? > > Assuming yo

Re: [PHP] Looping Addition

2002-12-05 Thread 1LT John W. Holmes
> One more question... If I then wanted to do this for the other operations > (such as multiplication, division, etc), how would I do that? Assuming you've figured out how to do an array... You'll have to loop through the values like in the code that others posted. foreach($_POST['number'] as $n

Re: [PHP] Looping Addition

2002-12-05 Thread Stephen
27;Chris Wesley'" <[EMAIL PROTECTED]> Cc: "'PHP List'" <[EMAIL PROTECTED]> Sent: Wednesday, December 04, 2002 9:01 PM Subject: RE: [PHP] Looping Addition > > Let me explain this as best I can. The user enters how many numbers he > > wants >

RE: [PHP] Looping Addition

2002-12-04 Thread John W. Holmes
> Let me explain this as best I can. The user enters how many numbers he > wants > to add. This form goes to another page. This page loops a form field and > it's name is "num" and after num is the number it is currently on. Here's > the code: > > > > How many numbers to add: >

Re: [PHP] Looping Addition

2002-12-04 Thread Stephen
st" <[EMAIL PROTECTED]> Cc: "Stephen" <[EMAIL PROTECTED]> Sent: Wednesday, December 04, 2002 8:42 PM Subject: Re: [PHP] Looping Addition > On Wed, 4 Dec 2002, Stephen wrote: > > This is only a snippet, there is more to it but for simplicities sake... > >

Re: [PHP] Looping Addition

2002-12-04 Thread Chris Wesley
On Wed, 4 Dec 2002, Stephen wrote: > This is only a snippet, there is more to it but for simplicities sake... > Then I calculate it. My question is, how would I loop the adding? I hope you > understand this now... Ah!, I think I understand better now. You want to add num1, num2, num3, ... numN, w

Re: [PHP] Looping Addition

2002-12-04 Thread Tom Rogers
Hi, Thursday, December 5, 2002, 7:26:57 AM, you wrote: S> Sorry for the uncontrolable emaling to the list but I'm in rather a stump. S> You may be hearing a lot from me over the next few days too. S> Anyway, I mentioned before my form with the addition that loops to the S> number of numbers the u

Re: [PHP] Looping Addition

2002-12-04 Thread Stephen
e... Then I calculate it. My question is, how would I loop the adding? I hope you understand this now... - Original Message - From: "Chris Wesley" <[EMAIL PROTECTED]> To: "PHP List" <[EMAIL PROTECTED]> Cc: "Stephen" <[EMAIL PROTECTED]> Se

Re: [PHP] Looping Addition

2002-12-04 Thread Chris Wesley
On Wed, 4 Dec 2002, Stephen wrote: > I already have that. $_POST['vars'] is a number and I already check that you > on a page before. All I need to know is how to keep adding numbers until > there are no more to add... If you mean that $_POST['vars'] is an array of numbers: $total = 0; foreach(

Re: [PHP] Looping Addition

2002-12-04 Thread Stephen
t; <[EMAIL PROTECTED]> Cc: "PHP List" <[EMAIL PROTECTED]> Sent: Wednesday, December 04, 2002 4:33 PM Subject: Re: [PHP] Looping Addition > What type is $_POST['vars']? I think that it is a string...you might > have to convert it to an integer... > >

Re: [PHP] Looping Addition

2002-12-04 Thread Ray Hunter
What type is $_POST['vars']? I think that it is a string...you might have to convert it to an integer... if( is_numeric( $_POST['vars'] ) ) { $vars = (int)$_POST['vars']; } else { echo "Error: \$_POST['vars'] is not an integer."; } On Wed, 2002-12-04 at 14:26, Stephen wrote: > So

Re: [PHP] Looping?

2002-10-05 Thread Marek Kilimajer
Thanks, never been there ;) @ Edwin wrote: >Actually, there *is* ("mysql_numrows"). > >I think you've missed this one. ;) > > http://www.php.net/manual/en/printwn/aliases.php > >- E > >On Saturday, October 05, 2002 11:40 PM >Subject: Re: [PHP] Lo

Re: [PHP] Looping?

2002-10-05 Thread @ Edwin
Actually, there *is* ("mysql_numrows"). I think you've missed this one. ;) http://www.php.net/manual/en/printwn/aliases.php - E On Saturday, October 05, 2002 11:40 PM Subject: Re: [PHP] Looping? Marek Kilimajer wrote: > Just checked the manual and there are

Re: [PHP] Looping?

2002-10-05 Thread Marek Kilimajer
this case nothing! > > > >>-Original Message- >>From: Marek Kilimajer [mailto:[EMAIL PROTECTED]] >>Sent: 05 October 2002 17:03 >>To: PHP >>Subject: Re: [PHP] Looping? >> >> >>typo: >> >>Justin French wrote: >> >> >> &g

Re: [PHP] Looping?

2002-10-05 Thread Marek Kilimajer
typo: Justin French wrote: >This should get you started: > > > >$dbreturn = mysql_query("SELECT * FROM Items WHERE ItemID = '$ItemID'"); >echo mysql_error(); >$ItemHits = mysql_numrows($dbreturn); > mysql_num_rows() >while($row = mysql_fetch_array($dbreturn)) >{ >$ItemID = $row['ItemID']; >$Ima

Re: [PHP] Looping?

2002-10-05 Thread Justin French
This should get you started: "; echo ""; echo ""; echo ""; echo ""; echo ""; echo "Product Name:"; echo "$ItemName"; echo ""; echo ""; echo "Product Code:"; echo "$ItemSKU"; echo ""; echo ""; echo "Unit price:"; echo "€$ItemCost"; echo ""; echo ""; echo "Description"; echo ""; echo ""; echo "";

RE: [PHP] looping through array with list()/each()

2002-09-25 Thread Kevin Porter
Thank you, thank you, thank you. And, er, "D'oh!" :o) - Kev > -Original Message- > From: Karl Phillipson [SMTP:[EMAIL PROTECTED]] > Sent: 25 September 2002 12:13 > To: [EMAIL PROTECTED] > Subject: RE: [PHP] looping through array with list()/each(

RE: [PHP] looping through array with list()/each()

2002-09-25 Thread Karl Phillipson
while ( list($key, $val) = each($ser) ); <--- ; should not be here -Original Message- From: Kevin Porter [mailto:[EMAIL PROTECTED]] Sent: 25 September 2002 12:13 To: Kevin Porter; '[EMAIL PROTECTED]' Subject: RE: [PHP] looping through array with list()/each() I meant $ke

RE: [PHP] looping through array with list()/each()

2002-09-25 Thread Kevin Porter
I meant $key and $val of course :o) - Kev > -Original Message- > From: Kevin Porter [SMTP:[EMAIL PROTECTED]] > Sent: 25 September 2002 12:00 > To: '[EMAIL PROTECTED]' > Subject: [PHP] looping through array with list()/each() > > OK so I've done this hundreds of times, but this ti

  1   2   >