Re: Am I missing something simple???

From: Date: Tue, 28 Nov 2000 18:32:16 +0000
Subject: Re: Am I missing something simple???
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-27650@lists.php.net to get a copy of this message
mm...but...why do you do 6 queries?? when you could do only one, and then walk through the result...?? try selecting with something like : $picsql = mysql_query("select picture from scratch_odds where gameid = '$gameid' and id between 1 and 6"); Gonzalo ----- Original Message ----- From: "Jason Lavigne" <jlavigne@stonecroft.net> To: "CDitty" <mail@redhotsweeps.com> Cc: <php-general@lists.php.net> Sent: Wednesday, November 29, 2000 3:04 AM Subject: Re: [PHP] Am I missing something simple??? > Found it, this line: > $picresult = mysql_fetch_array($picsql); > is always setting it to array 0, same as $picresult[0] but you are doing > this next; > echo $picresult[$i] . " - Result<br>"; > you could do one of the following: > > $picresult[$i] = mysql_fetch_array($picsql); > echo $picresult[$i] . " - Result<br>"; > > or > > $picresult = mysql_fetch_array($picsql); > echo $picresult . " - Result<br>"; > > and it should work for you. > > Jay > > ----- Original Message ----- > From: "CDitty" <mail@redhotsweeps.com> > To: <php-general@lists.php.net> > Sent: Tuesday, November 28, 2000 12:54 PM > Subject: [PHP] Am I missing something simple??? > > > > Hello all. > > > > I seem to be having a little problem with a loop statement. No matter > what > > I try, it only returns data on the first loop. The rest is 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 > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#27650) next »