 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
Marius
Joined: 25 Apr 2007 Posts: 15 Location: Jhb, South Africa
|
Posted: Tue Jul 17, 2007 11:00 am Creating links with MySQL query results |
|
|
|
I have the following code that shows all my database tables....What i want to achieve is to make each result clickable which then link to edit, add & delete options for the table. I have googled and coulnd't find the answer to this.
How do i link the results?
| Code: |
<?php $result = mysql_query( "SHOW TABLES" )
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
print "<h3>Tables</h3><P>";
print "<table width=200 >\n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
foreach ($get_info as $field)
print "\t<td><font face=verdana size=3/>$field</font></td>\n";
print "</tr>\n";
}
print "</table>\n";
?> |
|
|
Marius
Joined: 25 Apr 2007 Posts: 15 Location: Jhb, South Africa
|
Posted: Tue Jul 17, 2007 11:34 am |
|
|
|
| ...or even a link to a tutorial that covers this |
|
mac_jsn
Joined: 21 Jun 2007 Posts: 6
|
Posted: Tue Jul 17, 2007 4:45 pm Try these ones |
|
|
|
Hi Marius
Though I myself is not an expert at the concern area, I always take help from some professional service providers, currently I am taking the services from http://www.techhelpformarketers.com for my current project. "They are an assembled team of Tech Professional with Extensive Experience in taking down IT task or IT technical problems giving you the Shortest Turnaround Time possible."
Hope it's helpful to you!
[mac_jsn] |
|
Keikura

Joined: 24 Mar 2007 Posts: 167 Location: U.K.
|
Posted: Thu Jul 19, 2007 1:35 pm |
|
|
|
Ignore above post as it's by some spammer idiot.
| Code: |
<?php
$result = mysql_query('SHOW TABLES') or die('SELECT Error: ' . mysql_error());
$num_rows = mysql_num_rows($result);
print "<h3>Tables</h3><br /><br />\n";
print "<table width=200 >\n";
while ($get_info = mysql_fetch_row($result))
{
print "<tr>\n";
foreach ($get_info as $field)
{
print "\t" . '<td style="font-family:Verdana"><a href="table.php?table_name=' . $field . '">' . $field . '</a></td>' . "\n";
}
print "</tr>\n";
}
print "</table>\n";
?> |
Click on a table name and it'll take you to table.php.
edit: Don't know why you need the foreach, SHOW TABLES will return just one column per row. |
|
motherbee
Joined: 23 Oct 2007 Posts: 3
|
Posted: Tue Oct 23, 2007 8:42 pm |
|
|
|
| Hi what is the "\t" for? I've used this script before and it works but I don't know what exactly the \t does. |
|
Keikura

Joined: 24 Mar 2007 Posts: 167 Location: U.K.
|
Posted: Wed Oct 24, 2007 7:44 am |
|
|
|
This will output a tab.
Whereas this will output \t.
So in short it just outputs a tab same way \n puts in a newline in the source code. |
|
motherbee
Joined: 23 Oct 2007 Posts: 3
|
Posted: Mon Oct 29, 2007 1:57 am tnx |
|
|
|
tnx.  |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
|
 |
|
|
|
|
|
|
|