[thelist] Mysql - wont read first entry?

Anthony Baratta Anthony at Baratta.com
Tue Oct 31 10:49:10 CST 2000


I'm unclear with your code if you are using Perl or PHP. It looks Perlish enough, so
here's how I would do it:

  $db_query = "SELECT docId, docCat, docBusName, docAddress, docBusPhone, "; 
  $db_query .= "docDesc1, docDesc2, docDesc3, docState, docRegion, ";
  $db_query .= "docSuburb, docHits FROM tblDockets WHERE ";
  $db_query .= "docCat = '" . sqlEncode($form{'CATEGORY'})
  $db_query .= "' AND docState='" . sqlEncode($form{'STATE'})
  $db_query .= "'  ORDER BY docSuburb";

  my $db = &dbconnect;
  my $dbh=$db->prepare($db_query);
  $varReturnResult = $dbh->execute();

  if ($varReturnResult) 
     while (($docid, $category, $busname, $address, $phone, $desc1, 
             $desc2,$desc3,$state,$region,$suburb,$hits) = $dbh->fetchrow_array()) 
        @{$tempitemhash{$docid}} = ($docid, $category, $busname, $address, $phone,
        push (@itemorder, $docid);


Anthony Baratta
KeyBoard Jockeys
                    South Park Speaks Version 3 is here!!!
                              Powered by Tsunami

More information about the thelist mailing list