?
Solved

How do you echo back a database table?

Posted on 2008-10-02
2
Medium Priority
?
198 Views
Last Modified: 2013-12-12
I cant rember how to echo back a table in my database, evertime i echo a collum it goes like this ..  entry1entry2, with no breaks, everytime i try to put a break in, its messes it up.
0
Comment
Question by:Lee-Bartlett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:Lee-Bartlett
ID: 22629497
I got it kind of working so far with the code below, how would i wrap it in a table so there is atleast spacing between the entries
<?php  require_once("includes/db_connection.php"); ?>
 
 
<?php
 
$sql = "SELECT * from tblbasicform";
$res = mysql_query($sql) or die(mysql_error());
 
 
while($row = MYSQL_FETCH_ARRAY($res))
{
echo "$row[name]";
echo "$row[email]";
echo "$row[location]<br>";
}
 
 
?>

Open in new window

0
 
LVL 5

Accepted Solution

by:
jericotolentino earned 200 total points
ID: 22631050
How do you want your output to look like? Something like the one below?
echo '<table>';
 
while($row = MYSQL_FETCH_ARRAY($res))
{
echo '<tr>';
echo "<td>$row[name]</td>";
echo "<td>$row[email]</td>";
echo "<td>$row[location]</td>";
echo '</tr>';
}
 
</table>

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question