Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > using html to position results

Reply
Thread Tools

using html to position results

 
 
patrick_woflian
Guest
Posts: n/a
 
      03-12-2006
Hey, i have set up a website which allows users to search for other
members. This code is in php and works fine, however.. to make the
layout more attractive i was thinking of using html code segments to
position the results in a table for example. Here is the php code, any
ideas how to make the layout more attractive????

<?php
$connection = mysql_connect("sentinel.cs.cf.ac.uk","scm5sjc",
"MyPasswordGoesHere");

mysql_select_db("sjcdb",$connection) or die("failed!");

$result = mysql_query("SELECT * FROM info", $connection);

while($row = mysql_fetch_row($result)) {

$title = $row[1];
$first = $row[2];
$last = $row[3];
$age = $row[4];
$subject = $row[5];
$initial=$row[6];
$email=$row[7];

for ($i=0; $i<mysql_num_fields($result); $i++) print $row[$i]." ";
echo "\n";
print $title." ";
print $first_name." ";
print $last_name ." ";
print $age ." ";
print $subject." ";
print $initial." ";
print $email." ";

}

mysql_close($connection);
?>

Cheers
Steven

 
Reply With Quote
 
 
 
 
Jim Moe
Guest
Posts: n/a
 
      03-12-2006
patrick_woflian wrote:
> Hey, i have set up a website which allows users to search for other
> members. This code is in php and works fine, however.. to make the
> layout more attractive i was thinking of using html code segments to
> position the results in a table for example. Here is the php code, any
> ideas how to make the layout more attractive????
>

You're just kidding, right???? How are we to view this table without
PHP???? Or Mysql???? Or database access???? Or the data in the database????
Post an URL showing your test case.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
 
Reply With Quote
 
 
 
 
Toby Inkster
Guest
Posts: n/a
 
      03-12-2006
patrick_woflian wrote:

> Hey, i have set up a website which allows users to search for other
> members. This code is in php and works fine, however.. to make the
> layout more attractive i was thinking of using html code segments to
> position the results in a table for example.


How about something like this?

print "<table>\n";
while ($row = mysql_fetch_row($result))
{
$class = ($class=='a')?'b':'a';
$line = implode('</td><td>', $row);
$line = "<tr class=\"$class\"><td>$line</td></tr>\n";
}
print "</table>\n";

with this:

<style type="text/css">
TABLE { border: 2px solid; border-collpase: collapse; }
TR.a TD { color: black; background: #eee; border: 1px solid; }
TR.c TD { color: black; background: #ffd; border: 1px solid; }
</style>

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
Toby Inkster
Guest
Posts: n/a
 
      03-12-2006
Toby Inkster wrote:

> TR.c TD

^^^ b

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      03-12-2006
Toby Inkster wrote:
<snip>
> How about something like this?
>
> print "<table>\n";
> while ($row = mysql_fetch_row($result))
> {
> $class = ($class=='a')?'b':'a';
> $line = implode('</td><td>', $row);
> $line = "<tr class=\"$class\"><td>$line</td></tr>\n";

print $line;
> }
> print "</table>\n";
>
> with this:
>
> <style type="text/css">
> TABLE { border: 2px solid; border-collpase: collapse; }
> TR.a TD { color: black; background: #eee; border: 1px solid; }

<strike> TR.c TD { color: black; background: #ffd; border: 1px solid;
}</strike>
TR.b TD { color: black; background: #ffd; border: 1px solid; }
> </style>
>


Small tweaks


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using ajax call to fetch multiple results from multiple queries and showing them 1 by 1 as the results comes. Biranchi Narayan Panda ASP .Net 0 02-21-2010 03:46 PM
detecting mouse click position in canvas tag has position off James Black Javascript 0 05-28-2006 03:27 AM
Where is Form Relative Position and Absolute Position in VS.Net 2005 ? Luqman ASP .Net 1 02-07-2006 10:27 AM
position image based on document position edouard.lauer@pt.lu Javascript 3 01-14-2006 06:04 PM
How to set position of a web control depending on other control's position at run-time? James Wong ASP .Net Web Controls 4 07-14-2004 10:24 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57