Jump to content

Show Next Result in dropdown box


Caffeinenyx

Recommended Posts


for ($i = 1; $i<$rows+1; $i++)
{
	$Choicequery ="SELECT PersonA, PersonB FROM modules WHERE GroupID = '$UpdateNumber'";
	$Choiceresult = mysql_query($Choicequery);
	$ChoiceRows = mysql_fetch_array($Choiceresult);

	$PersonQuery = "SELECT FirstName, LastName FROM Persons p, modules m, users e, group t WHERE m.modID = $ChoiceRows[0] AND e.UserID = m.PersonA AND p.PersonID = e.PersonID";
	$PersonResult = mysql_query($PersonQuery);
	$PersonRows = mysql_fetch_array($PersonResult);

	$Person2Query = "SELECT FirstName, LastName FROM Persons p, modules m, users e, group t WHERE m.modID = $ChoiceRows[0] AND e.UserID = m.PersonB AND p.PersonID = e.PersonID";
	$Person2Result = mysql_query($Person2Query);
	$Person2Rows = mysql_fetch_array($Person2Result);

	echo "<Option value = \"$i\">$PersonRows[0] $PersonRows[1] and $Person2Rows[0] $Person2Rows[1] </Option>";
}

 

How do I get it to show the next result when $i increases? All the options are the first people A and B $i number of times. Not sure how to use a loop here to go though the results. Whats the best way?

 

ie $PersonRows[0] $PersonRows[1] are the same for every option

Link to comment
Share on other sites

I dont think the above is explained very well, also If I could add ORDER BY to topic...

 

echo "<Option value = \"$i\">$PersonRows[0] $PersonRows[1] and $Person2Rows[0] $Person2Rows[1] </Option>";

 

I need to iterate though the results of $PersonRows[0] $PersonRows[1] and $Person2Rows[0] $Person2Rows[1]  for each $i

 

At the moment I get

Andy Smith
Andy Smith
Andy Smith

 

 

But I need

 

Andy Smith
Tim Carbrook
Tom Steptoe

 

etc,

 

Also I have

 

$Choicequery ="SELECT PersonA, PersonB FROM modules WHERE GroupID = '$UpdateNumber'"; or
$Choicequery ="SELECT PersonA, PersonB,StartDate FROM modules WHERE GroupID = '$UpdateNumber'";

 

But if I add ORDER BY StartDate, it returns nothing? I really need them ordered....

 

 

 

Any ideas?, thanks

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.