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]
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]
RE: [PHP-DB] About Berkeley DB2 Databases
Thanks for the clarification of --with-db2 vs. --with-ibm-db2 ... silly me! To list your libraries: ldconfig -p Cheers, Lorenzo -Original Message- From: Ricardo Núñez Sent: Wed 11/14/2001 3:56 PM To: Pierre-Alain Joye Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] About Berkeley DB2 Databases Mensaje citado por: Pierre-Alain Joye <[EMAIL PROTECTED]>: > > I just put '--with-db2'. I suppose it compiled its Berkeley db2 code. > Other thing, I use PHP 4.0.6. > > > me too ;) but php not... every others tools on my station recognizes the > db,db2 and db3 support, php not. > > Which lib do you have ? any link ? (or email :) > No problem, but... I don't remember the command to list the libraries... What's the command? What if I send you a 'rpm -qa'? > pa > > -- > 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] > > Saludos, Ing. Ricardo Núñez Webmaster de la DST Universidad Simón BolÃvar 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] About Berkeley DB2 Databases
I thought '--with-db2' meant you'd get a DB2 (IBM) driver... what has DB2 got to do with Berkeley? An I suffering a bit of confusion between IBM's DB2 product, and Berkeley database tables, and PHP's support of these? -Lorenzo -Original Message- From: Ricardo Núñez Sent: Wed 11/14/2001 2:21 PM To: [EMAIL PROTECTED] Cc: Subject: [PHP-DB] About Berkeley DB2 Databases Hello, I read a paper about Berkeley DB2 databases and I have a few doubts about PHP db2 support I compiled my php with "--with-db2" option... 1) How can I create a Berkeley db2 database with the "Berkeley DB Concurrent Access Method" I want. Let's say... a B+Tree ... or hash method. USING php. 2) How can I use structured data (like objects) as values of a Berkeley database USING php (I read http://www.dst.usb.ve/manuales/php-eng/function.dba-insert.html function, but it assumes only a string). Thank you very much, Ricardo Núñez [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] SQL query
> Thanks but I think subselect is not possible with MYSQL. You're right. Here's a MySQL compatible alternative: SELECT table1.* FROM table1 LEFT JOIN table2 ON table1.id=table2.id where table2.id IS NULL From the MySQL manual on sub-selects at: http://www.mysql.com/doc/A/N/ANSI_diff_Sub-selects.html -Original Message- From: Pierre Sent: Mon 11/12/2001 12:20 AM To: Gonzalez, Lorenzo; [EMAIL PROTECTED] Cc: Subject: Re: [PHP-DB] SQL query Thanks but I think subselect is not possible with MYSQL. Pierre - Original Message - From: Gonzalez, Lorenzo <[EMAIL PROTECTED]> To: Pierre <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, November 12, 2001 1:08 PM Subject: RE: [PHP-DB] SQL query > in other RDBMs this is easily done with a subselect - don't know if it's > doable in MySQL or not, someone else can confirm, or you can try it > yourself... > > select * from table1 where table1.id not in (select table2.id); > > -Lorenzo > > -Original Message- > From: Pierre > Sent: Sun 11/11/2001 10:01 PM > To: [EMAIL PROTECTED] > Cc: > Subject: [PHP-DB] SQL query > > > > I have two tables, one call category, the other chapter > > Category table > [id][name] > [1][a] > [2][b] > [3][c] > [4][d] > > Chapter table > [id][FK_name] > [1][a] > [2][a] > [3][c] > > > I would like to get the list of names of the Category table that > are NOT present in the Chapter table. > On this example, I should find "b" and "d". > > Is it possible to get it directly from a SQL query ? (I am using > MYSQL). > > Thank for helping me. > > Pierre > > >
RE: [PHP-DB] SQL query
in other RDBMs this is easily done with a subselect - don't know if it's doable in MySQL or not, someone else can confirm, or you can try it yourself... select * from table1 where table1.id not in (select table2.id); -Lorenzo -Original Message- From: Pierre Sent: Sun 11/11/2001 10:01 PM To: [EMAIL PROTECTED] Cc: Subject: [PHP-DB] SQL query I have two tables, one call category, the other chapter Category table [id][name] [1][a] [2][b] [3][c] [4][d] Chapter table [id][FK_name] [1][a] [2][a] [3][c] I would like to get the list of names of the Category table that are NOT present in the Chapter table. On this example, I should find "b" and "d". Is it possible to get it directly from a SQL query ? (I am using MYSQL). Thank for helping me. Pierre
RE: [PHP-DB] searching for zipcode: where to start?
full-text index that field in MySQL, - then query ordered by weight with a limit 3. Wonderful stuff. -Original Message- From: dean james Sent: Sat 11/10/2001 7:27 PM To: [EMAIL PROTECTED] Cc: Subject: [PHP-DB] searching for zipcode: where to start? hello, I want to create a database search with php/mysql that searches for zipcodes in a database. of course, there will be other columns/tables and such to be printed, but I only want to search for the zipcodes and have the other cells printed if the following criteria are found: lets say I search for the zipcode 90232...it would return like so 1. search returns 3 closest matches John Doe 90232 Red Corvette Mary Jones 90235 Silver Camaro Peter Gooding 90065 Blue Honda et -> the search will generate only "3" returns...either 3 exact matches, in this case 90232 or (1, or 2) and the closestBasically the search will ALWAYS return 3 results, either exact matches or closest matches..any combination..so every entry in the database is a potential match...just the 3 closest what is the best way to go about doing this? _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- 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] XML coming out from MySQL
I've never parsed XML with PHP, but it might help if you can show the document that's breaking the parser, and also let us know if other documents are working fine... -Lorenzo -Original Message- From: Tomas Garcia Ferrari Sent: Fri 11/9/2001 5:14 PM To: [EMAIL PROTECTED] Cc: Subject: [PHP-DB] XML coming out from MySQL Hello, I'm trying to parse an XML file stored on MySQL. I'm using this code: > global $CFG, $ME; > > $qid = db_query(" > SELECT texto > FROM articulos > WHERE id = $id > "); > > $r = db_fetch_object($qid); > $file = $r->texto; > > > $map_array = array( > "ARTICULO" => "", > "VOLANTA" => "h2", > "TITULO" => "h1", > "SUBTITULO" => "h3", > "BAJADA" => "h2", > "PARRAFO" => "p", > "AUTOR" => "h3", > "URL" => "h3", > "COPY" => "h3" > ); > > function startElement($parser, $name, $attrs) { > global $map_array; > if ($htmltag = $map_array[$name]) { > print "<$htmltag>"; > } > } > > function endElement($parser, $name) { > global $map_array; > if ($htmltag = $map_array[$name]) { > print ""; > } > } > > function characterData($parser, $data) { > print $data; > } > > $xml_parser = xml_parser_create(); > // use case-folding so we are sure to find the tag in $map_array > xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, true); > xml_set_element_handler($xml_parser, "startElement", "endElement"); > xml_set_character_data_handler($xml_parser, "characterData"); > > while ($data = $file) { > if (!xml_parse($xml_parser, $data, 0)) { > die(sprintf("XML error: %s at line %d", > xml_error_string(xml_get_error_code($xml_parser)), > xml_get_current_line_number($xml_parser))); > } > } > xml_parser_free($xml_parser); > ?> and having this at the end of the outuput: > XML error: junk after document element at line 25 What does it mean? How can I solve it / trace it? Regards, Tomás +-- --+ Tomás García Ferrari Bigital http://bigital.com/ +-- --+ -- 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] Automatic JOIN
MySQL does not enforce foreign key relationships. So while I believe you can still do a natural/automatic join, the fieldnames and datatypes must match. -Lorenzo -Original Message- From: Carlo Loiudice Sent: Fri 11/9/2001 5:11 PM To: PHP DB Cc: Subject: [PHP-DB] Automatic JOIN Pardon, another question: Is there a way to say to Mysql to automatically detect a relation between 2 table and perform the join operation when there's a SELECT query ? I Hope this isn't a stupide question! But I've seen that in the detested MS Access, there a simple way so make a visual join between a field in a table with another field in another table. When there's a select on the 1st table, access automatically open the linked table and fetch the corresponding field. How to make this in mysql? Carlo, again __ Abbonati a Yahoo! ADSL con Atlanet! Naviga su Internet ad alta velocità, e senza limiti di tempo! Per saperne di più vai alla pagina http://adsl.yahoo.it -- 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] JOIN operations
select n.name, c.city, c.ID from table_name n, table_city c where c.ID = n.ID_city No sweat. -Lorenzo -Original Message- From: Carlo Loiudice Sent: Fri 11/9/2001 5:01 PM To: PHP DB Cc: Subject: [PHP-DB] JOIN operations Hi, I'm preforming a join between 2 Mysql tables in this way: table_name: ID,name,ID_city table_city: ID,city when I query this: "SELECT table_name.name,table_city.ID,table_city.city FROM table_name,table_city WHERE table_name.ID_city=table_city.ID" The result is a new table with this fields: result_table: name,city. There isn't the field table_name.ID_city!!! Here's the question: I need also this field ID_city because there's a function that builds a list box with all the cities, and search for a html hidden input named ID_city (like the table field) to eventually highlight that entry. can someone help me? is there a way to select also the ID_city field without break the join mechanism ? Carlo __ Abbonati a Yahoo! ADSL con Atlanet! Naviga su Internet ad alta velocità, e senza limiti di tempo! Per saperne di più vai alla pagina http://adsl.yahoo.it -- 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]