Jump to content

link rows for edit


I-AM-OBODO

Recommended Posts

hi all.

how can i link each row so that when i click the edit, it takes me to a new page where i can edit the row associated with the edit link?

thanks in advance.

 

my code

 

<?php 

$result = mysql_query("SELECT * FROM domain_info") 
or die(mysql_error());

echo "<table border='0' cellspacing='2' cellpadding='2'>";
echo "<tr> <th bgcolor='#0cc' align='center'><font color='#fff'>Id</th> <th bgcolor='#0cc' align='center'><font color='#fff'>Clients' Name</font></th> <th bgcolor='#0cc' align='center'><font color='#fff'>Domain Name</th> <th bgcolor='#0cc' align='center'><font color='#fff'>Size</th><th bgcolor='#0cc' align='center'><font color='#fff'>Cost</th><th bgcolor='#0cc' align='center'><font color='#fff'>Created Date</th><th bgcolor='#0cc' align='center'><font color='#fff'>Last Renew</th><th bgcolor='#0cc' align='center'><font color='#fff'>Expiry Date</th></tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td width='25'>"; 
echo "$row['id'];
echo "</td><td width='150'>"; 
echo $row['client'];
echo "</td><td width='250'>"; 
echo $row['domain_name'];
echo "</td><td width='50'>"; 
echo $row['size'];
echo "</td><td width='50'>"; 
echo $row['cost'];
echo "</td><td width='100'>"; 
echo $row['create_date'];
echo "</td><td width='100'>"; 
echo $row['last_renewed'];
echo "</td><td width='100'>";
echo $row['expiry_date'];
echo "</td><td width='100'>"; 
echo "<a href='www.dis.com'> edit</a>"; // this is the edit link that should be linked to the rows
echo "</td></tr>"; 
} 

echo "</table>";

?>

Link to comment
https://forums.phpfreaks.com/topic/262916-link-rows-for-edit/
Share on other sites

	echo "<a href='edit.php?id={$row['id']}'> edit</a>"; // this is the edit link that should be linked to the rows

Also, note that your code is colored wrong, you have an errant double quote in your second echo inside the loop.

 

You're also going to have to actually write an edit page.

 

Link to comment
https://forums.phpfreaks.com/topic/262916-link-rows-for-edit/#findComment-1347591
Share on other sites

	echo "<a href='edit.php?id={$row['id']}'> edit</a>"; // this is the edit link that should be linked to the rows

Also, note that your code is colored wrong, you have an errant double quote in your second echo inside the loop.

 

You're also going to have to actually write an edit page.

 

 

thanks. but what's the right way for my coloring?

Link to comment
https://forums.phpfreaks.com/topic/262916-link-rows-for-edit/#findComment-1347602
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.