Ways to display remaining data columns.

Ways to display remaining data columns.

am 03.02.2007 21:56:22 von Chris Carter

Hi,

What I am trying to achieve is this,

From the results table, when the user clicks on the last column of the row
which has a label "Details" of a particular item. A pop up window opens and
has some description and contact number which comes from the database.

I have a database with 8 columns but at first I display only 6. And I give
an option of "Details" on each column. If user clicks on this the the
remaining 2 columns are displayed on a separate pop up window.

How to achieve this in php. The database is ready ( it wasnt tough, just two
columns added). Am even able to open the pop up window but now I want to
retrieve the remaining 2 columns. Here is the initial code :

mysql_connect(localhost,$user,$password);
@mysql_select_db($dbName ) or die( "Sorry But There Seems To Be A Problem
Connecting To The Database");

$query="SELECT * FROM table WHERE name = '$name' ORDER BY level ASC";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

$i=0;
while ($i < $num) {

$shopname=mysql_result($result,$i,"shopname");
$category=mysql_result($result,$i,"category");
$subcategory=mysql_result($result,$i,"subcategory");
$level=mysql_result($result,$i,"level");

echo "

$shopname
$category
$subcategory
$level
javascript:poptastic( Details
";
$i++;
}

What can be approaches to achieve this.

Many thanks in advance.

--
View this message in context: http://www.nabble.com/Ways-to-display-remaining-data-columns .-tf3167516.html#a8786800
Sent from the Php - Database mailing list archive at Nabble.com.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Ways to display remaining data columns.

am 04.02.2007 01:05:58 von Chris

my first idea is the following:

since i'm sure there must be any kind of primary key you could add a
simple link that opens in a new window and passes your primary key. a
script (the one in the new window) now gets the details from the database
the link might be something like the following: href='details.php?unique_id=123' target='_blank'>Details
but please make shure you check the submitted data before using it in a
query.....(think of sql injections......)
you might consider using a POST form instead of GET in order to make it
more secure i think it should also work with something like
target='_blank' but i'm not sure at the moment

i hope it helps.... and i hope i did not forget security issues ;)

Chris

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php