Jump to content

dlebowski

Members
  • Posts

    262
  • Joined

  • Last visited

About dlebowski

  • Birthday 08/10/1976

Profile Information

  • Gender
    Male
  • Location
    Nerdbraska

dlebowski's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Why won't this work? I get this error "Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';'" echo "<option value="$nt['YEAR(Date)']">$nt['YEAR(Date)']</option>";
  2. Thank you for the quick response. $date = $nt['date']; won't work because I am using YEAR(date) in my query. That is where I am running into the problem. Any other suggestions?
  3. I'm sure this is an easy one. Just can't seem to figure it out. I have this code that basically populates a dropdown box from the database. <?php include("dbinfo.inc.php"); mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "SELECT YEAR(Date) FROM auctions GROUP BY YEAR(Date)"; $result = mysql_query ($query); echo "<select name=Date>"; // printing the list box select command while($nt=mysql_fetch_array($result)) { //Array or records stored in $nt echo "<option value=$nt[YEAR(Date)]>$nt[YEAR(Date)]</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?> This portion of the code does not work. It won't populate the values. I know it's syntax. Any help would be appreciated! Thanks. echo "<option value=$nt[YEAR(Date)]>$nt[YEAR(Date)]</option>";
×
×
  • 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.