On Mon, Sep 19, 2011 at 18:22, George Langley george.lang...@shaw.ca wrote:
Hi all. Had a meeting today where I was rather condescendingly told
that most CMS web sites use SharePoint.
Well, you may reply, equally condescendingly, that you will need
that to have cited references, as
On Fri, 2009-03-27 at 08:11 +, Andrew Williams wrote:
can some tell why the below loop stop running after some time.
$start=10;
const run=0;
while($start run){
//do somthing
}
max_execution_time
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
-Original Message-
From: Andrew Williams [mailto:andrew4willi...@gmail.com]
Sent: 27 March 2009 10:12 AM
To: PHP LIST
Subject: [PHP] WHILE LOOP PROBLEM
can some tell why the below loop stop running after some time.
$start=10;
const run=0;
while($start run){
//do somthing
}
--
The
-general@lists.php.net
Subject: RE: [PHP] while-question
Dabbling?
I think that making a living from it isn't dabbling, so I may not be
qualified to speak for the dabblers.
But for me, I was writing code before there were such courses. Later,
when I went to college I was taught
bruce wrote:
interesting points regarding college and programming..
my degrees bsee/msee covered alot more than pure programing.. as a double
ee/cs, the ability to articulate an issue/problem, and bring to mind a cogent
thought process was valuable. the ability to understand how different
Ashley Sheridan wrote:
On Mon, 2008-11-17 at 18:01 -0500, Craige Leeder wrote:
Ashley Sheridan wrote:
On Mon, 2008-11-17 at 17:47 -0500, Craige Leeder wrote:
Only thing to note with the foreach is that you are actually working on
a copy of the array, so if you intend to modify it, pass it
tedd wrote:
At 7:02 PM -0500 11/17/08, Craige Leeder wrote:
I'm not illiterate; promise :p
- Craige
Yeah, his parents were married before he was born.
Cheers,
tedd
omg tedd, I was just reading this thread over, thought exactly that
witty response, clicked you're reply and there it is;
Jochem Maas wrote:
just for laughs .. given the 'dabble' thread Cleeder is phonetically
very very close to a dutch word meaning 'messing around' .. rather in the way
a 2yo might mess around with a bowl of yogurt.
Haha, now that does make me laugh. Out of curiosity, what is the actual
word
Craige Leeder schreef:
Jochem Maas wrote:
just for laughs .. given the 'dabble' thread Cleeder is phonetically
very very close to a dutch word meaning 'messing around' .. rather in
the way
a 2yo might mess around with a bowl of yogurt.
Haha, now that does make me laugh. Out of curiosity,
Jochem Maas wrote:
klieder ... kliederen
the E sound is short.
Interesting to know. Thanks :D
- Craige
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Craige Leeder wrote:
Jochem Maas wrote:
klieder ... kliederen
the E sound is short.
Interesting to know. Thanks :D
- Craige
don't believe him, jochem is really called Bob Davis, a slightly
balding middle aged ASP developer from hull sent to infiltrate the PHP
community and misguide
On Tue, Nov 18, 2008 at 9:33 AM, Nathan Rixham [EMAIL PROTECTED] wrote:
Craige Leeder wrote:
Jochem Maas wrote:
klieder ... kliederen
the E sound is short.
Interesting to know. Thanks :D
- Craige
don't believe him, jochem is really called Bob Davis, a slightly balding
middle aged
On Tue, 2008-11-18 at 14:33 +, Nathan Rixham wrote:
Craige Leeder wrote:
Jochem Maas wrote:
klieder ... kliederen
the E sound is short.
Interesting to know. Thanks :D
- Craige
don't believe him, jochem is really called Bob Davis, a slightly
balding middle aged ASP
On Tue, 2008-11-18 at 10:52 +, Nathan Rixham wrote:
Ashley Sheridan wrote:
On Mon, 2008-11-17 at 18:01 -0500, Craige Leeder wrote:
Ashley Sheridan wrote:
On Mon, 2008-11-17 at 17:47 -0500, Craige Leeder wrote:
Only thing to note with the foreach is that you are actually working
On 17 Nov 2008, at 13:01, Alain Roger wrote:
i'm on PHP training and our lector is telling us that to avoid
counting an
array item amout thanks count($my_array), he tells we can do:
while($my_array)
{
... do something
}
but from experience this is an infinity loop...
it should be always
Hi,
i'm on PHP training and our lector is telling us that to avoid counting an
array item amout thanks count($my_array), he tells we can do:
while($my_array)
{
... do something
}
but from experience this is an infinity loop...
it should be always something like
$count = count($my_array);
[snip]
...foreach...
[/snip]
You could also use a for loop if you wanted to count;
for($i = 0; $i count($array); $i++){
echo $i . \n;
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Timo Erbach schreef:
...but for best performance you should do:
$counter = count($array);
for($i = 0; $i $counter; $i++){
echo $i . \n;
}
just for fun:
$a = range(1,10);
for ($i = 0, $c = count($a); $i $c; print($a[$i].\n), $i++);
... gives an idea of the power and flexibility of a
Jochem Maas wrote:
$a = range(1,10);
for ($i = 0, $c = count($a); $i $c; print($a[$i].\n), $i++);
think the point of this is to count the items in an array without count
mate :p no point in the above you could just:
$c = count($a);
foreach!
$a = range(1,10);
$c = 0;
foreach($a as $b) {
Nathan Rixham schreef:
Jochem Maas wrote:
$a = range(1,10);
for ($i = 0, $c = count($a); $i $c; print($a[$i].\n), $i++);
think the point of this is to count the items in an array without count
mate :p no point in the above you could just:
$c = count($a);
I thought the point was to avoid
On 17 Nov 2008, at 14:31, Nathan Rixham wrote:
if you really want a challenge try this one..
task: add the numbers 5 and 17 together, using php, without using
the + operator. fill it in:
function add($a , $b) {
//code here but no + - / * operators
return $answer;
}
echo add(5, 17);
On Mon, Nov 17, 2008 at 9:47 AM, Jochem Maas [EMAIL PROTECTED] wrote:
Nathan Rixham schreef:
Jochem Maas wrote:
$a = range(1,10);
for ($i = 0, $c = count($a); $i $c; print($a[$i].\n), $i++);
think the point of this is to count the items in an array without count
mate :p no point in the
Stut wrote:
On 17 Nov 2008, at 14:31, Nathan Rixham wrote:
if you really want a challenge try this one..
task: add the numbers 5 and 17 together, using php, without using the
+ operator. fill it in:
function add($a , $b) {
//code here but no + - / * operators
return $answer;
}
echo add(5,
On Mon, 2008-11-17 at 14:54 +, Stut wrote:
On 17 Nov 2008, at 14:31, Nathan Rixham wrote:
if you really want a challenge try this one..
task: add the numbers 5 and 17 together, using php, without using
the + operator. fill it in:
function add($a , $b) {
//code here but no + -
... ?
-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED]
Sent: Monday, November 17, 2008 9:53 AM
To: Stut
Cc: Nathan Rixham; php-general@lists.php.net
Subject: Re: [PHP] while-question
On Mon, 2008-11-17 at 14:54 +, Stut wrote:
On 17 Nov 2008, at 14:31, Nathan Rixham wrote
Robert Cummings schreef:
On Mon, 2008-11-17 at 14:54 +, Stut wrote:
On 17 Nov 2008, at 14:31, Nathan Rixham wrote:
if you really want a challenge try this one..
task: add the numbers 5 and 17 together, using php, without using
the + operator. fill it in:
function add($a , $b) {
On Mon, 2008-11-17 at 10:00 -0800, bruce wrote:
curious qiestion
to all on here who dabble in php... how many of you have actully gone to
college, taken algorithm courses, microprocessor courses,
design/architecture courses, etc..
or is the majority of the work here from people who've
On Mon, 2008-11-17 at 19:07 +0100, Jochem Maas wrote:
Robert Cummings schreef:
On Mon, 2008-11-17 at 14:54 +, Stut wrote:
On 17 Nov 2008, at 14:31, Nathan Rixham wrote:
if you really want a challenge try this one..
task: add the numbers 5 and 17 together, using php, without using
bruce wrote:
curious qiestion
to all on here who dabble in php... how many of you have actully gone to
college, taken algorithm courses, microprocessor courses,
design/architecture courses, etc..
or is the majority of the work here from people who've grabbed the tools and
started
At 10:00 AM -0800 11/17/08, bruce wrote:
curious qiestion
to all on here who dabble in php... how many of you have actully gone to
college, taken algorithm courses, microprocessor courses,
design/architecture courses, etc..
or is the majority of the work here from people who've grabbed the
Dabbling?
I think that making a living from it isn't dabbling, so I may not be
qualified to speak for the dabblers.
But for me, I was writing code before there were such courses. Later,
when I went to college I was taught adventures in keypunching and
received several next to
At 2:55 PM -0500 11/17/08, Wolf wrote:
Tedd, glad you got hooked on Phonics. One of these days I hope from
graduating from just looking at the pictures, but right now the
pictures are oh so enticing!. ;)
Wolf
Wolf:
Lot's of exciting things -- hard to keep up on bots, automated
buying,
Alain Roger wrote:
Hi,
i'm on PHP training and our lector is telling us that to avoid counting an
array item amout thanks count($my_array), he tells we can do:
while($my_array)
{
... do something
}
but from experience this is an infinity loop...
it should be always something like
$count =
On Mon, 2008-11-17 at 17:47 -0500, Craige Leeder wrote:
Alain Roger wrote:
Hi,
i'm on PHP training and our lector is telling us that to avoid counting an
array item amout thanks count($my_array), he tells we can do:
while($my_array)
{
... do something
}
but from experience this
Ashley Sheridan wrote:
On Mon, 2008-11-17 at 17:47 -0500, Craige Leeder wrote:
Only thing to note with the foreach is that you are actually working on
a copy of the array, so if you intend to modify it, pass it by reference.
- Craige
Can you do that? I assume it would look like this:
On Mon, 2008-11-17 at 18:01 -0500, Craige Leeder wrote:
Ashley Sheridan wrote:
On Mon, 2008-11-17 at 17:47 -0500, Craige Leeder wrote:
Only thing to note with the foreach is that you are actually working on
a copy of the array, so if you intend to modify it, pass it by reference.
bruce wrote:
curious qiestion
to all on here who dabble in php... how many of you have actully gone to
college, taken algorithm courses, microprocessor courses,
design/architecture courses, etc..
or is the majority of the work here from people who've grabbed the tools and
started
Craige Leeder schreef:
bruce wrote:
curious qiestion
to all on here who dabble in php... how many of you have actully gone to
college, taken algorithm courses, microprocessor courses,
design/architecture courses, etc..
or is the majority of the work here from people who've grabbed the
tedd schreef:
At 10:00 AM -0800 11/17/08, bruce wrote:
curious qiestion
to all on here who dabble in php... how many of you have actully gone to
college, taken algorithm courses, microprocessor courses,
design/architecture courses, etc..
or is the majority of the work here from people
Jochem Maas wrote:
must . resist
I take you didn't score to hig on the spelling test? and collage,
is that the the cut-n-paste school of IT?
dang it, failed. ;-)
Haha! 'high' was just my 'h' key not pressing, and college is just one
of those words I have trouble with.
Craige Leeder schreef:
Ashley Sheridan wrote:
On Mon, 2008-11-17 at 17:47 -0500, Craige Leeder wrote:
Only thing to note with the foreach is that you are actually working
on a copy of the array, so if you intend to modify it, pass it by
reference.
- Craige
Can you do that? I
At 12:52 AM +0100 11/18/08, Jochem Maas wrote:
Craige Leeder schreef:
I'm 100% self taught for now. I'm just out of higschool, and hopefully
going off to collage next year.
must . resist
I take you didn't score to hig on the spelling test? and collage,
is that the the
At 7:02 PM -0500 11/17/08, Craige Leeder wrote:
I'm not illiterate; promise :p
- Craige
Yeah, his parents were married before he was born.
Cheers,
tedd
--
---
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To
Jay Blanchard wrote:
[snip]
...foreach...
[/snip]
You could also use a for loop if you wanted to count;
for($i = 0; $i count($array); $i++){
echo $i . \n;
}
This is not good because you are calling count every loop iteration.
Thank you,
Micah Gersten
onShore Networks
Internal
tedd schreef:
At 12:52 AM +0100 11/18/08, Jochem Maas wrote:
Craige Leeder schreef:
I'm 100% self taught for now. I'm just out of higschool, and hopefully
going off to collage next year.
must . resist
I take you didn't score to hig on the spelling test? and collage,
is that
Craige Leeder schreef:
Jochem Maas wrote:
must . resist
I take you didn't score to hig on the spelling test? and collage,
is that the the cut-n-paste school of IT?
dang it, failed. ;-)
Haha! 'high' was just my 'h' key not pressing, and college is just one
of those
On Sat, Feb 23, 2008 at 11:16 AM, Emiliano Boragina
[EMAIL PROTECTED] wrote:
Hi everyone
I am beginner
I have the following code:
?
$buscar = $_REQUEST['buscar'];
$base = inscripcion;
$conexion = mysql_connect ( 'localhost' , 'root' , 'root' );
On Sat, February 23, 2008 10:16 am, Emiliano Boragina wrote:
?
$buscar = $_REQUEST['buscar'];
$base = inscripcion;
$conexion = mysql_connect ( 'localhost' , 'root' , 'root' );
mysql_select_db ( $base , $conexion );
echo table border='1';
On Wed, 2007-10-31 at 13:02 +0200, Steven Macintyre wrote:
Hiya,
I have the following code ... which only seems to result in one item ...
which is incorrect ... can anyone spot my problem?
Your subject line says while-do + array, following code contains a
do-while loop. We can't debug the
Your subject line says while-do + array, following code contains
a
do-while loop.
Apologies :)
We can't debug the script very well without a
sample
input since we don't know how many times the loop should run. To
debug
yourself, try using print_r() to see exactly what the following
On Wed, 2007-10-31 at 16:20 +0200, Steven Macintyre wrote:
Your subject line says while-do + array, following code contains
a
do-while loop.
Apologies :)
We can't debug the script very well without a
sample
input since we don't know how many times the loop should run. To
debug
On 31/10/2007, Steven Macintyre [EMAIL PROTECTED] wrote:
Hiya,
I have the following code ... which only seems to result in one item ...
which is incorrect ... can anyone spot my problem?
if ($armbase != ) {
$options = explode(,, $armbase);
$text .=
I guess it is the missing semicolon.
And you can write:
echo trtd? echo $product_type ?/td/tr
as simply
echo trtd$product_type/td/tr
Prathap
-- Original Message ---
From: Mark Sargent [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Tue, 10 May 2005 13:23:51 +0900
Mark Sargent [EMAIL PROTECTED] writes:
$i=0;
while ($i $num){
$product_type=mysql_result($result,$i,product_type_detail);
echo trtd? echo $product_type ?/td/tr
}
$i++
You should put $i++ into the while loop. And you should add an ;
at the end of the echo line as well as at the end of
Prathaban Mookiah wrote:
I guess it is the missing semicolon.
And you can write:
echo trtd? echo $product_type ?/td/tr
as simply
echo trtd$product_type/td/tr
Prathap
-- Original Message ---
From: Mark Sargent [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Tue, 10 May 2005
oh, and the i++ should be inside the while loop and there is also a
missing semi colon after the echo, ie;
$i=0;
while ($i $num){
$product_type=mysql_result($result,$i,product_type_detail);
echo trtd? echo $product_type ?/td/tr;
$i++ ;
}
Mark Sargent wrote, On 10/05/05 02:23 PM:
Hi All,
this
quoth the Mark Sargent:
snip
html
body
h1centerJumbo Status/center/h1br
?php
$db = mysql_connect(localhost, root, grunger);
mysql_select_db(status,$db);
$result = mysql_query(SELECT ProductTypes.product_type_detail FROM
ProductTypes,$db);
$myrow = mysql_fetch_array($result);
$num =
Hi Mark,
As far as I can see the only problem is that you have forgotten to add a
semicolon after the i++
Cheers,
Mary-Anne
Mark Sargent wrote, On 10/05/05 02:23 PM:
Hi All,
this page,
http://www.freewebmasterhelp.com/tutorials/phpmysql/5
has the below code,
?
$i=0;
while ($i $num) {
Mary-Anne Nayler wrote:
oh, and the i++ should be inside the while loop and there is also a
missing semi colon after the echo, ie;
$i=0;
while ($i $num){
$product_type=mysql_result($result,$i,product_type_detail);
echo trtd? echo $product_type ?/td/tr;
$i++ ;
}
Mark Sargent wrote, On 10/05/05
On Mon, May 9, 2005 10:57 pm, Mark Sargent said:
Thanx. I saw the extra echo and removed it. Problem with that code,
though. It displays only the 1st record, repeatedly, causing the browser
to hang. Can anyone see what is wrong..? Cheers.
Everybody else has told you to move the $i++; inside
Mary-Anne Nayler wrote:
Hi Mark,
As far as I can see the only problem is that you have forgotten to add a
semicolon after the i++
Mark:
Since you are not displaying the counter, you really don't need to
mess with $i.
You can reduce your code to just :
?php
$db = mysql_connect(localhost,
I guess it is the missing semicolon.
And you can write:
echo trtd? echo $product_type ?/td/tr
as simply
echo trtd$product_type/td/tr
I prefer
echo 'trtd', $product_type, '/td/tr';
No string concatenation, or variable replacement required.
Jared
--
PHP General Mailing List
Reinhart Viane wrote:
Hey list
I have a mysql table like this:
[ snipped ]
Now I retrieve all activities happening in the future with this query:
$sqlact=select * from activities where act_date = NOW() order by
act_type_id;
$getact=mysql_query($sqlact)
What Im trying to do now is:
From
Reinhart Viane wrote:
Hey list
I have a mysql table like this:
Act_name Act_type_id Act_date
Heyhey 1 22-06-05
Aloha2 22-06-05
Tralala 2 22-06-05
Wuhu1
Perhaps it is just me, but wouldn't it be easier to make individual
mysql queries for each different act type? That would make the sorting
-much- easier. I'm not sure if that's an option, but if it is, I'd
consider exploring it.
select * from activities where act_date = NOW() act_type_id = 1
or
@lists.php.net
Onderwerp: Re: [PHP] while loop
Perhaps it is just me, but wouldn't it be easier to make individual
mysql queries for each different act type? That would make the sorting
-much- easier. I'm not sure if that's an option, but if it is, I'd
consider exploring it.
select * from activities
: Justin Lilly [mailto:[EMAIL PROTECTED]
Verzonden: woensdag 23 februari 2005 18:57
Aan: php-general@lists.php.net
Onderwerp: Re: [PHP] while loop
Perhaps it is just me, but wouldn't it be easier to make individual
mysql queries for each different act type? That would make the sorting
-much- easier. I'm
Reinhart Viane wrote:
Well I'm able to do that, there are only 4 different types, but the 4
queries have exactly the same syntax so I think it's better to combine them.
Not?
what about using UNION on the four queries?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
Louie Miranda wrote:
i have a while statement inside a function, but it seems like it dont
work. is this possible?
Add the following lines:
global $apo;
global $row;
This will make it work for you but it's not the best solution. It's
better to pass in parameters to the function rather than to
sorry, i overlooked on something.
i need to rest for a while, im working on a wrong program thats why it
wont work.
heh, :(. thanks again.
--
Louie Miranda
http://www.axishift.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I would like to select all 'b' from Table_1 WHERE a
= '2' and then to
select all 'd' from table_2 with 'b' from previous
result.
Table 2 is the Table with UserNames (d) and Table 1
is the table with
'marked' UserID's (b).
If I understand you correctly, its sounds like you
want to
* Thus wrote T. H. Grejc ([EMAIL PROTECTED]):
Hallo,
I know of a few ways of doing this but I am not sure that any is right.
I want to consult with you what is the best way of doing this:
...
I would like to select all 'b' from Table_1 WHERE a = '2' and then to
select all 'd' from
T. H. Grejc wrote:
Hallo,
I know of a few ways of doing this but I am not sure that any is right.
I want to consult with you what is the best way of doing this:
Table 1:
++-+
| *a* | *b* |
++-+
| 2 | 1|
++-+
| 2 | 2|
++-+
Table 2:
++-+
|
Please don't cross-post.
See below - M.
At 10:17 AM 9/17/2003 -0400, Roger Spears wrote:
Hello,
Can anyone from the lists please tell me why this bit of code is not
picking up on the first record in the database? If the 'id' I'm looking
for is '1' it doesn't populate the _SESSION variables.
Hi,
Monday, March 10, 2003, 7:20:37 PM, you wrote:
RK Can somebody look at this and tell me way the first while loop will
RK only loop through the database once when there is more than one record
RK that should be processed.
RK while($members = @mysql_fetch_object($result)) {
RK
-Original Message-
From: SpyProductions Support Team [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 12:57 PM
To: [EMAIL PROTECTED]
Subject: [PHP] while loop- will this work?
Should this work?
$f1 = rand(999,999);
while($check_sid =
-Original Message-
From: SpyProductions Support Team [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 11:57 AM
To: [EMAIL PROTECTED]
Subject: [PHP] while loop- will this work?
Should this work?
Nope...because the value returned by mysql_query() isn't the number
Define fails
- Original Message -
From: Jay Fitzgerald [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, January 24, 2003 3:11 PM
Subject: [PHP] WHILE IF/ELSE loop not working
can anyone tell me why this while loop fails?
==
while
On Saturday 25 January 2003 05:43, Rick Emery wrote:
Define fails
- Original Message -
From: Jay Fitzgerald [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, January 24, 2003 3:11 PM
Subject: [PHP] WHILE IF/ELSE loop not working
can anyone tell me why this while loop fails?
Why not use while to loop through the shopping cart and add items to the
message variable?
$message =
Here is your order:
;
while ($Row = mysql_fetch_array($Results))
$message .= item description information;
$message .=
Thanks for your order...
;
-Original Message-
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:
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'];
LPR
Line 13 is re-assigning $result, the save variable you're using in line 1!
1 while($row = mysql_fetch_array($result))
2 {
3$pri = $row['pri'];
4$fg = $row['fg'];
5$molw = $row['molw'];
6$density = $row['density'];
7$denstype = $row['denstype'];
8$pctd =
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
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 = file id=\ . $row['file_id'] . \ .
$row['file_name'] . /file;
}
That will
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 that
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 separator to
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
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 a
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 =
I notice that you are concatinating then each time. try setting them to =
before using them
$companyID_string = ;
$companyName_string = ;
then:
while()
{
$companyID_string .= , . $query_data[0];
$companyName_string .= , . $query_data[1];
}
Jim
ps. try
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
[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.
(Thanks!)
I'm still curious as to why
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
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 with or without
did you do it again ?
:-)
pasting you code is ok ...
Steve
[EMAIL PROTECTED] wrote in message
BB6D932A42D6D211B4AC0090274EBB1D2EF0EE@GLOBAL1">news:BB6D932A42D6D211B4AC0090274EBB1D2EF0EE@GLOBAL1...
Here's the attachment - I hate it when I do that! :)
-Original Message-
From:
Thanks Steve! :) Here's the code:
?
$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=$one[description];
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
okay - read all the code now.
this might be a better way:
?php
$results = mysql_db_query($db, select * from $table where $query order
by update_datetime desc limit $offset, 10);
$one = mysql_fetch_array($results);
$numrows=mysql_num_rows($one);// get the number of results
if ($numrows0)
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];
1 - 100 of 120 matches
Mail list logo