Jump to content

Tutorial on Getting Mysql to display automatically...?


j152

Recommended Posts

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!

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;
    }

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.