Help with my site, PHP Menu items and links

Hi People.

I have a site that runs joomla, http://www.airfieldcards.com and would like to move away from Joomla because, every time I add an airfield card. I have to duplicate the work in Joomla to make a menu item.

I would like the menu to be dynamically driven in php.

I have this code to fetch the airfield names from the database.

[php] <?php include(“db_connect.php”);
$users_sql = “SELECT * FROM users ORDER by username”;
$users_query = mysql_query($users_sql) or die (mysql_error());
$rsUsers = mysql_fetch_assoc ($users_query);

//$id = ( !isset ( $id ) ) ? ( int ) $_GET [ “user_id” ] : $id ;

?>

Airfields By Name

<?php do {

?>

  • <?php echo $rsUsers ['username']; ?>
  • <?php } while ($rsUsers = mysql_fetch_assoc ($users_query)); ?>[/php]

    How do I make a click even on one of the menu items so that the correct card shows up in the “right hand” part of the webpage. For example, when I click on Abbotts Bromley, the card’s ID that should show up is “67”

    First of all Joomla offers (both native and through plugins) support for dynamic menus
    https://docs.joomla.org/Dynamic_Menus

    [hr]

    Second, you should not be using mysql_* functions, your site is vulnerable to sql injection which means a malicous user will at least be able to read everything in all databases the current user has access to. Look into parameterized queries using either mysqli or pdo.

    [hr]

    It can be implemented in lots of ways. Preferably by passing the id in the url (yoursite.com/card/). At that url you check if the id exists, if not then you present a 404, if it does you present it using a template.

    Or you can employ JS/Ajax to show it dynamically without page refreshes.

    Sponsor our Newsletter | Privacy Policy | Terms of Service