mysql result

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

mysql result

Post 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";
}
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Re: mysql result

Post 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..
Last edited by feyd on Mon Jul 05, 2004 2:12 pm, edited 1 time in total.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: mysql result

Post by josh »

thanks
Post Reply