Solved

How do you echo back a database table?

Posted on 2008-10-02
2
195 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
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 50 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

813 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now