Jump to content
View in the app

A better way to browse. Learn more.

The Uniform Server Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Create link from column entries

Featured Replies

In my script, all the records in the database are output into a table. One of the columns is the primary key (Invoice Number). I would like for each Invoice Number to be a link, so when selected the user will be directed to a page where they can see and edit the entire record (invoice). How would I do that? I already have a page written that will display the information, I just don't have a way of telling it which record to display.

Here is the code:

 

<?

include("dbinfo.inc.php");

mysql_connect(localhost,$username,$password);

@mysql_select_db($database) or die( "Unable to select database");

$query="SELECT * FROM contacts";

$result=mysql_query($query);

 

$num=mysql_numrows($result);

 

mysql_close();

 

echo "<b><center>Database Output</center></b><br><br>";

 

?>

<table border="0" cellspacing="2" cellpadding="2">

<tr>

<th><font face="Arial, Helvetica, sans-serif">Invoice Number</font></th>

<th><font face="Arial, Helvetica, sans-serif">Name</font></th>

<th><font face="Arial, Helvetica, sans-serif">Phone</font></th>

<th><font face="Arial, Helvetica, sans-serif">Mobile</font></th>

<th><font face="Arial, Helvetica, sans-serif">Fax</font></th>

<th><font face="Arial, Helvetica, sans-serif">E-mail</font></th>

<th><font face="Arial, Helvetica, sans-serif">Website</font></th>

</tr>

 

<?

$i=0;

while ($i < $num) {

$Invoice_Number=mysql_result($result,$i,"Invoice_Number");

$first=mysql_result($result,$i,"first");

$last=mysql_result($result,$i,"last");

$phone=mysql_result($result,$i,"phone");

$mobile=mysql_result($result,$i,"mobile");

$fax=mysql_result($result,$i,"fax");

$email=mysql_result($result,$i,"email");

$web=mysql_result($result,$i,"web");

?>

 

<tr>

<td><font face="Arial, Helvetica, sans-serif"><? echo "$Invoice_Number"; ?></font></td>

<td><font face="Arial, Helvetica, sans-serif"><? echo "$first $last"; ?></font></td>

<td><font face="Arial, Helvetica, sans-serif"><? echo "$phone"; ?></font></td>

<td><font face="Arial, Helvetica, sans-serif"><? echo "$mobile"; ?></font></td>

<td><font face="Arial, Helvetica, sans-serif"><? echo "$fax"; ?></font></td>

<td><font face="Arial, Helvetica, sans-serif"><a href="mailto:<? echo "$email"; ?>">E-mail</a></font></td>

<td><font face="Arial, Helvetica, sans-serif"><a href="<? echo "$web"; ?>">Website</a></font></td>

</tr>

<?

++$i;

}

echo "</table>";

 

 

?>

Hello,

Sorry this is delayed.

 

Note: I changed your code a bit to make it better. Have added a edit link, which goes to editinvoice.php passing its invoice number. You just need to GET the id on this file and you can use it for your query.

 

 
<?
include("dbinfo.inc.php");
mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

echo "<b><center>Database Output</center></b><br><br>";
?>

<table border="0" cellspacing="2" cellpadding="2">
 <tr>
<th><font face="Arial, Helvetica, sans-serif">Invoice Number</font></th>
<th><font face="Arial, Helvetica, sans-serif">Name</font></th>
<th><font face="Arial, Helvetica, sans-serif">Phone</font></th>
<th><font face="Arial, Helvetica, sans-serif">Mobile</font></th>
<th><font face="Arial, Helvetica, sans-serif">Fax</font></th>
<th><font face="Arial, Helvetica, sans-serif">E-mail</font></th>
<th><font face="Arial, Helvetica, sans-serif">Website</font></th>
<th> </th>
 </tr>
 
 <?
	$query="SELECT * FROM contacts";
	$result=mysql_query($query);
	
	while ( $rows = mysql_fetch_assoc($result) ) {
 ?>
 
 <tr>
<td><font face="Arial, Helvetica, sans-serif"><? echo $rows['Invoice_Number'];?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $rows['first'];?> <?=$rows['last'];?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $rows['phone'];?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $rows['mobile'];?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo $rows['fax'];?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="mailto:<? echo $rows['email'];?>">E-mail</a></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="<? echo $rows['web'];?>">Website</a></font></td>
<td><font face="Arial, Helvetica, sans-serif"><a href="editinvoice.php?id=<? echo $rows['Invoice_Number'];?>">Edit Invoice</a></font></td>
 </tr>
<?
	}
?>
</table>

ATOMIC Web Hosting 2007 - 2011

Shared Hosting - Reseller Hosting - Dedicated Servers - Virtual Private Servers (Request Dedicated/VPS Servers via E-mail)

E-mail: sales@atomicwebhosting.com Website: http://www.atomicwebhosting.com/

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.