Jump to content

Recommended Posts

Hi People.

 

I am running a site which is mainly built around PHP but am using a joomla front end and I'm getting sick of it.

 

This is because every time a new record is added to the DB I have to manually add a link to the menu to make the "airfield card" visible.

 

What I am trying to do is build a DB driven menu.

 

Here is my code for my connection to the DB

 

<?php

$host = 'localhost';
$usr = "theusername";
$password = 'thepassword';
$db_name = 'thedbname';

//connect to database
mysql_connect ("$host","$usr","$password") or die ('Error During Connect:<br>'.mysql_error());
mysql_select_db ("$db_name") or die ('Error Selecting DB:<br>'.mysql_error());
?>

 

Here is my code that is supposed to show me a list of "airfields" from the 'users' DB and dynamically list the 'username' table contents.

 

 <?php include("db_connect.php");
$users_sql = "SELECT * FROM users";
$users_query = mysql_fetch_assoc(users_sql) or die (mysql_error());
$rsUsers = mysql_fetch_assoc ($users_query);

?>

<h2>News</h2>
    <div class="scroll">
           
      <h3>31st July 2012</h3>
      <p class="news">New HTML site created which has made the whole job of adding new airfields that much easier.  As soon as you submit an airfield it becomes visible.
      
      </div>
<li><a href="add.php">Add New Airfield</a></li>
<h2>Airfields</h2>
<ul>
<li><a href="alpha.php">Alpha</a></li>

<ul>
<?php do {
?>
<li><a href=""><?php echo $rsUsers ['username']; ?>	</a></li>
<?php	
} while ($rsUsers = mysql_fetch_assoc ($users_query));
?>
</ul>

<li><a href="bravo.php">Bravo</a></li>

 

However, all I am getting is a blank area on the site which is in a temporary home here

http://www.airfieldcards.com/vg_temp/add.php

 

Please can someone look at my code and tell me where I'm going wrong.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.