[PHP-DB] Converting text fields to integer in queries with ODBC connection to an MS Access file
Hi list, I wonder if anyone can help me out here. I'm pulling some data from an MS Access file using the ODBC driver provided with Windows NT 4.0 server (Option pack, and SP6a applied), and want to limit the result set with a where clause like this one: ... WHERE (PARTNUMBER 37010) AND (PARTNUMBER 5) Now - the problem here is that the PARTNUMBER field is defined as a text field in the access file (even though it holds only numbers), and since I'm not the one maintaining the access base, I can't change that. So I tried converting the field to an INTEGER field using the CONVERT() function in my query. But this function is not supported by the ODBC driver. Does anyone know how I can convert the value of as text field to an integer type field so I can do / clauses in my query? Any help will be greatly appreciated. Brgds, Christian -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Converting text fields to integer in queries with ODBC connection to an MS Access file
Lorenzo, That was a good suggestion (had forgotten about the between function) but unfortunately it still complains with the following error: Warning: SQL error: [Microsoft][ODBC Microsoft Access 97 Driver] Data type mismatch in criteria expression., SQL state 22005 in SQLExecDirect in test.php on line 6 What caused this error was this: WHERE PARTNUMBER.PARTNUMBER BETWEEN 37010 AND 5); So, any other suggestions on how I can circumvent this problem? Brgds, Christian -Original Message- From: Gonzalez, Lorenzo [mailto:[EMAIL PROTECTED]] Sent: 15. november 2001 14:57 To: Christian Sandfeld; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Converting text fields to integer in queries with ODBC connection to an MS Access file Some of the databases I work with would support this as 'between' on two text fields that are sortable alphabetically - I'd give that a try. -Lorenzo -Original Message- From: Christian Sandfeld Sent: Thu 11/15/2001 7:55 AM To: '[EMAIL PROTECTED]' Cc: Subject: [PHP-DB] Converting text fields to integer in queries with ODBC connection to an MS Access file Hi list, I wonder if anyone can help me out here. I'm pulling some data from an MS Access file using the ODBC driver provided with Windows NT 4.0 server (Option pack, and SP6a applied), and want to limit the result set with a where clause like this one: ... WHERE (PARTNUMBER 37010) AND (PARTNUMBER 5) Now - the problem here is that the PARTNUMBER field is defined as a text field in the access file (even though it holds only numbers), and since I'm not the one maintaining the access base, I can't change that. So I tried converting the field to an INTEGER field using the CONVERT() function in my query. But this function is not supported by the ODBC driver. Does anyone know how I can convert the value of as text field to an integer type field so I can do / clauses in my query? Any help will be greatly appreciated. Brgds, Christian -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Converting text fields to integer in queries with ODBC connection to an MS Access file
doh! ofcourse... that actually works. Thanks a bunch :) /Christian -Original Message- From: Gonzalez, Lorenzo [mailto:[EMAIL PROTECTED]] Sent: 15. november 2001 16:11 To: Christian Sandfeld; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Converting text fields to integer in queries with ODBC connection to an MS Access file Those aren't numbers remember, and need to be in single quotes. Even so, I'll be a bit surprised if this works against Access through ODBC... -Zo -Original Message- From: Christian Sandfeld Sent: Thu 11/15/2001 9:56 AM To: [EMAIL PROTECTED] Cc: Subject: RE: [PHP-DB] Converting text fields to integer in queries with ODBC connection to an MS Access file Lorenzo, That was a good suggestion (had forgotten about the between function) but unfortunately it still complains with the following error: Warning: SQL error: [Microsoft][ODBC Microsoft Access 97 Driver] Data type mismatch in criteria expression., SQL state 22005 in SQLExecDirect in test.php on line 6 What caused this error was this: WHERE PARTNUMBER.PARTNUMBER BETWEEN 37010 AND 5); So, any other suggestions on how I can circumvent this problem? Brgds, Christian -Original Message- From: Gonzalez, Lorenzo [mailto:[EMAIL PROTECTED]] Sent: 15. november 2001 14:57 To: Christian Sandfeld; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Converting text fields to integer in queries with ODBC connection to an MS Access file Some of the databases I work with would support this as 'between' on two text fields that are sortable alphabetically - I'd give that a try. -Lorenzo -Original Message- From: Christian Sandfeld Sent: Thu 11/15/2001 7:55 AM To: '[EMAIL PROTECTED]' Cc: Subject: [PHP-DB] Converting text fields to integer in queries with ODBC connection to an MS Access file Hi list, I wonder if anyone can help me out here. I'm pulling some data from an MS Access file using the ODBC driver provided with Windows NT 4.0 server (Option pack, and SP6a applied), and want to limit the result set with a where clause like this one: ... WHERE (PARTNUMBER 37010) AND (PARTNUMBER 5) Now - the problem here is that the PARTNUMBER field is defined as a text field in the access file (even though it holds only numbers), and since I'm not the one maintaining the access base, I can't change that. So I tried converting the field to an INTEGER field using the CONVERT() function in my query. But this function is not supported by the ODBC driver. Does anyone know how I can convert the value of as text field to an integer type field so I can do / clauses in my query? Any help will be greatly appreciated. Brgds, Christian -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] MySQL Error???
Brian, Sounds to me as if the field you have as primary key is set to type 'TINYINT'. TINYINT's 'signed' range accepts values from -128 to 127, when set to 'unsigned' it accepts values from 0 to 255. In your place I would concider changing that column to a 'SMALLINT' and set it to 'unsigned'. This will allow for values from 0 to 65535 (depending ofc. on how many digits you set as the max display size). Hope I helped :) /Christian -Original Message- From: Brian Grayless [mailto:[EMAIL PROTECTED]] Sent: 27. juni 2001 18:24 To: PHP DB list (E-mail) Subject: [PHP-DB] MySQL Error??? Is anyone familiar with this MySQL error? 1062: Duplicate entry '127' for key 1 I wrote a great bookmark management program that works fine, but everytime I insert bookmarks, I insert somewhere over 120 and I start getting this error, and it won't add them anymore. Any suggestions??? Thanks, B R I A N G R A Y L E S S Web Administrator Premier Resorts www.premier-resorts.com P: 435-655-4812 F: 413-618-1518 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] making queries
Yes, it's possible. What you do is write the var names and values after the page name as follows: a href=mylink.php?foo=barbar=fooclick my link/a This would call a script called mylink.php, initializing two vars, namely $foo (containing the value 'bar') and $bar (containing the value 'foo'). So, to pass info to a script using a link, call the script with a ? followed by varname=varvalue, and if you need to pass more info to the script, seperate the vars with a /Christian -Original Message- From: Andrew Aitken [mailto:[EMAIL PROTECTED]] Sent: 26. juni 2001 20:56 To: [EMAIL PROTECTED] Subject: [PHP-DB] making queries This is just a quick question. I'd like to no if it's possiable to make a normal link supply infromation to a page of PHP very much like a form and if so how? Thankyou for any help at all Andrew Aitken -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]