Not sure about this one, I am trying to execute a SQL query to retrieve
records then loop over the records and display X amount per line. Any
help is appreciated.
$sql = @mysql_query( SELECT * FROM subnets, $db );
$num = @mysql_num_rows( $sql );
$subnets .= table width=\100%\trtd
Jason Gerfen wrote:
Not sure about this one, I am trying to execute a SQL query to retrieve
records then loop over the records and display X amount per line. Any
X ammount of what per 'line'? db records (or elelphants)?
and by line do you mean 'html table row'?
assuming I got that correct,
This is the code I went with and it works like a charm! Thank you very much
M. Sokolewicz!
echo {$row['name']}br /{$row['description']};
would work, just like all of the following would also:
echo $row[name]br /$row[description];
echo $row['name'].br /.$row['description'];
and a couple of others
Holla,
Maybe someone knows how to improve for loops
performance? When generating 1000's of pages, it
oads in 10-20 seconds. Maybe there is some
solution I don't know about?
Thanks!
--
Tadas Talaikis
[EMAIL PROTECTED]
http://www.xongoo.com
--
PHP General Mailing List (http://www.php.net/)
To
On Sat, 2004-08-21 at 12:17, Xongoo!com: Central unit wrote:
Holla,
Maybe someone knows how to improve for loops
performance? When generating 1000's of pages, it
oads in 10-20 seconds. Maybe there is some
solution I don't know about?
Give us an example of your for loop that is having
Xongoo!com: Central unit wrote:
Holla,
Maybe someone knows how to improve for loops
performance? When generating 1000's of pages, it
oads in 10-20 seconds. Maybe there is some
solution I don't know about?
prey what is your algorithm?
Thanks!
--
Tadas Talaikis
[EMAIL PROTECTED]
: Central unit [EMAIL PROTECTED]
Cc: PHP-General [EMAIL PROTECTED]
Sent: Saturday, August 21, 2004 7:32 PM
Subject: Re: [PHP] for loops performance
On Sat, 2004-08-21 at 12:17, Xongoo!com: Central
unit wrote:
Holla,
Maybe someone knows how to improve for loops
performance? When generating 1000's
PROTECTED]
To: Xongoo!com: Central unit [EMAIL PROTECTED]
Cc: PHP-General [EMAIL PROTECTED]
Sent: Saturday, August 21, 2004 7:32 PM
Subject: Re: [PHP] for loops performance
On Sat, 2004-08-21 at 12:17, Xongoo!com: Central
unit wrote:
Holla,
Maybe someone knows how to improve for loops
performance? When
Xongoo!com: Central unit wrote:
Maybe someone knows how to improve for loops
performance? When generating 1000's of pages, it
oads in 10-20 seconds. Maybe there is some
solution I don't know about?
If you only generate 100s of pages, it'll probably load about ten times
faster...
--
---John
Hey, would anyone know offhand, if its faster to create a temp array,
fill it via loop, and then set a class property to that array, or to
simply fill the class property via loop..
to clearify.
would the following example be faster or slower had i simply done
$this-myArray[$i] = $i;
class
Jason Davidson mailto:[EMAIL PROTECTED]
on Wednesday, March 10, 2004 12:25 AM said:
would the following example be faster or slower had i simply done
$this-myArray[$i] = $i;
class MyClass {
var $myArray = array();
function MyClass() {
$myTempArray = array();
i would do it this way
function MyClass()
{
$this-myArray = range(0, 99);
}
luis.
Chris W. Parker [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
Jason Davidson mailto:[EMAIL PROTECTED]
on Wednesday, March 10, 2004 12:25 AM said:
would the following example be faster
here's how i would do it (coding styles aside):
function MyClass()
{
$limit = 100;
$i = -1;
while(++$i $limit)
{
$this-myArray[] = $i;
}
}
Don't forget poor old range:
$this-myArray = range(0, 99);
Luis Mirabal mailto:[EMAIL PROTECTED]
on Wednesday, March 10, 2004 12:30 PM said:
i would do it this way
function MyClass()
{
$this-myArray = range(0, 99);
}
guys (luis), guys (mike), let's not try to one-up each other...
...
...
but i would take it a step further. :P
function
Im fully aware of diffrent ways of doing it, my question is, in the 2
ways i mentioned, which is more efficient. Ill take the question to
the internals list. Thanks for your responses.
Jason
Chris W. Parker [EMAIL PROTECTED] wrote:
Luis Mirabal mailto:[EMAIL PROTECTED]
on Wednesday,
On 18 February 2004 22:13, Alex Hogan wrote:
Sorry...,
Line 17 is: print trtda
href=\$id\$row2[$rtxt]/a/td/tr;
I haven't a clue what this is relating to (bit *too* much snippage there!), but I
think that statement is going to need some curly braces to have a chance of working as
Message-
From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 19, 2004 4:50 AM
To: 'Alex Hogan'; PHP General list
Subject: RE: [PHP] Nested Loops
On 18 February 2004 22:13, Alex Hogan wrote:
Sorry...,
Line 17 is: print trtda
href=\$id\$row2[$rtxt]/a/td/tr
Hi All,
I've been banging my head for several hours now.
I've got a mssql backend.
What I want to display is;
Date 1
Item 1
Item 2
Item 3 ... etc
Date 2
Item 1
Item 2
Item 3 ... etc
Here's the code I've been fighting with;
$query = select distinct wn_pdate
Sorry...,
Line 17 is: print trtda href=\$id\$row2[$rtxt]/a/td/tr;
alex
**
The contents of this e-mail and any files transmitted with it are
confidential and intended solely for the use of the individual or
entity
Alex Hogan mailto:[EMAIL PROTECTED]
on Wednesday, February 18, 2004 2:06 PM said:
Do I have something wrong with my syntax?
Is there an easier way to do this?
i don't know the answer to either of those questions but if it's
complaining of an undefined index you might want to try
Using print_r($var) shows that the vars are returning the right values, and
where they're supposed to. Right in between the error messages. Doh.
alex
**
The contents of this e-mail and any files transmitted with it are
John Ryan mailto:[EMAIL PROTECTED]
on Saturday, September 13, 2003 9:26 AM said:
When I use for loops, at the start of each iteration, the variables
hold the values from the last loop.
You're doing it wrong then (I think).
1. You should always initialize your loop counters.
i.e.
$x = 0;
Chris W. Parker
on Tuesday, September 16, 2003 4:07 PM said:
This Is Good(tm):
for($x=0;$x100;$x++)
{
for($x=0;$x100;$x++)
{
echo Me happy now!!;
}
}
Hehe... whoops! Should be:
for($x=0;$x100;$x++)
{
for($y=0;$y100;$y++)
{
When I use for loops, at the start of each iteration, the variables hold the
values from the last loop.
First, is there an elegant way of clearing variables at the start of each
loop rather than using unset???! It just seems wrong.
Also, all my problems would be solved if variables in a for loop
* Thus wrote John Ryan ([EMAIL PROTECTED]):
When I use for loops, at the start of each iteration, the variables hold the
values from the last loop.
First, is there an elegant way of clearing variables at the start of each
loop rather than using unset???! It just seems wrong.
I'm unclear as
where is $row['BillPeriod'] set? and what is its value?
Chris Knipe wrote:
Lo,
Quite desperate now... Or at least, I'm starting to get there... Can anyone
perhaps see why this loop is not exiting???
$quit=$now;
$glet=getdate($row['RenewDate']);
// debug
echo howlong: . $howlong;
Lo,
Quite desperate now... Or at least, I'm starting to get there... Can anyone
perhaps see why this loop is not exiting???
$quit=$now;
$glet=getdate($row['RenewDate']);
// debug
echo howlong: . $howlong;
while($quit$howlong) {
// debug
echo quit: . $quit . br;
$quit=mktime(0, 0, 0,
it works for me just the way you have itexcept of course that you are
telling it to only print to y because you are saying z
Steve
At 12:50 PM 5/30/2002 +0800, Jason Wong wrote:
On Thursday 30 May 2002 11:46, Peter wrote:
Just a query ... has any one else noticed this
for($i = a; $i
Just a query ... has any one else noticed this
for($i = a; $i z; $i++)
{
print $i;
echo BR;}
will print out a right down to yz
but replace the letters with numbers eg
for($i = 1; $i 10; $i++)
{
print $i;
echo BR;}
and it prints 1 thru to 10
and any one know a reason for this?
On Thursday 30 May 2002 11:46, Peter wrote:
Just a query ... has any one else noticed this
for($i = a; $i z; $i++)
{
print $i;
echo BR;}
will print out a right down to yz
It should only print to 'y' ...
but replace the letters with numbers eg
for($i = 1; $i 10; $i++)
{
print
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))
{
?
:[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, appleprice, orangeprice, pearprice
FROM fruits);
while ($data
'; 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)
table
?
$results = mysql_query(SELECT ID, date, appleprice, orangeprice, pearprice
FROM fruits);
$i = 0; $cols = 4
while ($data = mysql_fetch_array
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))
{
?
p?=$data[date]? - ?=$data[appleprice]? -
?=$data[orangeprice]? - ?=$data[pearprice]?/p
?
}
How would I
]? - ?=$data[appleprice]?br
?=$data[orangeprice]? - ?=$data[pearprice]?/td
?
if ($i % $cols == $cols-1) echo /tr;
$i++;
}
?
/table
-Original Message-
From: Craig Westerman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 27, 2002 11:43 AM
To: php-general-list
Subject: [PHP] mysql php
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 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 $filename
[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 routers
Hello paula,
Monday, April 09, 2001, 6:47:21 AM, you wrote:
p I was sending desperate emails to this list related to nested loops and array
comparision.
p Well, just let you know that the problem seems to be that I'm using this with PHPLIB
p templates and those can't handle nested loops.
I was sending desperate emails to this list related to nested loops and array
comparision. Well, just let you know that the problem seems to be that I'm using this
with PHPLIB templates and those can't handle nested loops.
If I would know that a week ago I would avoid nightmares and had 6
On Sun, Apr 08, 2001 at 10:47:21PM -0400, paula wrote:
I was sending desperate emails to this list related to nested loops and array
comparision. Well, just let you know that the problem seems to be that I'm using this
with PHPLIB templates and those can't handle nested loops.
Please
41 matches
Mail list logo