[PHP-DB] query error
I've got a database table with a whole list of windows file paths. eg Advent Tower PC\C\Program Files\Microsoft Office\Microsoft Binder.lnk Advent Tower PC\C\Program Files\Microsoft Office\Microsoft Excel.lnk Advent Tower PC\C\Program Files\Microsoft Office\Microsoft Office Setup.lnk Advent Tower PC\C\Program Files\Microsoft Office\Microsoft Outlook.lnk Advent Tower PC\C\Program Files\Microsoft Office\Microsoft PowerPoint.lnk Advent Tower PC\C\Program Files\Microsoft Office\Microsoft Word.lnk Advent Tower PC\C\Program Files\Microsoft Office\MS Access Workgroup Administrator.lnk Advent Tower PC\C\Program Files\Microsoft Office\MSCREATE.DIR Advent Tower PC\C\Program Files\Microsoft Office\OF97SPEC.INI Advent Tower PC\C\Program Files\Microsoft Office\Office Advent Tower PC\C\Program Files\Microsoft Office\Office\1033 Now I want my DB query to search for directories .. here's a sample query select * from ff_files where full_path like 'Advent Tower PC\C\freeserve\help\images\%' doesnt work as the % is taken as a literal '%' I've aslso tried like 'Advent Tower PC\\C\\freeserve\\help\\images\%' I'm completely lost .. all I want is to return all rows that start with 'Advent Tower PC\C\freeserve\help\images\' tia Pete -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: query error
I believe the \ preceding the last % makes it a literal % not the wildcard % pete M [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I've got a database table with a whole list of windows file paths. eg Advent Tower PC\C\Program Files\Microsoft Office\Microsoft Binder.lnk Advent Tower PC\C\Program Files\Microsoft Office\Microsoft Excel.lnk Advent Tower PC\C\Program Files\Microsoft Office\Microsoft Office Setup.lnk Advent Tower PC\C\Program Files\Microsoft Office\Microsoft Outlook.lnk Advent Tower PC\C\Program Files\Microsoft Office\Microsoft PowerPoint.lnk Advent Tower PC\C\Program Files\Microsoft Office\Microsoft Word.lnk Advent Tower PC\C\Program Files\Microsoft Office\MS Access Workgroup Administrator.lnk Advent Tower PC\C\Program Files\Microsoft Office\MSCREATE.DIR Advent Tower PC\C\Program Files\Microsoft Office\OF97SPEC.INI Advent Tower PC\C\Program Files\Microsoft Office\Office Advent Tower PC\C\Program Files\Microsoft Office\Office\1033 Now I want my DB query to search for directories .. here's a sample query select * from ff_files where full_path like 'Advent Tower PC\C\freeserve\help\images\%' doesnt work as the % is taken as a literal '%' I've aslso tried like 'Advent Tower PC\\C\\freeserve\\help\\images\%' I'm completely lost .. all I want is to return all rows that start with 'Advent Tower PC\C\freeserve\help\images\' tia Pete -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP and MySql question
Hello, I'm kinda new at PHP programming with MySQL. I am having an issue and am not sure if this is the corret way to do this: Here is my code, I'll start there: ?php $Lat1 = mysql_query( SELECT (ZG_LATITUDE-2) FROM zip_code where zg_zipcode = '$zip'); if (!$Lat1) { echo(PError performing query: . mysql_error() . /P); exit(); } $Lat2 = mysql_query( SELECT (ZG_LATITUDE+2) FROM zip_code where zg_zipcode = '$zip'); if (!$Lat2) { echo(PError performing query: . mysql_error() . /P); exit(); } $Lon1 = mysql_query( SELECT (ZG_LONGITUDE-2) FROM zip_code where zg_zipcode = '$zip'); if (!$Lon1) { echo(PError performing query: . mysql_error() . /P); exit(); } $Lon2 = mysql_query( SELECT (ZG_LONGITUDE+2) FROM zip_code where zg_zipcode = '$zip'); if (!$Lon2) { echo(PError performing query: . mysql_error() . /P); exit(); } $ZipCode = mysql_query( SELECT * FROM zip_code where ZG_LATITUDE = '$Lat1' and ZG_LATITUDE = '$Lat2' and ZG_LONGITUDE = '$Lon1' and ZG_LONGITUDE = '$Lon2'); if (!$Zipcodesearch) { echo(PError performing query: . mysql_error() . /P); exit(); } while ( $row = mysql_fetch_array($ZipCode) ) { echo(bCity: /b . $row[ZG_CITY]. br); echo(bState: /b . $row[ZG_STATE]. br); echo(bZip Code: /b . $row[ZG_ZIPCODE]. br); echo(bArea Code: /b . $row[ZG_AREACODE]. br); echo(bCounty FIPS: /b . $row[ZG_COUNTY_FIPS]. br); echo(bCounty Name: /b . $row[ZG_COUNTY_NAME]. br); echo(bTime Zone: /b . $row[ZG_TIME_ZONE]. br); echo(bDay Light Savings?: /b . $row[ZG_DST]. br); echo(bLatitude: /b . $row[ZG_LATITUDE]. br); echo(bLongitude: /b . $row[ZG_LONGITUDE]. P); } ? Basically I'm trying to have a user input a zip code and then have a php script pull all zip codes that are in a region of that submitted zip code. Can you have a look at my code and see what I'm doing wrong? When using this it returns no results but makes the connection to the database so I have to believe that it's within here that I have my issue. I have Apache/2.0.47 (Win32) PHP/4.3.9 Server and MySql 4.0.14 (I know I can upgrade and be able to do subselects but I would like to know what I'm doing wrong here. Thanks in advance for any help. Thanks -rich -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php