j152 Posted June 20, 2008 Share Posted June 20, 2008 I understand how to create an .html form that processes via a .php script to display a mysql database, but what I'm seeking is an online tutorial or a brief explanation of a command that I can use to make the mysql database automatically display whenever I visit a certain web page. Instead of creating an .html page, would the webpage have to be a .php page that runs and displays information while also automatically formatting it on screen with my header and footer? And in order to display the correct row, would it have to be based on a user's cookie / session info? I think I'm on the right track, but any tips that might get me going in the right direction would be greatly appreciated. Thanks! Quote Link to comment Share on other sites More sharing options...
scarhand Posted June 20, 2008 Share Posted June 20, 2008 using php: $dbhost = 'localhost'; $dbuser = 'username'; $dbpass = 'password'; $maindb = 'databasename'; mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($maindb); $sql = 'SELECT * FROM column'; $sqlresult = mysql_query($sql); while ($row = mysql_fetch_array($sqlresult)) { $variable = $row['item']; echo $variable; } Quote Link to comment 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.