Page 1 of 1

mysql result

Posted: Mon Jul 05, 2004 1:37 pm
by josh
I have the following code reading out the results of my database, how can i make the word "approve" into a link that passes the id of the record that its printing out? $line isnt necesarily the record number as the querry this uses has a WHERE clause
also the table this reads from has ALOT of fields so the easiest approach would be prefered

Code: Select all

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
   echo "\t<tr><td>Approve?</td>\n";
   foreach ($line as $col_value) {
       echo "\t\t<td>$col_value</td>\n";
	 
   }
   echo "\t</tr>\n";
}

Re: mysql result

Posted: Mon Jul 05, 2004 1:46 pm
by feyd

Code: Select all

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
   echo "\t<tr><td><a href="whatever.php?id={$line['id']}">Approve?</a></td>\n";
   foreach ($line as $col_value) {
       echo "\t\t<td>$col_value</td>\n";
	 
   }
   echo "\t</tr>\n";
}
[edit]oops.. heh..

Re: mysql result

Posted: Mon Jul 05, 2004 2:06 pm
by josh
thanks