bchandel Posted August 26, 2009 Share Posted August 26, 2009 I want to find how to display data from a script on a page in 2 columns. Suppose I have the following script and if I want to display e-mail and web data in the second column, how I can do it? Thank you! <html> <head> <style type="text/css"> body{ background-color:#b0c4de; border-top:blue solid 50px; border-left:blue solid 50px; } </style> </head> <body> <?php $db_connect = mysql_connect("XXXX.com", "XXXX_user", "password"); mysql_select_db("XXXX_database"); $query="SELECT * FROM Directory"; $result=mysql_query($query); $num=mysql_num_rows($result); mysql_close(); Print "<h1>My Directory</h1>"; echo "<h3>Search Results: $num records found</h3>"; $i=0; while ($i < $num) { $Name=mysql_result($result,$i,"Name"); $LastName=mysql_result($result,$i,"LastName"); $FirstName=mysql_result($result,$i,"FirstName"); $LastName=mysql_result($result,$i,"LastName"); $Phone=mysql_result($result,$i,"Phone"); $Mobile=mysql_result($result,$i,"Mobile"); $Email=mysql_result($result,$i,"Email"); $Web=mysql_result($result,$i,"Web"); $State=mysql_result($result,$i,"State"); $Country=mysql_result($result,$i,"Country"); echo "<b>$Name</b><hr> First Name: $FirstName<br> Last Name: $LastName<br> Home Phone: $Phone<br> Mobile: $Mobile<br> Email: $Email<br> Web Site: $Web<br> State: $State<br> Country: $Country<br><hr>"; $i++; } ?> </body> </head> Quote Link to comment https://forums.phpfreaks.com/topic/171950-need-help-php-displaying-data-in-2-columns-thank-you/ Share on other sites More sharing options...
Absorbator Posted August 26, 2009 Share Posted August 26, 2009 Did you try tables? Quote Link to comment https://forums.phpfreaks.com/topic/171950-need-help-php-displaying-data-in-2-columns-thank-you/#findComment-906670 Share on other sites More sharing options...
bchandel Posted August 26, 2009 Author Share Posted August 26, 2009 Thank you for your message. I tried table to display data in usual form. I was wondering if there is better way to display date on a page dividing it in to 2 columns and then display say general information Name, Phone, Fax etc in one column and display say picture, e-mail and Web site picture in other column. This will be helpful to use most of the page area and have some needed prominent field data in the second column. I think we can style page using css style sheets and creating 2 div areas. Then only need to figure out how to display data from a script in a particular div areas. Is it possible to have multiple table on a page and display required data in them as desired. So say first table only have Name and Phone data and second table may have picture, e-mail and website fields data. Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/171950-need-help-php-displaying-data-in-2-columns-thank-you/#findComment-906757 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.