justinbriggs1 Posted November 12, 2008 Share Posted November 12, 2008 Hello everyone,I'm trying to figure out how I can manipulate my database queries to look nice on the screen. Here is what I am doing:1. PHP - Query a database for a record and store the values in an array.2. HTML & CSS - Format and place the values so it looks nice on the screenCan you pass PHP variables to HTML on the same page? Link to comment Share on other sites More sharing options...
jeffman Posted November 12, 2008 Share Posted November 12, 2008 That's pretty much the point of PHP. Any basic tutorial will show you how. Link to comment Share on other sites More sharing options...
jlhaslip Posted November 13, 2008 Share Posted November 13, 2008 Use PHP to write the HTML and data to your page. That is what PHP does best, deal with dynamic Data. Link to comment Share on other sites More sharing options...
justinbriggs1 Posted November 13, 2008 Author Share Posted November 13, 2008 Hello everyone,I'm trying to figure out how I can manipulate my database queries to look nice on the screen. Here is what I am doing:1. PHP - Query a database for a record and store the values in an array.2. HTML & CSS - Format and place the values so it looks nice on the screenCan you pass PHP variables to HTML on the same page?I've been looking at tutorials but I can't seem to find the answer. Here's sample code:<?phpinclude "config.php";$result = mysql_query("SELECT * FROM news");while($row = mysql_fetch_array($result)) { $test = $row['title']; }?><html>What kind of HTML do I use here to display $test? </html> Link to comment Share on other sites More sharing options...
jlhaslip Posted November 13, 2008 Share Posted November 13, 2008 <html><body><table><?phpinclude "config.php";$result = mysql_query("SELECT * FROM news");echo '<tr>';while($row = mysql_fetch_array($result)){$test = $row['title'];echo '<td>Test:' . $test . '</td>';}echo '</tr>';?></table></body></html> Link to comment Share on other sites More sharing options...
justinbriggs1 Posted November 13, 2008 Author Share Posted November 13, 2008 <html><body><table><?phpinclude "config.php";$result = mysql_query("SELECT * FROM news");echo '<tr>';while($row = mysql_fetch_array($result)){$test = $row['title'];echo '<td>Test:' . $test . '</td>';}echo '</tr>';?></table></body></html> Ooooooooooooooohhhhhhhhhhhhhhhh...didn't think of that! Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.