[PHP] Re: query error
pete M wrote: 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 Try like 'Advent Tower PC\\C\\freeserve\\help\\images\\%' Free cPanel Web Hosting http://hostwindow.info/web-hosting/2/free-cpanel-web-hosting/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Query/Error
Anthony, I find it is useful to write code such that every outcome, however remote, is handled by your code: $query = "INSERT INTO ... blah "; // pconnect, select and query if ($link_identifier = mysql_pconnect(DBSERVERHOST, DBUSERNAME, DBPASSWORD)) { if ( mysql_select_db(DBNAME, $link_identifier)) { // run the query $queryResultHandle = mysql_query($query, $link_identifier) or die( mysql_error() ); $rows = mysql_affected_rows($link_identifier); // decide what to do with the results switch( $rows ) { case 0: echo"Count for rows inserted is zero. No data was changed.\n"; break; case 1: // do something break; default: echo"Process anomaly. Notify the webmaster.\n"; } // switch( $rows ) { }else{ // select echo mysql_error(); } }else{ //pconnect echo mysql_error(); } The $rows handling will vary depending on the nature of your query: mysql_num_rows() mysql_affected_rows() Kind Regards, Richard Creech [EMAIL PROTECTED] 250.744.3350 Pacific Time Canada Dreamriver Software Powers the Net http://www.dreamriver.com } Anthony wrote: Message-Id: <[EMAIL PROTECTED]> Date: Fri, 17 May 2002 05:35:51 -0400 To: [EMAIL PROTECTED] From: Anthony Rodriguez <[EMAIL PROTECTED]> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Query/Error What code can I add to the script to find out the error of the query? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php