Page 1 of 1

Need help on how to hyperlink query results in a table!

Posted: Thu Jan 29, 2009 1:57 pm
by affluent980
I have a block of code that displays the contents of my table for leads that i collect. I want to be able to hyperlink the "LeadID" so that when clicked, I can a page that displays that lead's info so i can then edit it if necessary. How do i make each returned "LeadID" hyperlinked so it will go to the next page? Here is my code so far that shows the table and i want to make LeadID hyperlinked to go to my next page details.php . Please help!!!

while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['LeadID'] . "</td>";
echo "<td>" . $row['CID'] . "</td>";
echo "<td>" . $row['Category'] . "</td>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['Email'] . "</td>";
echo "<td>" . $row['Phone'] . "</td>";
echo "<td>" . $row['Date'] . "</td>";
echo "<td>" . $row['Time'] . "</td>";
echo "<td>" . $row['Keyword'] . "</td>";
echo "<td>" . $row['More'] . "</td>";
echo "<td>" . $row['Less'] . "</td>";
echo "<td>" . $row['Closed'] . "</td>";
echo "<td>" . $row['Revenue'] . "</td>";
echo "</tr>";
}

Re: Need help on how to hyperlink query results in a table!

Posted: Thu Jan 29, 2009 2:06 pm
by mavieng
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td><a href=\"details.php?leadID=$row['LeadID']\"" . $row['LeadID'] . "</a></td>";
echo "<td>" . $row['CID'] . "</td>";
echo "<td>" . $row['Category'] . "</td>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['Email'] . "</td>";
echo "<td>" . $row['Phone'] . "</td>";
echo "<td>" . $row['Date'] . "</td>";
echo "<td>" . $row['Time'] . "</td>";
echo "<td>" . $row['Keyword'] . "</td>";
echo "<td>" . $row['More'] . "</td>";
echo "<td>" . $row['Less'] . "</td>";
echo "<td>" . $row['Closed'] . "</td>";
echo "<td>" . $row['Revenue'] . "</td>";
echo "</tr>";
}

Re: Need help on how to hyperlink query results in a table!

Posted: Thu Jan 29, 2009 2:35 pm
by affluent980
That didn't work. Got this error:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/content/c/c/u/ccunet/html/leads.php on line 56

Re: Need help on how to hyperlink query results in a table!

Posted: Fri Jan 30, 2009 5:15 am
by mavieng
Sorry there was a problem with quotes. It working now


while($row = mysql_fetch_array($result))
{
$leadID = $row['LeadID'];

echo "<tr>";
echo "<td><a href=\"details.php?leadID=$leadID\">$leadID</a></td>";
echo "<td>" . $row['CID'] . "</td>";
echo "<td>" . $row['Category'] . "</td>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['Email'] . "</td>";
echo "<td>" . $row['Phone'] . "</td>";
echo "<td>" . $row['Date'] . "</td>";
echo "<td>" . $row['Time'] . "</td>";
echo "<td>" . $row['Keyword'] . "</td>";
echo "<td>" . $row['More'] . "</td>";
echo "<td>" . $row['Less'] . "</td>";
echo "<td>" . $row['Closed'] . "</td>";
echo "<td>" . $row['Revenue'] . "</td>";
echo "</tr>";
}