[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

How do you echo back a database table?

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
Lee-Bartlett
Asked:
Lee-Bartlett
1 Solution
 
Lee-BartlettAuthor Commented:
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
 
jericotolentinoCommented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now