trouble with looping
Posted: Wed Dec 23, 2009 5:49 am
Hi, I'm building a cms. I have a page where you can view your account details including what "projects" you are dealing with on the cms, using your email address.
This is the code that pulls and displays the names of the projects you are dealing with. It also creates a link to projectPage.php, which uses the pulled project name to decide which project's info to display:
The different project names are displayed perfectly. The problem is, that is always going to equal the last project name that the loop pulls, meaning that no matter which link I click on, projectPage.php will always display that last projects info.
What should I be doing instead?
Thanks
This is the code that pulls and displays the names of the projects you are dealing with. It also creates a link to projectPage.php, which uses the pulled project name to decide which project's info to display:
Code: Select all
$result = mysql_query("SELECT proName FROM projectList WHERE accEmail = '$accEmail'");
while($row = mysql_fetch_array($result))
{
$proName = $row['proName'];
echo "| <a href = projectPage.php><b>".$proName."</b></a><br />";
$_SESSION['proName'] = $proName;
}
Code: Select all
$proNameWhat should I be doing instead?
Thanks