Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

tabular query display
Wondering if anyone is aware of php source out there that takes an SQL
Query, displays the results in tabular fashion (i.e. there is likely more
than one record returned by the query) allowing the user to then pick which
row from that he wants by simply clicking upon it (i.e. it can return the
key value for a given row).

Anyone aware of anything like this? THanks, Ike



Report this thread to moderator Post Follow-up to this message
Old Post
Ike
09-22-04 01:58 PM


Re: tabular query display
Ike wrote:

> Wondering if anyone is aware of php source out there that takes an SQL
> Query, displays the results in tabular fashion (i.e. there is likely more
> than one record returned by the query) allowing the user to then pick
> which row from that he wants by simply clicking upon it (i.e. it can
> return the key value for a given row).
>
> Anyone aware of anything like this? THanks, Ike

phplens seems to be waht you're looking for - note that it's commercial
software.

There's also an editable table at phpclasses (can't remember the name of the
project).

Or there's a table class at http://exorsus.net/software/ but last time I
looked the developer was looking for payment before publishing any docs.

HTH

C.

Report this thread to moderator Post Follow-up to this message
Old Post
Colin McKinnon
09-22-04 08:56 PM


Re: tabular query display
Ike wrote:
> Wondering if anyone is aware of php source out there that takes an SQL
> Query, displays the results in tabular fashion (i.e. there is likely more
> than one record returned by the query) allowing the user to then pick whic
h
> row from that he wants by simply clicking upon it (i.e. it can return the
> key value for a given row).
>
> Anyone aware of anything like this? THanks, Ike
>
>
I may have misunderstood (in which case, apologies!), but can't you do
the query, iterate thru' all the rows to create a table and include a
link which displays just that row's information?

An example using an imaginary users table in a MySQL database (the
theory's sound for all dbms's - I can just remember the syntax for MySQL
more easily :-) :

---------start of php-----------------
<?php
//Query the db for info (in this case username and id - could be more
complex)
$sql = "SELECT userid, username FROM users;";
$result = mysql_query($sql) or die(mysql_error());

//Create the start of the table
?>
<table>
<tr>
<td>User ID</td>
<td>Username</td>
<td>Options</td>
</tr>
<?php
//Iterate thru the rows returned from the db
while ($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td>$row['userid']</td>"; //The user id
echo "<td>$row['username']</td>"; //the username
echo "<td>";
echo "<a href="".$_SERVER['PHP_SELF']."?showuserid=$row['userd']\">Show
this row</a>"; // This line would create a link for the appropriate
userid. 			echo "</td>";
echo "</tr>\n";
}

//Finish the table
echo "</table>\n";
?>
---------End of PHP----------------

Does that make any sense? The link will include the id for the
appropriate row (in this case, the userid) - you could use the variable
(in this case $_GET['showuserid'] or $showuserid if you've got
register_globals turned on) to query the db for more information about
that row/record.

Ed

Report this thread to moderator Post Follow-up to this message
Old Post
Ed Jones
09-23-04 01:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Language archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:19 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.