[thelist] PHP help with a loop and array

Michele Wandrei michele at inthree.com
Tue Nov 28 22:26:45 CST 2000


This might sound stupid, but have you done a command line check
of your sql statement?  I have been stuck in a similar spot, and
when I manually ran the sql statement outside of the script, I
found that the problem was with my data, not with the php code.
Just a thought.
___________________________________________________
Michele Wandrei
inThree Design
www.inthree.com



----- Original Message -----
From: "CDitty" <mail at redhotsweeps.com>
To: <thelist at lists.evolt.org>
Sent: Tuesday, November 28, 2000 4:52 PM
Subject: [thelist] PHP help with a loop and array


> Hello all.
>
> I seem to be having a little problem with a loop statement for
a php
> script.  No matter what I try, it only returns data on the
first loop.  The
> rest of the loops are ignored.
>
> for($i=0; $i < 6; $i++ )
> {
> $picsql = mysql_query("select picture from scratch_odds where
gameid =
> '$gameid' and id = $myotherpics[$i]");
> echo "select picture from scratch_odds where gameid = '$gameid'
and id =
> $myotherpics[$i]<br>";
> $picresult = mysql_fetch_array($picsql);
> echo $picresult[$i] . " - Result<br>";
> echo $i . " - Counter<br>";
> }
>
> This is a copy of what is echoed out.  As you can see below,
all the
> variables are set.
>
> select picture from scratch_odds where gameid = '1' and id = 6
> http://www.redhotsweeps.com/scratchnwin/games/15/331_11_2.gif -
Result
> 0 - Counter
> select picture from scratch_odds where gameid = '1' and id = 1
> - Result
> 1 - Counter
> select picture from scratch_odds where gameid = '1' and id = 5
> - Result
> 2 - Counter
> select picture from scratch_odds where gameid = '1' and id = 2
> - Result
> 3 - Counter
> select picture from scratch_odds where gameid = '1' and id = 3
> - Result
> 4 - Counter
> select picture from scratch_odds where gameid = '1' and id = 4
> - Result
> 5 - Counter
>
> Any ideas on what is wrong?
>
> Thanks
>
> Chris
>
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !
>





More information about the thelist mailing list