Jump to content

[SOLVED] record count on jump to menu


yukafluck

Recommended Posts

I have a piece of code that generates a jump to menu, using a group by query.  What I would like to do is be able to have it shows the number of records for each options.

 

right now the option for 2009 would show "2009", I would like it to show: "2009 (3)".

 

Here is the code that I have:

<form name="Year" id="Year">

<select name="YearMenu" onchange="MM_jumpMenu('parent',this,0)">

  <option selected="selected">Choose</option>

   

        <?php

  include_once "_functions/db_info.php";

  //connect to database

$dbserver = mysql_connect($hostname, $dbuser, $dbpswd);

$connection = $dbserver or die ('I cannot connect to the server');

mysql_select_db ($dbname) or die ('I cannot connect to the database');

  $sqlGetVehicleYear="SELECT *  FROM vehicles GROUP BY vehicle_year DESC; ";

  $sqlGetVehicleYearRes = mysql_query($sqlGetVehicleYear,$connection) or die ("could not connect to  sqlGetVehicleYear ");

While ($row = mysql_fetch_array($sqlGetVehicleYearRes))

{

$vehicle_year=$row["vehicle_year"]; 

  ?>

             

            <option value="vehicles_list.php?makenarrow=%&yearnarrow=<?php echo $vehicle_year ?>"><?php echo $vehicle_year ?></option>

 

      <?php }?>

  </select>

    </form>

[code=php:0]

 

Any help would be greatly appreciated

 

Link to comment
https://forums.phpfreaks.com/topic/160062-solved-record-count-on-jump-to-menu/
Share on other sites

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.