I figured out the problem....it was in my query statement "SELECT * FROM $table where DATE LIKE '$month%' ORDER BY DATE desc"
This works perfectly, but in the effort to achieve greatness (won't ever happen), is this the most efficient way? "Rick Emery" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Ron, > > This would indicate that $table was not set. Or that the table indicated in > $table does not exist. Print out $query; is it as you expected? > Enter the SELECT at the mysql command prompt: what is the result? > > -----Original Message----- > From: Allen, Ronald L CIV [mailto:[EMAIL PROTECTED]] > Sent: Thursday, April 04, 2002 8:41 AM > To: Rick Emery > Subject: RE: [PHP-DB] Database Sorting by date > > > The query fails when I try to look at a month it says "Query Failed" > > >Ronald L. Allen (MCSE NT, MCP, CCNA) > SR. LAN/WAN Administrator > >SFOR - Hungary, Croatia > >[EMAIL PROTECTED] > >[EMAIL PROTECTED] > >+36-82-500000 ext. 22580 > > DSN: 760-2000 > > > -----Original Message----- > From: Rick Emery [mailto:[EMAIL PROTECTED]] > Sent: Thursday, April 04, 2002 16:43 > To: 'Ron Allen'; [EMAIL PROTECTED] > Subject: RE: [PHP-DB] Database Sorting by date > > > Ron, > > What problem are you having? I'm looking at your code, and it's so clean, I > could eat off of it. My only suggestion would be that $month will NEVER == > "NULL". If you are testing for NULL, the test is: if ($month == NULL ) > > Second, $month will be assigned a value, so it will never be NULL either. > > BTW, what is in drop.inc? > > -----Original Message----- > From: Ron Allen [mailto:[EMAIL PROTECTED]] > Sent: Thursday, April 04, 2002 8:09 AM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] Database Sorting by date > > > Here is the problem I want to be able to view all or search through the > currency lists in the database by the month. Any help would be great!!! > > Here is the code > > <TABLE> > <FORM name="currency" METHOD=POST ACTION="testtest.php"> > <TR HEIGHT=20><TD COLSPAN="2"><FONT SIZE="+0" FACE="VERDANA"> <BR> <TR><TD > ALIGN=LEFT> <B>Select a CCSD:</B><BR><select name="month" > onChange="document.currency.submit()"> > <option value="NULL">SELECT > <option value="NULL">VIEW ALL > <option value="2002-03">March 2002 > <option value="2002-04">April 2002 > <option value="2002-05">May 2002 > <option value="2002-06">June 2002 > <option value="2002-07">July 2002 > <option value="2002-08">August 2002 > <option value="2002-09">September 2002 > <option value="2002-10">October 2002 > <option value="2002-11">November 2002 > <option value="2002-12">December 2002 > </TD></tr> > </table> > <? > > > include '..\drop.php'; > $DBName = "currency"; > $table = "currency"; > > > $db = mysql_connect("$DBhost","$DBuser","$DBpass") or die("Problem > connecting"); > mysql_select_db("$DBName") or die("Problem selecting database"); if ($month > == "NULL"){ $query = "SELECT * FROM $table"; $result = mysql_query($query) > or die ("Query failed"); //let's get the number of rows in our result so we > can use it in a for loop $numofrows = mysql_num_rows($result); } else { > $query = "SELECT * FROM $table where DATE = preg_match(Y-m,'$month')) ORDER > BY DATE"; $result = mysql_query($query) or die ("Query failed"); //let's get > the number of rows in our result so we can use it in a for loop $numofrows = > mysql_num_rows($result); } > > ?> > > <? > echo "<TABLE BORDER=\"1\">\n"; > echo "<TR > bgcolor=\"#709fff\"><TD><center><b>DATE</b></center></TD><TD><center><b>EURO > </b></center></TD><TD><center><b>EURO > RECONVERSION</b></center></TD><TD><center><b>KM</b></center></TD><TD><center > ><b>KM > RECONVERSION</b></center></TD><TD><center><b>HUF</b></center></TD><TD><cente > r><b>KUNA</b></center></TD></TR>\n"; > for($i = 0; $i < $numofrows; $i++) { > $row = mysql_fetch_array($result); //get a row from our result set > if($i % 2) { //this means if there is a remainder > echo "<TR bgcolor=\"#d3d3d3\">\n"; > } else { //if there isn't a remainder we will do the else > echo "<TR bgcolor=\"#f0f0f0\">\n"; > } > echo > "<TD>".$row['DATE']."</TD><TD>".$row['EURO']."</TD><TD>".$row['EURORECON']." > </TD><TD>".$row['KM']."</TD><TD>".$row['KMRECON']."</TD><TD>".$row['HUF']."< > /TD><TD>".$row['KUNA']."</TD>\n"; > echo "</TR>\n"; > } > //now let's close the table and be done with it > echo "</TABLE>\n"; > ?> > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php