-> gert
Monday, March 24, 2003 sent:
gv> hello everyone,
gv> with this code, a table is loaded with info from the mysql db with id = '1'.
gv> but now i want to make a button, and when it is clicked, he has to renew the
gv> table with the info from the db with id ='2'
gv> does anyone know has this should be done?
gv> thanks in advance!
gv> Greetings,
gv> Gert Vonck
gv> <html>
gv> <head> <title> </title> </head>
gv> <body>
gv> <?php
gv> mysql_connect("localhost","root","") or
gv> die ("Could not connect to database");
gv> mysql_select_db("oh") or
gv> die ("problems selecting database");
?>>
gv> <h2>Info_DJ</h2>
gv> <?php
gv> $result0 = mysql_query("SELECT
gv> naam,leeftijd,muziekgenre,favoriet_liedje,motto,picture_right FROM info_dj
gv> WHERE id='1'") or die (mysql_error());
gv> print"<table border=1>\n";
gv> $field_count = mysql_num_fields($result0);
gv> while ($get_info0 = mysql_fetch_row($result0))
gv> {
gv> print "<tr><td><table>";
gv> for($i = 0; $i < $field_count - 1 ; $i++){
gv> $value = $get_info0[$i];
gv> $column = mysql_field_name($result0,$i);
gv> print "\t<tr><td>$column</td><td>$value</td></tr>\n";
gv> }
gv> $last = $field_count - 1;
gv> print "</table></td><td><img src='$get_info0[$last]'></td></tr>\n";
gv> }
gv> print "</table>\n";
gv> mysql_close();
?>>
gv> </body>
gv> </html>
gv> _________________________________________________________________
So, what is problem in? Make button to lead to same page but with
$n++ variable. i.e.
<?
$n = isset($_GET['n']) ? $_GET['n'] : '';
$sql = 'SELECT `foo` FROM `bar` WHERE id = '.$n;
$n++;
if ($req = mysql_query($sql)) { any actions...; print '<a
href="foo.php?n='.$n.'">link</a>'; }
else die (mysql_error());
?>
And one more thing - try to use templates, if you work with HTML
parsing a lot. :]
Yours, L0vCh1Y [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php