Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 4th, 2007, 03:42 AM
Authorized User
 
Join Date: Dec 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default how do I insert a toolbar in a table

Hi!
I've got a listing from a mysql-database that I've inserted into a table.
Code:
echo "<table border='1' bordercolor='#FFAA2A' bgcolor='#FFFFD4' cellspacing='0' cellpadding='3'>";
echo "<tr bgcolor='#C4E7C9'><td>Typ</td><td>Pris</td><td>Antal/förp</td><td>Lager</td></tr>";
# Hämtar all info från artikel
$artikel = mysql_query("SELECT * FROM artikel") or die(mysql_error());
while($row = mysql_fetch_array( $artikel ))
    {
        #skriver ut innehÃ¥ller radvis
        echo "<tr><td>"; 
        echo $row['typ'];
        echo "</td><td>";
        echo $row['pris'];
        echo "</td><td>";
        echo $row['antal'];
        echo "</td><td>";
        echo $row['lager'];
        echo "</td></tr>"; 
    }
What I want is that a "toolbox" is inserted after each row in its own column after "lager". The toolbox includes atleast two items, one edit button and one delete (images 12x12).
When I click edit I want to link to a new page where I edit the post, and pressing delete will also link to another page. So I must link each edit-button to a specific row, and the transfer that row to another page.

Can anyone help me with this?
I think I know how to solve most things execpt the essential connection with the buttons and rows.

Thanks in advance!!
/Hylsan

 
Old January 5th, 2007, 05:16 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

hi Hylsan,
I think following code will help you, if not please explain what is your expectation?

echo "<table border='1' bordercolor='#FFAA2A' bgcolor='#FFFFD4' cellspacing='0' cellpadding='3'>";
echo "<tr bgcolor='#C4E7C9'><td>Typ</td><td>Pris</td><td>Antal/förp</td><td>Lager</td><td colspan="2">toolbox</td></tr>";
# Hämtar all info från artikel
$artikel = mysql_query("SELECT * FROM artikel") or die(mysql_error());
while($row = mysql_fetch_array( $artikel ))
    {
        #skriver ut innehÃ¥ller radvis
        echo "<tr><td>";
        echo $row['typ'];
        echo "</td><td>";
        echo $row['pris'];
        echo "</td><td>";
        echo $row['antal'];
        echo "</td><td>";
        echo $row['lager'];
        echo "</td><td><img src='images/edit.gif'>";
        echo "</td><td><img src='images/delete.gif'>";
        echo "</td></tr>";
    }


surendran
(Anything is Possible)
http://ssuren.spaces.msn.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert table records into another table. hewstone999 Access VBA 2 March 5th, 2008 11:01 AM
insert value into multiple table AzlanAziz SQL Language 5 January 12th, 2007 06:01 AM
Can't INSERT into database's table ! kanenas.net SQL Language 2 August 10th, 2006 07:37 AM
insert rows into the same table nik SQL Server 2000 1 October 26th, 2005 07:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.