Jump to content

Help Please


seany02

Recommended Posts

Im trying to create a table with embedded links. The idea is that the table in the code below shows a brief amout of data, the user clicks the embedded link and goes to a page displaying further information. Somewhere along the way ive messed up, i know the table works before the embedded links bit is added so it isnt the sql.

any help would be greatly appreciated.

<?php
$db = mysql_connect("localhost","root","") or die("Problem connecting");
mysql_select_db("rufus") or die("Problem selecting database");
$query = "SELECT * FROM project ORDER BY project_id";
$result = mysql_query($query) or die ("Query failed");
//let's get the number of rows in our result so we can use it in a for loop
$numofrows = mysql_num_rows($result);
echo "<TABLE BORDER=\"1\">\n";
echo "<TR bgcolor=\"ff6633\"><TD>Project ID</TD><TD>Project Name</TD><TD>Project Description</TD><TD>Read More</TD></TR>\n";
for($i = 0; $i < $numofrows; $i++) {
$row = mysql_fetch_array($result); //get a row from our result set
if($i % 2) { //this means if there is a remainder
echo "<TR bgcolor=\"ff6633\">\n";
} else { //if there isn't a remainder we will do the else
echo "<TR bgcolor=\"ff9900\">\n";
}
echo "<TD>".$row['project_id']."</TD><TD>".$row['project_name']."</TD><TD>".$row['project_description']."<TD>".$row['email']."</TD><td>\n";
echo '<a href="viewmore.php?project_id=$result_row[project_id].'">Click</a></TR>\n";
}
//now let's close the table and be done with it
echo "</TABLE>\n";
?>

Link to comment
https://forums.phpfreaks.com/topic/155703-help-please/
Share on other sites

A couple of things:

 

When opening a new topic, you should choose a title that describes your problem...That way, users can quickly determine if they are able to help you...

Second, please tell us what your problem is and any error messages you get...

Link to comment
https://forums.phpfreaks.com/topic/155703-help-please/#findComment-819539
Share on other sites

sorry!

my problem is that i want to embed a link in a table and cant.

echo '<a href="viewmore.php?project_id=$result_row[project_id].'">Click</a></TR>\n";

somethings not working around this i think

the browser error i get is

Parse error: parse error, expecting `','' or `';'' in C:\xampp\htdocs\prosearch1.php on line 77

Link to comment
https://forums.phpfreaks.com/topic/155703-help-please/#findComment-819546
Share on other sites

sorry!

my problem is that i want to embed a link in a table and cant.

echo '<a href="viewmore.php?project_id=$result_row[project_id].'">Click</a></TR> ";

somethings not working around this i think

the browser error i get is

Parse error: parse error, expecting `','' or `';'' in C:xampphtdocsprosearch1.php on line 77

 

echo('<a href="viewmore.php?project_id=' . $result_row[project_id] . '">Click</a></TR> ');

Link to comment
https://forums.phpfreaks.com/topic/155703-help-please/#findComment-819556
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.