Jump to content

MYSQL multiple rows help


ensellitis

Recommended Posts

I have looked and looked, and I have yet to find an answer to this.  Maybe I have just gone retarded...

 

	$threeup1	= $upuser['3up1'];
	$threeup2	= $upuser['3up2'];
	$threeup3	= $upuser['3up3'];

	if($threeup1 !== "0" && $threeup2 !== "0" && $threeup3 !== "0"){

	}

 

What I am trying to do is pull the the info from $threeup1, $threeup2, and $threeup3 from 3 seperate DB rows, and use the info in one spot.  So if the IDs where repectively 2,10, 12...  I want to grab all 3 of their "level" columns and check them. 

 

The script works like this: If all 3 are level 1 or higher (but all are atleast level 1), it makes you level 2.  The same for all levels up to 5.

 

I hope that makes sense, I tried to give as much detail as possible so you can see what I am trying to do.  Help would be much appreciated.

Link to comment
Share on other sites

if $upuser is your db row then you aren't getting 3 separate db rows. you're pulling from the same row.

 

if you want from three different rows in your result set then i think you want something like this:

//get level from three consecutive rows in the result set from the db query
$threeup1	= mysql_result($dbresults,0,'level');
$threeup2	= mysql_result($dbresults,1,'level');
$threeup3	= mysql_result($dbresults,2,'level');

//make sure all are greater than or equal to 1
	if($threeup1 >= 1 && $threeup2 >= 1 && $threeup3 >= 1){
		//level up
	}



 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.