[PHP-DB] Exporting Access -> MySQL with a macro
I've set up a MySQL datasource on a Windows machine and it works - I have tested it. I want to export a table from Access to the datasource, and I have been able to do it manually. HOWEVER, NOW I am trying to do the same thing except via a macro, and Access is giving me trouble. It keep saying something about not finding an installable ISAM, and the help files seem to indicate that I need to specify a ODBC connection string in the field for Database Name. Can someone help me out here? - Jonathan (The mySQL database is used in my PHP application, so it's not totally off-topic) -- 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 alphabetical listing
At 2:37 PM -0700 9/18/01, Photocon wrote: >Heya all... > >I have a listing of last names in a table. I would like to get MySQL >to give me a result set of last names that began with a letter so >that in PHP I can put them into alpha order. I don't want a set of >all names, just those with one letter (the idea being I can then >have one letter per page), and I don't want to "select all" from the >whole table. Does anyone know how to do this, or am I going about it >the wrong way? >Thanks >--Photocon > >Conrad Hunziker III >www.nightskyent.com What, you mean like: SELECT last_name FROM tbl_name WHERE LEFT(last_name,1) = 'A' or something? If so, you don't need to have PHP put them in order. Just add ORDER BY last_name to the query. If you want to know which letters last names begin with in your table (so that you can, for example, avoid generating a page for 'X' if no names begin with that letter), do this: SELECT DISTINCT LEFT(last_name,1) AS letter FROM tbl_name ORDER BY letter -- Paul DuBois, [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] MySQL alphabetical listing
Heya all... I have a listing of last names in a table. I would like to get MySQL to give me a result set of last names that began with a letter so that in PHP I can put them into alpha order. I don't want a set of all names, just those with one letter (the idea being I can then have one letter per page), and I don't want to "select all" from the whole table. Does anyone know how to do this, or am I going about it the wrong way? Thanks --Photocon Conrad Hunziker III www.nightskyent.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] Cookies ???
instead of setting multiple cookies, why not start using seassions its dead easy with php4 and you can then do all your security stuff with sessions, much easier, much more secure etc - Original Message - From: "Rick Emery" <[EMAIL PROTECTED]> To: "'Jason Caldwell'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, September 17, 2001 6:29 PM Subject: RE: [PHP-DB] Cookies ??? > Q1. If you simply wish to READ the cookie from each web page, you need do > nothing. It is created atuomatically as a variable for you. For instance, > a cookie named > "mycookie" is available as $mycookie. > > Q2. The Cookie Path is the reference point on the web server. I creates a > context for the cookie. It allows the cookie to be read when a web page > comes from that specific directory. If you want it to be available from all > directories, use "/". > > Q3. The cookie can store multiple values that you concatenate together. > For instance, to store username/password: > setcookie( "cookiename", "$user#$password", time()+3600, "/", > ".mydomain.com" ); > Then, upon reading the cookie: list($user,$password) = explode( "#", > $cookiename ); > > > FYI...setcookie() has worked for me on IE 5.x and NN 5.x. > > -Original Message- > From: Jason Caldwell [mailto:[EMAIL PROTECTED]] > Sent: Monday, September 17, 2001 11:35 AM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] Cookies ??? > > > I've been reading the threads under SETCOOKIE (from php.net) -- some people > are saying that setcookie doesn't seem to work for all browsers all of the > time. Then some others go into how it seems to actually be the TIME format > (unix time vs. GMT time) -- > > Should I just stick to the HEADER version instead of setcookie? > > Also -- I'm not completely clear on how cookies work in the first place... > > Q1: When I set a cookie, is that cookie automatically called from *each* > page on my website? Or, do I need to add the HEADER to each page where I > want to call the cookie? > > Q2: The 'Cookie Path' -- is this the PATH on my websever -- someone please > explain what this is exactly, and how it works. > > Q3: The scenario I would like to use cookies in is to have users > automatically be logged in when they come to my home page... so I will need > to store the Username and Password in the cookie... should I store these in > an Array, or can I create multiple cookies -- in other words, a cookie can > only store one value, correct? So, I can use Serialize / Unserialize to > store Array information in my cookies? > > Thanks. > Jason > > > > > -- > 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] db's war
You might want to also check out Virtuoso http://www.openlinksw.com/virtuoso/ It's as scalable ast the 'cadillacs' and has expected features like triggers, foreign keys, and stored procedure support, and is considerably cheaper. It also has advanced XML, SOAP, and WebDAV features - fun to work with in PHP :) Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access & Data Integration Technology Providers > -Original Message- > From: Szii [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, September 18, 2001 4:22 PM > To: Paul Gardiner > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] db's war > > > IMHO, having run all three, I summarize them like this... > > MySQL, Postgres > Fast, open source, free. Good for projects, small-medium sized > businesses, > and playing around. > > DB2 > Good, solid database. Their UI needs work (it's 100% > java-based) and it's > significantly more complex (and pricier) than the OpenSource ones. > However, > it IS slower. It can handle MUCH larger datasets. It can be run in a > clustered > environment. It has the robustness for large business, but can > be handled > by a > medium sized one. > > Oracle > Often referred to as the "Cadillac of Databases," this thing's a beast. > Expect to not > only pay through the nose for it, but also for help/contractors/DBAs to > set it up, > tune it, maintain it, and handle the problems. It -can- be setup by > smaller firms, but > definately do your homework here. Go with someone who's been doing it a > while > and is in the enterprise space you want to be in. It's also got a HUGE > set of > applications and modules that can run on top of the raw database (no one > else really > has this from a single vendor) but that's a whole new can of > worms, costs, > problems, > etc. > > My personal favorite is DB2. The key to DB2, though, is not the common > sense things > like "do the training classes" and "get a book." The key is in their UI > stuff. Ditch it. > Learn the command lines, the scripting tools, and the database > connectivity > stuff. Sure, > you can do simple things with their UI, but it's going to > restrict you in a > lot of ways. > DB2 is big enough for "real enterprise work" but small enough not > to get out > of hand. > > However, DB2 is almost the cost of Oracle (purchasing) but your recurring > costs are > considerably cheaper. Oracle does have the advantage of being "first" and > so the > knowledge base/finding people who know a bit about Oracle is easier, and > they DO have > all of the applications modules which DB2 currently does not have. (Rumors > are that they're > looking at expanding into that realm a little more, but I don't know > anything for sure.) > > If you need a consolodated system for the whole company, well, Oracle wins > that hands down. > If you just need a super fast lightweight database, OpenSource. > For everything else, DB2. > > And if you need a kick-arse track-anything-anywhere-anyhow system, look at > Camstar Systems, > which will handle backends of both DB2 and Oracle. It's better than the > Oracle MES/tracking modules. > > -Szii > > - Original Message - > From: "Paul Gardiner" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]>; "Sommai Fongnamthip" > <[EMAIL PROTECTED]> > Sent: Tuesday, September 18, 2001 3:16 AM > Subject: Re: [PHP-DB] db's war > > > > Hi, > > > > I'm also very interested in other peoples thoughts and > reactions to this. > > We've been hit twofold, we run on SCO which Caldera has now > taken over and > > also use Informix which IBM have acquired, whom I'm sure will > try to make > us > > move to DB2 at some point. > > > > The other trouble we have is a lot of our programs are written > in Informix > > 4GL and so will be a pain to convert. I would have liked to of had a DB > > independent 4GL but this was already in place before I got > here. The only > > real other choice like you say is Oracle but I've always heard > bad things > > regarding pricing where they are concerned. They had a special offer on > for > > anyone who jumped over two them quickly but I like to 'look before you > leap' > > :) > > > > We plan to start looking at possible alternative's before we're > forced to > > change and so would be glad to hear from anyone else who is in the same > boat > > so to speak. > > > > Best Regards, > > - Paul - > > > > > > - Original Message - > > From: "Sommai Fongnamthip" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, September 18, 2001 2:36 AM > > Subject: [PHP-DB] db's war > > > > > > > hi > > > I'd like to survey php commnunity about how do you think about merge > > > between informix and ibm? Did there remain only 2 major dbms (oracle > and > > > db2)? do you think MySQL will be the leader with next version 4? > > > > > > SF > > > > > > > > > -- > > > PHP Database Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail
Re: [PHP-DB] db's war
IMHO, having run all three, I summarize them like this... MySQL, Postgres Fast, open source, free. Good for projects, small-medium sized businesses, and playing around. DB2 Good, solid database. Their UI needs work (it's 100% java-based) and it's significantly more complex (and pricier) than the OpenSource ones. However, it IS slower. It can handle MUCH larger datasets. It can be run in a clustered environment. It has the robustness for large business, but can be handled by a medium sized one. Oracle Often referred to as the "Cadillac of Databases," this thing's a beast. Expect to not only pay through the nose for it, but also for help/contractors/DBAs to set it up, tune it, maintain it, and handle the problems. It -can- be setup by smaller firms, but definately do your homework here. Go with someone who's been doing it a while and is in the enterprise space you want to be in. It's also got a HUGE set of applications and modules that can run on top of the raw database (no one else really has this from a single vendor) but that's a whole new can of worms, costs, problems, etc. My personal favorite is DB2. The key to DB2, though, is not the common sense things like "do the training classes" and "get a book." The key is in their UI stuff. Ditch it. Learn the command lines, the scripting tools, and the database connectivity stuff. Sure, you can do simple things with their UI, but it's going to restrict you in a lot of ways. DB2 is big enough for "real enterprise work" but small enough not to get out of hand. However, DB2 is almost the cost of Oracle (purchasing) but your recurring costs are considerably cheaper. Oracle does have the advantage of being "first" and so the knowledge base/finding people who know a bit about Oracle is easier, and they DO have all of the applications modules which DB2 currently does not have. (Rumors are that they're looking at expanding into that realm a little more, but I don't know anything for sure.) If you need a consolodated system for the whole company, well, Oracle wins that hands down. If you just need a super fast lightweight database, OpenSource. For everything else, DB2. And if you need a kick-arse track-anything-anywhere-anyhow system, look at Camstar Systems, which will handle backends of both DB2 and Oracle. It's better than the Oracle MES/tracking modules. -Szii - Original Message - From: "Paul Gardiner" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; "Sommai Fongnamthip" <[EMAIL PROTECTED]> Sent: Tuesday, September 18, 2001 3:16 AM Subject: Re: [PHP-DB] db's war > Hi, > > I'm also very interested in other peoples thoughts and reactions to this. > We've been hit twofold, we run on SCO which Caldera has now taken over and > also use Informix which IBM have acquired, whom I'm sure will try to make us > move to DB2 at some point. > > The other trouble we have is a lot of our programs are written in Informix > 4GL and so will be a pain to convert. I would have liked to of had a DB > independent 4GL but this was already in place before I got here. The only > real other choice like you say is Oracle but I've always heard bad things > regarding pricing where they are concerned. They had a special offer on for > anyone who jumped over two them quickly but I like to 'look before you leap' > :) > > We plan to start looking at possible alternative's before we're forced to > change and so would be glad to hear from anyone else who is in the same boat > so to speak. > > Best Regards, > - Paul - > > > - Original Message - > From: "Sommai Fongnamthip" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, September 18, 2001 2:36 AM > Subject: [PHP-DB] db's war > > > > hi > > I'd like to survey php commnunity about how do you think about merge > > between informix and ibm? Did there remain only 2 major dbms (oracle and > > db2)? do you think MySQL will be the leader with next version 4? > > > > SF > > > > > > -- > > 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] php + MYSQL based banner exchange system
http://www.phpwizard.net/projects/phpAds/ Sincerely berber Visit http://www.weberdev.com Today!!! To see where PHP might take you tomorrow. -Original Message- From: Andrius Jakutis [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 19, 2001 6:24 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] php + MYSQL based banner exchange system Hello all, I need your recomendations, where to download from a good (profesional - many options) banner exchange system (subj.). I need it for free (I understand that not everything what is free is also good :) ). Any ideas? Sorry, if my message is offtopic. Sincerely, Andrius -- 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] php + MYSQL based banner exchange system
Hello all, I need your recomendations, where to download from a good (profesional - many options) banner exchange system (subj.). I need it for free (I understand that not everything what is free is also good :) ). Any ideas? Sorry, if my message is offtopic. Sincerely, Andrius -- 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] Problems inserting large blob
Hi! Have you set max_allowed_packet in my.cnf big enough? Is the type of your column LONGBLOB? A BLOB can only store 64 kB. Regards, Heikki Tuuri http://www.innodb.com Joao Barreto wrote in message ... > >I forgot to say that php.ini file has 8Mb set as the maximum >possible upload file size. > >Thanks for everything ... I really need some help on this! > >João B. >-- >Joao Barreto - E-Business and Security Manager >Convex - Informática e Sistemas de Comunicações Portugal, Lda >Tagus Park, Edf. Ciência II, 2º, 2780-920 Porto Salvo Portugal >mailto:[EMAIL PROTECTED] phone:+351 21 4229200 > > > >-Original Message- >From: Justin Buist [mailto:[EMAIL PROTECTED]] >Sent: quinta-feira, 13 de Setembro de 2001 21:38 >To: Joao Barreto >Cc: php-db@lists. php. net >Subject: Re: [PHP-DB] Problems inserting large blob > > >You might want to check php.ini - if memory serves the maximum filesize >you can upload over HTTP by default is 2MB. Bump that number up and >restart Apache (or whatever webserver you use) and see if that fixes the >problem. > >Justin Buist >Trident Technology, Inc. >4700 60th St. SW, Suite 102 >Grand Rapids, MI 49512 >Ph. 616.554.2700 >Fx. 616.554.3331 >Mo. 616.291.2612 > >On Thu, 13 Sep 2001, Joao Barreto wrote: > >> >> Hello all ... >> >> I'm having a problem uploading large files (3MBytes for examples) >> and inserting it onto a MySQL database. No problem with smaller files. >> >> The code is basically this: >> >> > $data = addslashes(fread(fopen($form_data, "rb"), filesize($form_data))); >> $result=MYSQL_QUERY("INSERT INTO file2download >> (description,bin_data,filename,filesize,filetype, filecompany) ". >> "VALUES >> >('$form_description','$data','$form_data_name','$form_data_size','$form_dat a >> _type', '$empresa')"); >> if (mysql_errno() != 0) echo mysql_error(); >> $id= mysql_insert_id(); >> ?> >> >> When the files are the mentioned size (I checked the whole file got there >on >> /tmp/something) >> I get an error message along these lines: 'MySQL Server moved away' and >the >> fid is 0. >> >> Any ideas? >> Is there any limitation on the size of the 'insert into' string? If so, >how >> can I store >> such a big data chunk on the database? >> >> And please, answer directly by email as well to me. Sometimes it is >> difficult to find >> a message among the ones that we get each day! >> >> Thanks for your support, >> João Barreto - Convex Portugal >> >> >> -- >> 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]
[PHP-DB] Re: Application-based locking with PHP?
Hi! InnoDB type tables in MySQL provide row level locking and transactions. See http://www.innodb.com Regards, Heikki Tuuri Innobase Oy Barry L. Jeung wrote in message ... Just wondering if anyone has tried doing quasi application based locking with PHP? My scenario is this. I'm constructing a database for my company to help keep track of trouble tickets, etc with a web-based frontend. I'm using PHP (obviously =]) for inputing/retrieving data and have a slight predicament. Since MySQL does table-level locking, if I put lock statements in my queries, it would cause two problems. One being the entire table being locked and two if the user just closes the webpage without exiting properly, the table would remain locked indefinately. So I'm trying to think of alternatives, one of which is using global variables to store table/record id's, and then evaluating the queries based on that information. So if John selects ticket # 5 and might be updating it, then when Bob attempts to select ticket #5, then the $id and $table variables would be checked against the variables stored when john placed his query, and bob would get a message saying that record #5 is locked or in-use by John and to try later. Is this feasible or is there a better way to do this? Thanks for your time. -- 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] problemhandling form variables
When you printed the string $imgupload, what were its contents? -Original Message- From: Todd Moy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 18, 2001 12:40 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] problemhandling form variables I have an upload field on a form that is optional for the user. Hence, they may post an image or not. If not, a default image is assigned. Here is my logic and the corresponding error: /*$imgupload is the file field on the form*/ if(!$imgupload){ $imglink=$imgpath.$defaultimg; //assign the path to image }elseif($imgupload){ copy($imgupload, "project_images/$imgupload_name"); //line 35 $imglink=$imgpath.$imgupload_name; // path to directory unlink($imgupload); // line 37 }else{ printf("Error saving image..."); } /* errors Warning: Unable to open 'none' for reading: No such file or directory in /home/metonym/public_html/makenewproject.php on line 35 Warning: Unlink failed (No such file or directory) in /home/metonym/public_html/makenewproject.php on line 37 */ -- 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] problemhandling form variables
I have an upload field on a form that is optional for the user. Hence, they may post an image or not. If not, a default image is assigned. Here is my logic and the corresponding error: /*$imgupload is the file field on the form*/ if(!$imgupload){ $imglink=$imgpath.$defaultimg; //assign the path to image }elseif($imgupload){ copy($imgupload, "project_images/$imgupload_name"); //line 35 $imglink=$imgpath.$imgupload_name; // path to directory unlink($imgupload); // line 37 }else{ printf("Error saving image..."); } /* errors Warning: Unable to open 'none' for reading: No such file or directory in /home/metonym/public_html/makenewproject.php on line 35 Warning: Unlink failed (No such file or directory) in /home/metonym/public_html/makenewproject.php on line 37 */ -- 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] Sort HTML tables...
> Like to know if anybody has a script to sort data for a column over multiple > tables with MySQL ? > thanks on advance .. > cordially.. Are you looking for the 'ORDER BY' clause? It's used something like: SELECT blah FROM blah WHERE blah = true ORDER BY Justin Buist Trident Technology, Inc. 4700 60th St. SW, Suite 102 Grand Rapids, MI 49512 Ph. 616.554.2700 Fx. 616.554.3331 Mo. 616.291.2612 -- 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] MYSQL/PHP what is the difference between unset() and mysql_free_result() ? II
> > unset() simply deletes the pointer to the data without releasing the space > > held by the data. > > mysql_free_result() releases the data storage pointed-to by the $result > > pointer. > > This is important because $result could be pointing-to a dataspace > > containing a large number or rows returned by the mysql_query(). You WANT > > to recover this dataspace. What about an overwrite? Will this also overwrite the dataspace? b.e.: $result=mysql_query($query1); mysql_free_result($result); $result=mysql_query($query2); mysql_free_result($result); Does the first mysql_free_result make any sense here? Tnx, Bas Jobsen -- 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] Help Please! Complex AND OR LIKE queries MySQL/PHP
Cheers Rick ... I think I nailed it. I've copied my little function below for anyone else interested. Am keen on the "saving milliseconds" bit, though (will add it to the function below before making it live). Any more tips? Dave function parse($what) { $what = strtolower($what); $what = ltrim($what); $what = rtrim($what); $wa = explode(" ",$what); for ($i=0; $i<= sizeof($wa); $i++) { if (strlen($wa[$i]) !==0) { $j = $i + 1; if ($wa[$i] == "or") { $output .= " OR search_column LIKE '%$wa[$j]%' "; $i++; } elseif ($wa[$i] == "and") { $output .= " AND search_column LIKE '%$wa[$j]%' "; $i++; } elseif ($wa[$i] == "not") { $output .= " AND search_column NOT LIKE '%$wa[$j]%' "; $i++; } else { $output .= " AND search_column LIKE '%$wa[$i]%' "; } } } // strip leading AND from every option $output = substr($output, 4, strlen($output)-3); $what = $output; return $what; } -- 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] Help Please! Complex AND OR LIKE queries MySQL/PHP
Just use PHP's string searching functions. I had a similar situation where I was inserting user-provided data into a MySQL database. I searched for MySQL "bad words" that I didn't want a hacker to insert into queries, such as DELETE, ADD, INSERT, MODIFY, etc. to prevent mischief. FYI, you can dispense with the tidy-up by adding "1" in your pre-pend phrase and moving the AND to the front of your query. Such as: $sql_text .= " AND column1 LIKE '%$s_a[$s_a_i]%' OR column2 LIKE '%$s_a[$S_a_i]%' "; Then pre-pend with: $sql_text = "SELECT id, columnx, columny FROM sometable WHERE 1" . $sql_text; This will save a few milli-seconds because PHP will not have to execute the "substr($sql_text, 0, strlen($sql_text)-4)" functionality. -Original Message- From: Dave Watkinson [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 18, 2001 5:26 AM To: PHP-DB List (E-mail) Subject: [PHP-DB] Help Please! Complex AND OR LIKE queries MySQL/PHP Hi everyone I need to write a small search script for our admin site (and eventually for the "outsiders" too!). There's a text box where the user types in what they're searching for. It's easy enough to parse their string into an array and create the query from it, for example $s_a = explode(" ", $user_input); for ($s_a_i=0; $s_a_i<= sizeof($s_a); $s_a_i++) { $sql_text .= " column1 LIKE '%$s_a[$s_a_i]%' OR column2 LIKE '%$s_a[$S_a_i]%' AND "; } and then tidy it up by adding //remove trailing AND $sql_text = substr($sql_text, 0, strlen($sql_text)-4); //prepend start of sql command $sql_text = "SELECT id, columnx, columny FROM sometable WHERE " . $sql_text; and then running the query. However, what I need to be able to do is detect if people have typed in the words AND OR or NOT and handle them appropriately, also remembering that I'll be searching TWO columns in the table every time. Are there perhaps any functions I can get for this? Or is there a really easy way I can do it that's escaped (scuse the pun!) me? Many thanks in advance Dave -- 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] Sort HTML tables...
Like to know if anybody has a script to sort data for a column over multiple tables with MySQL ? thanks on advance .. cordially.. -- 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] db's war
Hi, I'm also very interested in other peoples thoughts and reactions to this. We've been hit twofold, we run on SCO which Caldera has now taken over and also use Informix which IBM have acquired, whom I'm sure will try to make us move to DB2 at some point. The other trouble we have is a lot of our programs are written in Informix 4GL and so will be a pain to convert. I would have liked to of had a DB independent 4GL but this was already in place before I got here. The only real other choice like you say is Oracle but I've always heard bad things regarding pricing where they are concerned. They had a special offer on for anyone who jumped over two them quickly but I like to 'look before you leap' :) We plan to start looking at possible alternative's before we're forced to change and so would be glad to hear from anyone else who is in the same boat so to speak. Best Regards, - Paul - - Original Message - From: "Sommai Fongnamthip" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, September 18, 2001 2:36 AM Subject: [PHP-DB] db's war > hi > I'd like to survey php commnunity about how do you think about merge > between informix and ibm? Did there remain only 2 major dbms (oracle and > db2)? do you think MySQL will be the leader with next version 4? > > SF > > > -- > 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] Help Please! Complex AND OR LIKE queries MySQL/PHP
Hi everyone I need to write a small search script for our admin site (and eventually for the "outsiders" too!). There's a text box where the user types in what they're searching for. It's easy enough to parse their string into an array and create the query from it, for example $s_a = explode(" ", $user_input); for ($s_a_i=0; $s_a_i<= sizeof($s_a); $s_a_i++) { $sql_text .= " column1 LIKE '%$s_a[$s_a_i]%' OR column2 LIKE '%$s_a[$S_a_i]%' AND "; } and then tidy it up by adding //remove trailing AND $sql_text = substr($sql_text, 0, strlen($sql_text)-4); //prepend start of sql command $sql_text = "SELECT id, columnx, columny FROM sometable WHERE " . $sql_text; and then running the query. However, what I need to be able to do is detect if people have typed in the words AND OR or NOT and handle them appropriately, also remembering that I'll be searching TWO columns in the table every time. Are there perhaps any functions I can get for this? Or is there a really easy way I can do it that's escaped (scuse the pun!) me? Many thanks in advance Dave
[PHP-DB] Re: db's war
i've used postgresql and mysql on linux platforms (mysql on windoze) and have been really suprised by mysql. i must admit thought that postgresql is far more complex and more powerful. although i haven't used db2 or oracle in anger i can certainly see postgres making gains in the near future ... the company i work for have a quote for oracle of nearly £100k ... lets hope both postgresql and mysql start to knock the bloaters off the top ! Steve "Sommai Fongnamthip" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > hi > I'd like to survey php commnunity about how do you think about merge > between informix and ibm? Did there remain only 2 major dbms (oracle and > db2)? do you think MySQL will be the leader with next version 4? > > SF > -- 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] db's war
Having worked in IBM and in Open Source community I feel I've know both systems very well. MySQL is different to the "big boys" of DB2 and Oracle. They are designed for enterprise level, and to handle a complexity and quantity of data which mysql just isn't there. The SQL used in mysql is vastly simpler than that used in the others, and could be said to less powerful in that in can do much less. This leads on to what I feel is the key point here, mysql place has not been in doing in enterprise level stuff, it has been in providing a good simple way of doing simpler things. Because of its simplicity it manages to be very effecient, but when you start trying to build it more complex the obvious flaws in the language. I'm eagerly awaiting the next release of mysql to see what they do with it. I think they will either stick to how it as at the moment and further improve performance and the basic features or are they going to take a step up (and away) from where they are at the moment and start to see more complex features (maybe even sub-selects. now that I *would* like to see in there). Either way I don't think mysql competing with db2 or oracle, at least in the reasonably long future, is all that likely. The customer base and trust is there too strong + the products are actually decent (which is where any analogy between ASP and PHP breaks down ;) ) As in almost everything in IT, and I life I guess, it's a case of best tool for the job. Well, there's my ha'penny's worth. Anyone want to start a DB2 / Oracle debate? (JOKE been there done that, neither won) Tom - Original Message - From: "Sommai Fongnamthip" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, September 18, 2001 2:36 AM Subject: [PHP-DB] db's war > hi > I'd like to survey php commnunity about how do you think about merge > between informix and ibm? Did there remain only 2 major dbms (oracle and > db2)? do you think MySQL will be the leader with next version 4? > > SF > > > -- > 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] odbc_connect sometime fails
I developped a PHP application with multi-frame presentation. This application worked well under NT4/IIS/PHP4.0.2. Since I migrate it under W2000/IIS/PHP4.0.6/ODBC for MS-Access, I sometimes encounter problems while connecting to the database in one of the frame (odbc_connect). The error reported is 'database already in use'. The configuration of ODBC is not set to exclusive mode. It look like the different frames attempt to access simulatneously to the DataBase in exclusive mode. Philippe -- 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] .htaccess
From: its me <[EMAIL PROTECTED]> Date: Tue, Sep 18, 2001 at 01:42:19AM -0700 Message-ID: <[EMAIL PROTECTED]> Subject: [PHP-DB] .htaccess > where i can find info abour .htaccess and .htpasswd > files and what should be the code inside them > its urgent please guys http://apache-server.com/tutorials/ATusing-htaccess.html http://httpd.apache.org/docs/ http://www.apachetoday.com: - http://apachetoday.com/news_story.php3?ltsn=2000-07-24-002-01-NW-LF-SW - http://apachetoday.com/news_story.php3?ltsn=2000-07-31-001-01-NW-DP-LF - http://apachetoday.com/news_story.php3?ltsn=2000-08-07-001-01-NW-LF-SW - http://apachetoday.com/news_story.php3?ltsn=2000-06-29-003-01-NW-LF -- * R&zE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- 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] .htaccess
Hey man It's simple... .htaccess AuthName "Authentication required" AuthType Basic require user admin, mike, nick, bill AuthUserFile /path/to/password/file/.htpasswd file .htaccess should be located in the directory you want to protect .htpasswd this file consists of the logins and passwords (syntax: login:password ) In the Unix systems you just use htpasswd utility to add records to this file or to create itself. Example: /bin/htpasswd -c /path/to/password/file/.htpasswd admin Then you enter password for admin Utility creates a new file .htpasswd /bin/htpasswd /path/to/password/file/.htpasswd mike Then you enter password for mike Utility adds a records in end of the existing .htpasswd /bin/htpasswd -b /path/to/password/file/.htpasswd nick password Then utility reads the password from the command line and puts it in the file. and so on. Don't forget to make the right rights for the .htaccess and .htpasswd Success, Michael -Original Message- From: its me [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 18, 2001 10:42 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] .htaccess where i can find info abour .htaccess and .htpasswd files and what should be the code inside them its urgent please guys -- 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] .htaccess
where i can find info abour .htaccess and .htpasswd files and what should be the code inside them its urgent please guys -- 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]