SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Jun 2000
    Location
    England
    Posts
    587
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    nav Menu's in PHP/SQL

    Hi, I understand how the whole php/sql thing works in the way of an overview.. I have a q for you though...

    I am going to be making a car delearship site in which the catalogue runs from a db much like the joke one in the SP tuorial..

    My question is how do you allkeep your navigational bars central ?

    Do you use PHP includes or do you store them in the db ?
    Wannabebig Bodybuilding
    Wannabebig Bodybuilding Forums - Wanna be bigger and stronger?
    At Large Nutrition - nutritional supplements

  2. #2
    SitePoint Member
    Join Date
    Jun 2001
    Location
    UK
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Depending on the stock size of the dealership, if there is a realtivly low number of products (i.e. 100 or so) it may be economical to create pure html files on a time period basis.

    This will rule out the overhead of include() files.

    -dibby

  3. #3
    SitePoint Addict kunal's Avatar
    Join Date
    Oct 2000
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    its always recommended to store all your information in a database when using one... the dbase is being used to create dynamicism [sp?] ... it helps to have a table for categories and store all of them in that.. and then cross link the ids with product... this way, its easier to make changes...

    as for building the menu's.. you could create them on the fly.. by extracting the values from a dbase..

    example :

    Code:
            echo "<select name=\"category\">
              <OPTION VALUE=\"0\">Select Category</OPTION>";
                $sql = "SELECT * FROM category ORDER BY id";
    	$result = mysql_query($sql);
    	if (!$result) {
    		echo "<OPTION VALUE=\"0\">ERROR</OPTION>\n";
    	}
    	while ($myrow = mysql_fetch_array($result) {
    		echo "<OPTION VALUE=\"$myrow[id]\">$myrow[category]</OPTION>\n";
    	}
    echo "</select>";

    hope this helps.
    Kunal
    Last edited by kunal; Jun 11, 2001 at 08:45.
    i dunno...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •