Re: [PHP-DB] PHP Classes to generate Excel files ?
There is also the very good PEAR Excel Writer class. http://pear.php.net/package/Spreadsheet_Excel_Writer Ignatius - Original Message - From: John Holmes [EMAIL PROTECTED] To: Stéphane Pinel [EMAIL PROTECTED]; 'PHP DB' php-db@lists.php.net Sent: 22 December 2004 20:54 Subject: Re: [PHP-DB] PHP Classes to generate Excel files ? From: Stéphane Pinel [EMAIL PROTECTED] I'm looking for PHP classes (free or cheap) that are able to generate Excel files (XML?) with a minimum of customization capabilities (styles, borders, colors...). http://www.web-aware.com/biff/ This has been around quite a while. I don't if it's still being actively developed or kept up to date or what, though... ---John Holmes... UCCASS - PHP Survey System http://www.bigredspark.com/survey.html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Pagination
have a look at the PEAR Pager class. very useful. _ - Original Message - From: David Ziggy Lubowa [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: 16 December 2004 23:38 Subject: [PHP-DB] Pagination Hey guys, I am working on an internal db and i have a script[below] which does some searching for me, now i am no expert in php but atleast i can always read up, i want to add some kind of pagination because just incase i search for somethign in particular i dont want it to display 100 entries on my form, how can i incorperate a pagination script in the script below, all help is highly appreciated [snip] ?php $var = @$_GET['q'] ; $trimmed = trim($var); // check for an empty string and display a message. if ($trimmed == ) { echo pPlease enter a search.../p; exit; } $link = mysql_connect(localhost, beef,b33f); mysql_select_db(ip, $link); $qry = mysql_query(SELECT * FROM IP_Addresses where free like '%. $_GET['q'].%', $link); ? table border=1 width=100%tr?php if (mysql_num_rows($qry)==0 ) { print Oops No records found ; ? br a href=http://localhost/ipsearch2.html;Back/a /br ? exit(); } if (mysql_num_rows($qry) 0) { for ($i = 0; $imysql_num_fields($qry); $i++) { echo td align=centerstrong . mysql_field_name($qry, $i) . /td; echo td align=centerstrong . mysql_field_name($qry, $i) . /td; } } ? /tr?php if (mysql_num_rows($qry) 0) { for ($j = 0; $jmysql_num_rows($qry); $j++) { ?tr?php for ($k = 0; $kmysql_num_fields($qry); $k++) { echo td align=center . mysql_result($qry,$j, $k) . /td; } ?/tr?php } } ? [/snip] cheers -Z -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Use of 'as' name in where sub-clause
Very simply, because a clause WHERE sales * cost 100 would look up to sales and cost in the expression as SELECT fields. Your clause will wotk if you add sales and cost to the SELECT fields, but that would not be economical: - you don't need them in the result - you will execute the caclulation twice In any case it good personal hygiene to use aliases Ignatius _ - Original Message - From: Ross Honniball [EMAIL PROTECTED] To: php DB [EMAIL PROTECTED] Sent: 01 December 2004 10:53 Subject: [PHP-DB] Use of 'as' name in where sub-clause Hi All, In MySql, you CAN'T do the following: SELECT sales * cost AS total WHERE total 100 Instead, you need to say: SELECT sales * cost AS total WHERE sales * cost 100 I'm just curious WHY you can't do it. You can, for example, specify ORDER BY total. I can't think of any reason why it would be either difficult or ambiguous for the SQL engine to allow you to use your calculated field name in the WHERE part of the query. If someone can give me a good reason why this is so, it will stop it annoying me so much. Regards ... Ross . . Ross Honniball. JCU Bookshop Cairns, Qld, Australia. . -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Numeric question
I am fairly confident that in this particular case the opinion(s) contained within this email would nicely coincide with those of St. Jude Children's Research Hospital. We live in a world full of geometry. Ignatius Reilly _ - Original Message - From: Norland, Martin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: 16 November 2004 22:21 Subject: RE: [PHP-DB] Numeric question Just a quick question, I'm having to calculate some values from an existing database, but on some of the results I get (For example) 0.5907 How can I limit the result to only 2 digits after the decimal point with PHP? Thanks Chris Let the manual guide you: http://www.php.net/round for example: echo round(1.95583, 2); // 1.96 - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ER diagram class
Dezign / MySQL Importer www.datanamic.com HTH -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Array to Javascript?
look at the PEAR HTML_Javascript class _ - Original Message - From: Chris Payne [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 26, 2004 2:18 AM Subject: [PHP-DB] PHP Array to Javascript? Hi there everyone, I set an array using the following in PHP: $ringb[$i]=$complex_area; $i++; It cycles through my DB and stores the info, my question is, how can I convert it to a value that can be read in Javascript? I'm stumped. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Text area
You may profitably investigate PEAR Quickform. Nice client-side and server-side validation functions to do just that. HTH _ - Original Message - From: Hafidz Abdullah [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, August 24, 2004 10:43 AM Subject: [PHP-DB] Text area Hi again, everyone. I also have a problem creating my text area. I meant to do a text area (measuring 5 rows by 70 columns) which accompanies the words: First 50 words are free. Subsequent 50 words or part thereof, $50 will be charged: function write_textarea() { return input type=textarea rows=5 cols=70 name=; } Doesn't work. How can I make it work? Thanks regards, Hafidz -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Web page paginator that doesn't rely on the LIMIT clause
1. What prevents you from implementing the conditions directly in SQL? You can achieve a lot with CASE and IF. 2. For your paging needs, you may benefit from investigating the PEAR HTML_Pager class. Ignatius _ - Original Message - From: Ross Honniball [EMAIL PROTECTED] To: php DB [EMAIL PROTECTED] Sent: Tuesday, August 03, 2004 12:52 PM Subject: [PHP-DB] Web page paginator that doesn't rely on the LIMIT clause Hi all, I use the LIMIT statement to control paging of data, which works really well. I now have a situation where I need to use some logic in addition to the query that will result in NOT ALL records being spat out. ie. select * from x where y; foreach result if (some condition) output; endif endfor So problem is I can't say LIMIT 20,20 on the query as logic may result in less than 20 records being spat out to screen. I was planning on coding up a solution so that i just keep a count myself of how many records I have output myself and break at appropriate paging points, but I am probably re-inventing the wheel. Anyone know of any good classes they are using that do this sort of thing already? . . Ross Honniball. JCU Bookshop Cairns, Qld, Australia. . -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Web page paginator that doesn't rely on the LIMIT clause
With MySQL 4.1: try this (untested) SELECT SM.key, SM.stock_on_hand COALESCE( SH.tally, 0 ) AS hist_sales FROM stock_master AS SM LEFT JOIN ( SELECT SH.key SUM( SH.jan ) + ... + SUM( SH.`dec` ) AS tally FROM stock_history AS SH WHERE SH.year = 2004 GROUP BY key ) AS H ON H.key = SM.key HAVING stock_on_hand hist_sale With earlier versions, you must create a temporary table with the table appearing in the subquery. Notes: 2 ugly things about your design: - dashes in table and column names - one column per month: you must have one column month that becomes part of the primary key HTH Ignatius _ - Original Message - From: Ross Honniball [EMAIL PROTECTED] To: php DB [EMAIL PROTECTED] Sent: Tuesday, August 03, 2004 2:54 PM Subject: Re: [PHP-DB] Web page paginator that doesn't rely on the LIMIT clause At 10:22 PM 3/08/2004, you wrote: 1. please answer to the list, not to only me (you break the thread) whoops. sorry. 2. show us your data model if you need further help AS AN EXERCISE, I would be interested to know if you can do this in one query, but I've pretty much decided to either code up or find a paginator class that will resolve my present issues. I figure even if this particular query can be done in SQL, I'm going to eventually run against a problem that can't. Roughly, data model looks like this: Table : Stock-Master Key (key) title etc. stock-on-hand | | /\ / \ Table : Stock-History Key (key) Year(key) Sales-Jan Sales-Feb Sales-Mar ... Sales-Dec And what I need to do is loop through master records, grab history records for various years (which may or may not exist for any given key), add up multiple sales field within each history record, and compare this against stock-on-hand to decide if I want to 'output' the record or not. Let me know if you want more detail. It would resolve the present issue if it can be done in a query(and improve my sql knowledge). _ - Original Message - From: Ross Honniball [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED] Sent: Tuesday, August 03, 2004 1:46 PM Subject: Re: [PHP-DB] Web page paginator that doesn't rely on the LIMIT clause thanks ignatius. not sure i'm out of the woods though. I didn't know sql had CASE and IF. I just had a quick look in the manual and aren't sure they will help. The specific logic I'm doing is this: total_sales = 0; select * from master while more master records if (select * from history record 1) // MAY NOT EVEN EXIST loop through a dozen monthly sales fields adding into total_sales; endif if (select * from history record 2) // MAY NOT EVEN EXIST loop through a dozen monthly sales fields adding into total_sales; endif //* the 'output' test if total_sales some_amount output record endif end-while So it's not real complex to do in code, but I really wouldn't know where to start to try and screw it all in to a single sql statement. I also had a look at HTML_Pager but, at a glance, it looks like some kind of web-page presenter? At 09:14 PM 3/08/2004, you wrote: 1. What prevents you from implementing the conditions directly in SQL? You can achieve a lot with CASE and IF. 2. For your paging needs, you may benefit from investigating the PEAR HTML_Pager class. Ignatius _ - Original Message - From: Ross Honniball [EMAIL PROTECTED] To: php DB [EMAIL PROTECTED] Sent: Tuesday, August 03, 2004 12:52 PM Subject: [PHP-DB] Web page paginator that doesn't rely on the LIMIT clause Hi all, I use the LIMIT statement to control paging of data, which works really well. I now have a situation where I need to use some logic in addition to the query that will result in NOT ALL records being spat out. ie. select * from x where y; foreach result if (some condition) output; endif endfor So problem is I can't say LIMIT 20,20 on the query as logic may result in less than 20 records being spat out to screen. I was planning on coding up a solution so that i just keep a count myself of how many records I have output myself and break at appropriate paging points, but I am probably re-inventing the wheel. Anyone know of any good classes they are using that do this sort of thing already? . . Ross Honniball. JCU Bookshop Cairns, Qld, Australia. . -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Wait Statement... ?
sleep( nb of seconds ) ; _ - Original Message - From: ..: GamCo :.. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 9:44 AM Subject: [PHP-DB] Wait Statement... ? Hi all, I would like to add a line of code in PHP that will execute a wait before executing the next set of code. How do i do that ? Regards, GM -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Wait Statement... ?
Why silly?? it just makes you wait one second on the login page BEFORE the validation process, not on other pages. I use it everywhere. Ignatius _ - Original Message - From: Daevid Vincent [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: '..: GamCo :..' [EMAIL PROTECTED]; 'John W. Holmes' [EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 9:47 PM Subject: RE: [PHP-DB] Wait Statement... ? Similarly, I could adjust my brute force attack to sleep() a pre-determined amount of time too ;-) The whole 'sleep()' idea just seems silly. I agree with Jason. Just validate and be done. A better way to stop attacks is to have a tally of failed logins if you really are that worried someone is going to brute-force you. Then after 3 fails, just don't let that IP connect or add other intelligent handling. Maybe add them to a 'ban list' after x amount of failed tries. You can get the $_SERVER['REMOTE_ADDR'] or use the session id or whatever. -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 7:10 AM To: ..: GamCo :.. Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Wait Statement... ? ..: GamCo :.. wrote: ok, i added the sleep() function in my page. what i'm basically doing is :- i have a .php page where people log-in from. from there i send the form to another .php page that actually checks the login and registers a session with the username and password as session variables. then on the page that actually does the validation, i have something that says : validating login... sleep 1 funtion. then, i have another line that says validation successfull... sleep 1 function and then i have another line that says redirecting... with sleep 1 function and then header redirects to the actual logged-in.php file. the redirect and validation works perfectly as well as the sleep functions, but it now doesn't display the validating login... blah blah blah stuff which is done in normal html code... You are very confused. Read the manual page on header(). You can't have any output before you try to redirect with a header(). If you're trying to implement some sort of brute force protection by using sleep(), you're using it in the wrong method, anyhow. Your login processing script should sleep for a second or two whether the login is correct or not and it should be the first thing that it does (i.e. before any output or redirection). If you only sleep() on failures and redirect on good logins, brute force methods can pick up on that and adjust their methods to get around the wait time. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals - www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Web host offering beta versions?
PHP5: www.ovh.com MySQL 4.1 probably nobody. First beta (4.1.3) was released only a few days ago _ - Original Message - From: Jensen, Kimberlee [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 08, 2004 11:28 PM Subject: [PHP-DB] Web host offering beta versions? Does anyone know of a free/low cost Web host that lets you play with PHP 5 and MySQL 4.1? Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] HELP: best way to TEXT dump a MySQL table to a local file...
Hi the Third, have you considered dumping the table into a text file? SELECT * FROM mytable INTO OUTFILE c:/... this (AFAI) does not cause memory issues Ignatius _ - Original Message - From: Leo G. Divinagracia III [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 10, 2004 11:39 AM Subject: [PHP-DB] HELP: best way to TEXT dump a MySQL table to a local file... project i'm working with, his host died or something. but, the phpMyadmin (on that host) can NOT do a backup of 200mb table without running out of memory or something weird. so what is the best way to text dump the table? i thought i would (pseudo-code): open DB do while not EOF grab 1000 rows from DB write to a file on host www path filename = filename000 + 1 until EOF user would then FTP down the files to his machine. but i figured i could use the HEADER to send it to the user. i grabbed this from the HEADER help section: ?php $output_file = 'something.txt'; $content_len = 666; @ob_end_clean(); @ini_set('zlib.output_compression', 'Off'); header('Pragma: public'); header('Content-Transfer-Encoding: none'); header('Content-Type: application/octetstream; name=' . $output_file . ''); header('Content-Disposition: inline; filename=' . $output_file . ''); header(Content-length: $content_len); ? is that the best way to send the txt file to the user? thanks... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] About retrieving auto increment value
LAST_INSERT_ID() is connection-based, not table-based. Therefore instead of: SELECT LAST_INSERT_ID() FROM foo_table you should do: SELECT LAST_INSERT_ID() HTH Ignatius _ - Original Message - From: Marc Soler [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 07, 2004 7:42 PM Subject: [PHP-DB] About retrieving auto increment value Hi I have the typical problem with retrieving auto increment value in php-mysql environment. I have search info in mysql page and I have found LAST_INSERT_ID() funtion but I don't know how to use correctly. I have one script that insert a row. And another script that must retrieve last auto_increment value for primary key on a table. I want something like this: SELECT LAST_INSERT_ID() FROM foo_table; (like curval(foo_sequence) in postgres) This doesn't work. It's possible? Where I am wrong? Thanks in advance -- Marc Soler -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Count unique visits in PHP/MySQL
Here is how I would do: 1. Group your visits by IP, order them in time and give each row a sequential number starting with 1 (not completely trivial - exercise left to the reader) Now you have a temporary table T ( ip, timestamp, rank ) 2. Join the table to itself on two consecutive rows, and compute the timestamp difference between the rows (actually you must create a replica of the table because you can not self-join a temporary table) SELECT ip, SUM( IF( UNIX_TIMESTAMP( T.timestamp ) - UNIX_TIMESTAMP( U.timestamp ) = 60*30 0, 1 ) ) AS unik_visits FROM T LEFT JOIN U ONU.ip = T.ip AND U.rank = T.rank + 1 GROUP BY ip HTH Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 08, 2004 5:03 PM Subject: [PHP-DB] Count unique visits in PHP/MySQL I am making a PHP/MySQL traffic report page from a table that records some user activity using PHP referrer information. I have a table with three rows: IP, page_name, and timestamp. The IP row records the user's IP address, page_name records the name of the page that the user loaded, and the timestamp row records in Unix timestamp format the time of day that the user requested the page. I want to be able to count unique visits per IP according to Internet Advertising Bureau standards, which count a Unique Visit as a log in by the same IP once every thirty minutes. IAB verbatim definition: Visit - One or more text and/or graphics downloads from a site qualifying as at least one page, without 30 consecutive minutes of inactivity, which can be reasonably attributed to a single browser for a single session. A browser must pull text or graphics content to be considered a visit. So I need to make a MySQL query that will count how many times an IP logged a timestamp within a given time period. For example, the publisher checking traffic could request a date between May 1 and May 31, and I'd like to be able to return a page that counted unique users (count distinct IP), pages viewed (list distinct pages) and how many times they visited in that period. I have the first two down, but not the unique visits. Any ideas? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Wrong table name - can it be fixed?
Hav you tried enclosing the table name with backticks: SELECT ... FROM `16-05` ... Ignatius _ - Original Message - From: Martin E. Koss [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, May 17, 2004 10:48 AM Subject: [PHP-DB] Wrong table name - can it be fixed? I've made a big boo boo when exporting from MS Access to MySql database. The table name was '16-05' which obviously is not a good name to have in MySql. I'm using PhpMyAdmin as I'm not very experienced with sorting out the databases any other way. Problem is that I can't access the properties of the table in order to rename it, whatever I try to do I get an error (which is obviously due to the type of name the table has). Is there any way I can fix this without getting too complicated? Cheers. Martin --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.684 / Virus Database: 446 - Release Date: 13/05/2004 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Procedure for submitting an order via email
With the PHP IMAP functions you can process your mail box programmatically as a data repository. _ - Original Message - From: Ruprecht Helms [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 01, 2004 9:40 PM Subject: [PHP-DB] Procedure for submitting an order via email Hi, I'm looking for an simple example how to send an order (content of the basket) via email. Does someone have such a good ans simple example. Regards, Ruprecht -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] inserting same data into multiple tables question (?)
You can't with standard SQL, nor with MySQL. _ - Original Message - From: JeRRy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 30, 2004 3:04 PM Subject: [PHP-DB] inserting same data into multiple tables question (?) Hi, I want to input the same data into multiple tables in one query if possible. So what I want to do is input about 6 usernames I have into about 15 tables. How would I do this? In one query? I really don't want to run multiple queries over 15 times to put in the data in each table. Would this work? INSERT into tbl1 , tbl2 , tbl3 ... ? J Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] converting scripts for register_globals=Off
If your form is well designed, there should NOT be another POST variable named ID or id used for a different purpose. Your form data validation routine will examine the 2-uple ( action, id), not id alone. therefore no problem. In many cases I find it convenient to design a page so that it can be called indifferently by POST or GET. Just my 2 Belgian francs. Ignatius _ - Original Message - From: Mikael Grön [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 29, 2004 12:42 PM Subject: Re: [PHP-DB] converting scripts for register_globals=Off Since I have a thing for using one file for all things in i.e. an admin script, I use POST and GET variables at the same time. Getting them mixed up is extremely hazardous.. I do stuff like: a href=admin.php?action=deleteid=2Delete post/a which leads to the section of the admin script; ?php if ($_GET['action'] == delete $_GET['id']) { // lots of PHP doing lots of stuff } else { // the link } ? Now, if there's a POST variable named ID containing an INT matching the database, and I use $_REQUEST instead of $_GET, I'm in trouble! Mike On Apr 29, 2004, at 11:00, Ignatius Reilly wrote: even better: $_REQUEST['variable_name'] so that you don't have to bother checking both depending on whether your form was GETted or POSTed. _ - Original Message - From: Mikael Grön [EMAIL PROTECTED] To: Kim Jacobs (Crooks) - Mweb [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, April 29, 2004 11:54 AM Subject: Re: [PHP-DB] converting scripts for register_globals=Off What register_globals does (Please correct me if I'm wrong) is convert i.e. $_POST['variable_name'], $_GET['variable_name'] and so on to $variable_name. which isn't very good from my point of view. I suggest you make sure you use $_GET['your_variable'] when ever you're fetching a GET variable, $_POST['var'] for all post variables and so on, instead of what you're doing now. This works just fine with register_globals = On as well, so I always use it... to be safe.. Mike On Apr 29, 2004, at 10:40, Kim Jacobs (Crooks) - Mweb wrote: if any of you could help me out, I would greatly appreciate it... I am an absolute beginner to php (2 weeks now) and dont know what I dont know... I have written some scripts to access my online SQL db and I've tested the scripts on my machine with PHP 4.3.6 and register_globals = On Now where I host my site, uses PHP 4.3.5 and has register_globals = Off which means of course, that my scripts arent working, but I dont know why My question is, how do I convert my scripts so that they will work please? I know that $id and $submit are two of the 'inputs' that it doesnt like, but I dont know the rest Tx K MWEB: S.A.'s most trusted and reliable Internet Service Provider. Just Like That. To join, go to: http://join.mweb.co.za or call 0860032000. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL - counting number of instances of a word in a field
It is easy to get around this limitation: for each column containing indexable content, create a shadow column containing content prepared for FULLTEXT indexing. I usually do the following: - for each word: - replace all non whitespace, non-blank characters by _ - right pad to 4 with _ for example B.M.W. become B_M_W_, tax will become tax_ now you prepare similarly the string to MATCH actually doing so is good personal hygiene regardless of the value of ft_max_len set by the host. it is mandatory when you deal with languages which do not separate words by whitespaces (in my case Japanese) HTH Ignatius _ - Original Message - From: Gavin Amm [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED] Sent: Wednesday, April 28, 2004 10:03 AM Subject: RE: [PHP-DB] MySQL - counting number of instances of a word in a field Yes, They do. Unfortunately the site is hosted by an ISP has set the indexed words to 3, the site requires essential words of 3 char length to be searched through, such as tax, ato, cgt, etc... I will certainly still index the 2 main columns in the table... Thanks for your help. -Original Message- From: Ignatius Reilly [mailto:[EMAIL PROTECTED] Sent: Wednesday, 28 April 2004 4:34 PM To: Gavin Amm; [EMAIL PROTECTED] Subject: Re: [PHP-DB] MySQL - counting number of instances of a word in a field The functions do not exist. However, FULLTEXT indexes will do much of this work for you. I encourage you to experiment with them. _ - Original Message - From: Gavin Amm [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, April 28, 2004 7:18 AM Subject: [PHP-DB] MySQL - counting number of instances of a word in a field Hi guys, I'm trying to find a MySQL function(s) that will allow me to count the number of words in a field. For eg: [table: pages] id - title - keywords - body 1 - Home - home, page - This is my home page. p Enjoy your stay. 2 - Feedback - feedback, form, contact - Please enter any feedback or comments in the form below.brYour feedback will be used to improve our service. How do I, for example, count the number of instances of a word such as feedback in say the BODY field? I'm putting together a search engine I'd like to 'rank' the results based on the number of instances of each word found in a few fields. In this example, if they search for the words feedback and improve, the count would result in the row id, word searched and the number of instances of that word: (formatting doesn't matter, it's just to give you an idea) id 2: feedback count = 2 id 2: improve count = 1 I can play with the weightings later, just need to figure out the counting... Thanks guys, Gav -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL - counting number of instances of a word in a field
The functions do not exist. However, FULLTEXT indexes will do much of this work for you. I encourage you to experiment with them. _ - Original Message - From: Gavin Amm [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, April 28, 2004 7:18 AM Subject: [PHP-DB] MySQL - counting number of instances of a word in a field Hi guys, I'm trying to find a MySQL function(s) that will allow me to count the number of words in a field. For eg: [table: pages] id - title - keywords - body 1 - Home - home, page - This is my home page. p Enjoy your stay. 2 - Feedback - feedback, form, contact - Please enter any feedback or comments in the form below.brYour feedback will be used to improve our service. How do I, for example, count the number of instances of a word such as feedback in say the BODY field? I'm putting together a search engine I'd like to 'rank' the results based on the number of instances of each word found in a few fields. In this example, if they search for the words feedback and improve, the count would result in the row id, word searched and the number of instances of that word: (formatting doesn't matter, it's just to give you an idea) id 2: feedback count = 2 id 2: improve count = 1 I can play with the weightings later, just need to figure out the counting... Thanks guys, Gav -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Looping through a result
Use only one query: SELECT category, item, ... ORDER BY category, item Now fetch rows, and keep the latest categoryID in a flag variable: - if fetched categoryID flag, close table, create a new table, add header row - otherwise add content row to the current table - update flag with the latest category ID BTW you may want to use the great PEAR HTML_Table package to generate your tables. HTH _ - Original Message - From: Rene Schoenmakers [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, April 20, 2004 10:43 AM Subject: [PHP-DB] Looping through a result Hi, I want to make the following page, Category 1 Item 1 of category 1 Item 2 of category 1 Item 3 of category 1 Item 4 of category 1 Category 2 Item 1 of category 2 Item 2 of category 2 Item 3 of category 2 Category 3 Item 1 of category 3 Item 2 of category 3 Item 3 of category 3 Item 4 of category 3 Item 4 of category 3, using PHP and MySQL. Looping through a result is not the problem. But how do I use a second query while looping through a result and do I have to use more then 1 table in the database? Can somebody point me in the right direction? Tia, René -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Date SELECT with IF
SELECT IF( B.Booking_End_Date != -00-00, DATE_FORMAT( B.Booking_End_Date, %Y-%m-%d ), N/A ) AS Booking_End_Date FROM Bookings AS B, etc. HTH Ignatius _ - Original Message - From: Shaun [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 15, 2004 7:44 PM Subject: [PHP-DB] Date SELECT with IF Hi, Is it possible to have a clause in a mysql SELECT statement? I would the query to display the date except where it equals the default 000-00-00 to display n/a or something similar. For example SELECT DATE_FORMAT(B.Booking_End_Date, \%Y-%m-%d\) AS 'Booking End Date' FROM Bookings (IF Booking_End_Date = '-00-00' DISPLAY 'n/a'); I hope this illustrates what I am trying to achieve! Thanks for your help -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] links to maps
Use the cURL library. _ - Original Message - From: matthew perry [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 15, 2004 6:39 AM Subject: [PHP-DB] links to maps Anyone know a quick and easy way to fill in the address on a yahoo maps form? I want a link from my page to fill in all the details I already know so my users don't have to enter it. - Matt -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Graphing - bar charts
jpgraph is great http://www.aditus.nu/jpgraph/ open source, very reasonably priced Ignatius _ - Original Message - From: Craig Hoffman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, April 06, 2004 4:55 PM Subject: [PHP-DB] Graphing - bar charts Hi there: I am looking for an open source and simple PHP script that will graph (bar) a few MySQL fields. Does anyone have any recommendations? __ Craig Hoffman - eClimb Media v: (847) 644 - 8914 f: (847) 866 - 1946 e: [EMAIL PROTECTED] w: www.eclimb.net _ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Firebird
_ - Original Message - From: Alireza Balouch [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 31, 2004 12:25 PM Subject: [PHP-DB] Firebird It looks like firebird database is on its way to replace of mysql... E???!!!??? How would you back this up? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Tree structure - how to show only current branch ??
The same can be achieved by using the excellent PEAR HTML_TreeMenu class. Key advantage, of course, is that the API is in PHP. HTH Ignatius _ - Original Message - From: Paul Miller [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 30, 2004 4:22 PM Subject: RE: [PHP-DB] Tree structure - how to show only current branch ?? Ya it has - that is a great script! -Original Message- From: Galbreath, Mark A [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 30, 2004 7:15 AM To: '-{ Rene Brehmer }-'; '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Tree structure - how to show only current branch ?? Already been done: http://www.destroydrop.com/javascripts/tree/ Mark -Original Message- From: -{ Rene Brehmer }- [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 30, 2004 7:50 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Tree structure - how to show only current branch ?? Ok, Tom Reed got my thinker running big time ... and I've been trying to build an expandable and modifiable tree structure where it only displays the branch leading to the current folder... Showing the entire tree is easy, but how do I change the code to only display the branch we need??? ... I've never coded visual trees before, so this is new for me ... Found several samples with google where the code relies on the structure being fixed in the DB. What I want to create is the possibility to mode folders around within the tree ... literally moving branches from one place to another, while retaining their content. DB structure is simply this (I want to get rid of the level field if it's at all possible to count the levels with recursive functions, but for now it stays). folderID int(10) UNSIGNED auto-increment parentID int(10) UNSIGNED level tinyint(3) UNSIGNED name varchar(255) (I'm fully aware that int may be overkill, but this is for testing purposes...) test data: http://localhost/phpmyadmin/sql.php?lang=en-iso-8859-1server=1db=tree +tes ttable=folderspos=0session_max_rows=30disp_direction=horizontalrepe at_c ells=100dontlimitchars=0sql_query=SELECT++%2A+%0AFROM++%60folders%60++ ORDE R+BY+%60folderID%60+ASCfolderID http://localhost/phpmyadmin/sql.php?lang=en-iso-8859-1server=1db=tree +tes ttable=folderspos=0session_max_rows=30disp_direction=horizontalrepe at_c ells=100dontlimitchars=0sql_query=SELECT++%2A+%0AFROM++%60folders%60++ ORDE R+BY+%60parentID%60+ASCparentID http://localhost/phpmyadmin/sql.php?lang=en-iso-8859-1server=1db=tree +tes ttable=folderspos=0session_max_rows=30disp_direction=horizontalrepe at_c ells=100dontlimitchars=0sql_query=SELECT++%2A+%0AFROM++%60folders%60++ ORDE R+BY+%60level%60+ASClevel http://localhost/phpmyadmin/sql.php?lang=en-iso-8859-1server=1db=tree +tes ttable=folderspos=0session_max_rows=30disp_direction=horizontalrepe at_c ells=100dontlimitchars=0sql_query=SELECT++%2A+%0AFROM++%60folders%60++ ORDE R+BY+%60name%60+ASCname 1 0 0 parent 1 2 0 0 parent 2 3 0 0 parent 3 4 0 0 parent 4 5 0 0 parent 5 6 1 1 child of 1 7 3 1 child of 3 8 1 1 child 2 of 1 9 6 2 sub-child 1 10 6 2 sub-child 2 11 10 4 sub-sub 1 12 10 4 sub-sub 2 13 11 5 sub-sub-sub 1 Current code looks like this, the 2 subfunctions prints the branches, the main function below prints the root structure...: function count_children($parentID) { // count number of children in folder $count = mysql_query(SELECT COUNT(*) AS num_children FROM folders WHERE `parentID`='$parentID'); $numrows = mysql_fetch_array($count); return $numrows['num_children']; } function print_children($parentID) { // print the branch of sub-folders $children = mysql_query(SELECT folderID,level,name FROM folders WHERE `parentID`='$parentID'); while($child = mysql_fetch_array($children)) { $folderID = $child['folderID']; $name = $child['name']; $level = $child['level']; for ($i = 0; $i $level; $i++) { echo('middot'); } echo(middot; a href=\test1.php?folderID=$folderID\$name/abr\n); // let's find children... recursive call !! if (count_children($folderID) 0) { print_children($folderID); } } } // get root parents -- main tree function $parents = mysql_query(SELECT folderID,name FROM folders WHERE `parentID`='0'); while($folder = mysql_fetch_array($parents)) { $folderID = $folder['folderID']; $name = $folder['name']; echo(middot; a href=\test1.php?folderID=$folderID\$name/abr\n); // let's find children... if (count_children($folderID) 0) { print_children($folderID); } } The output of all this looks like this: . http://localhost/tests/tree%20structure/test1.php?folderID=1parent 1 .. http://localhost/tests/tree%20structure/test1.php?folderID=6child of 1 ... http://localhost/tests/tree%20structure/test1.php?folderID=9sub-child 1 ...
Re: [PHP-DB] javascript question
Maybe you forgot a ?: Alert(?php echo $message ; ?); or ^^^ Ignatius _ - Original Message - From: Gamze Baaran [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 08, 2004 2:49 PM Subject: [PHP-DB] javascript question Hi everyone; First of all I'm sorry maybe I musn't send this mail to this list but I think that someone can help me. Here is my problem: I use pear templates. In my html template file there is an javascript like this: function validateAll (objForm){ if (objForm.comp_prg.selectedIndex == 0) { alert (You must choose something); return false; } Return true; } This code is true. But I want to use php variable in this code. Alert sentence must be a php_variable. I try Alert(php $message?); or Alert(php echo$message;*); But I it isn't work. Can anybody help me?? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] I'm new on the list and have a question.
Check the excellent JPgraph library. http://www.aditus.nu/jpgraph/ _ - Original Message - From: Carlos D. Carrasco [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, March 06, 2004 17:32 Subject: [PHP-DB] I'm new on the list and have a question. Hi, My name is Carlos, and I' trying to make a graphic X, Y of some data that I have, and I know that it is posible to do this in PHP, can you help me??? Cheers! Carlos. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SELECT
SELECT ... FROM users WHERE FIND_IN_SET( 2, values ) 0 Ignatius _ - Original Message - From: peppe [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 04, 2004 12:28 Subject: [PHP-DB] SELECT Hi I have a table users with columns name email and access In email I have values [EMAIL PROTECTED] etc in access I have values 1,2,3,4,7,8 How can I filter value 2 ? Beacause I need only users with value 2 to send email Greetings -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SELECT
?? Didn't you say that $access[1] contains sets such as 1,2,3,4,7,8? Why compare it to 2? _ - Original Message - From: peppe [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 04, 2004 13:22 Subject: Re: [PHP-DB] SELECT Hi I made this query $sql= SELECT * FROM users WHERE FIND_IN_SET( 2, access ) 0 ; $result = mysql_query($sql); $numRows = mysql_num_rows($result); for ($row =1; $row = $numRows; $row++) { $rowArray = mysql_fetch_array($result); $access1 = $rowArray[1]; if ($access1 =='2'){ echo Access is 2 ; } else { echo acces is not 2; } } I get always access not 2 how can I make this If works Ignatius Reilly [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] SELECT ... FROM users WHERE FIND_IN_SET( 2, values ) 0 Ignatius _ - Original Message - From: peppe [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 04, 2004 12:28 Subject: [PHP-DB] SELECT Hi I have a table users with columns name email and access In email I have values [EMAIL PROTECTED] etc in access I have values 1,2,3,4,7,8 How can I filter value 2 ? Beacause I need only users with value 2 to send email Greetings -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Php datetime
You can do it in SQL: INSERT ... SET col = NOW() Ignatius _ - Original Message - From: ..: GamCo :.. Gawie Marais [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 04, 2004 14:35 Subject: [PHP-DB] Php datetime hi, i have created a mysql table where i would like to store the date and time whenever a user logs into a web site. the login is done through php/mysql as well but i'm not sure what the php code is to add the current date/time into a mysql database. the field in the db is created as a 'datetime' field. Regards, Gawie Marais ..: GamCo :.. -- Tel: +27 11 312 0481 Fax: +27 11 312 0483 / +27 82 239 2986 http://www.gam.co.za -- if(empty($beer)) { getbeer() } else { consume($beer) } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] plain-text file (.txt) to mysql database
G'day, mate, With MySQL LOAD statement, you can specify which columns of your text file goes to what DB column. HTH Ignatius _ - Original Message - From: JeRRy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 01, 2004 10:08 Subject: [PHP-DB] plain-text file (.txt) to mysql database Hi, Quick question, does anyone know of a program/site that could do the following: I have a .txt file written in notepad. Bob Someone Mr Now I have a db with the fields: First Last Title Now the .txt file looks something like this: Bob Someone Mr Susan Taylor Miss Andrea Nothing Ms ... Now I want to use a Program/site to put the names in the right field. So each field is seperated by a space as shown above. I have about 1000 entries to put in and don't think doing each query per line is going to be a 5 min job, any suggestions? Thanks! Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] plain-text file (.txt) to mysql database
In your case something like this will do: LOAD DATA INFILE data.txt INTO TABLE my_table FIELDS TERMINATED BY ' ' LINES TERMINATED BY '\r\n'# or '\n' - depending on your system IGNORE 1 LINES# if applicable ( First, Last, Title ) # actual order of your columns in your txt file, mapping columns names HTH Ignatius _ - Original Message - From: JeRRy [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, March 01, 2004 10:44 Subject: Re: [PHP-DB] plain-text file (.txt) to mysql database Hi, So would I need to edit anything in my .txt file? Could you show me an example on what you mean by: you can specify which columns of your text file goes to what DB column. Because my text file has first , last , title seperated by a space and a new entry is seperated by a enter. (new line) I took a look at www.mysql.com and had a read on 'LOAD DATA' but am not 100% sure on how it works with my sort of .txt file setup. If you could show me an example that worked with my .txt file that would be great, or would I need to edit my .txt file somewhat? Sorry about this, never used a .txt file for use of mysql before but since I need to do alot of entries at once it would be the easiest way to do it. Thanks! --- Ignatius Reilly [EMAIL PROTECTED] wrote: G'day, mate, With MySQL LOAD statement, you can specify which columns of your text file goes to what DB column. HTH Ignatius _ - Original Message - From: JeRRy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 01, 2004 10:08 Subject: [PHP-DB] plain-text file (.txt) to mysql database Hi, Quick question, does anyone know of a program/site that could do the following: I have a .txt file written in notepad. Bob Someone Mr Now I have a db with the fields: First Last Title Now the .txt file looks something like this: Bob Someone Mr Susan Taylor Miss Andrea Nothing Ms ... Now I want to use a Program/site to put the names in the right field. So each field is seperated by a space as shown above. I have about 1000 entries to put in and don't think doing each query per line is going to be a 5 min job, any suggestions? Thanks! Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] plain-text file (.txt) to mysql database
Two ways: - full path (like c:/temp/data.txt) - simple file name: MySQL will assume the file is located in the current database data directory (like d:/mysql/data/my_database) _ - Original Message - From: JeRRy [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED] Sent: Monday, March 01, 2004 11:15 Subject: Re: [PHP-DB] plain-text file (.txt) to mysql database Hi, Right now I understnad. Thanks for the example. :) As for data.txt ... Where should I pop this on my server? In the root of my account? (e.g. ~/data.txt ?) J --- Ignatius Reilly [EMAIL PROTECTED] wrote: In your case something like this will do: LOAD DATA INFILE data.txt INTO TABLE my_table FIELDS TERMINATED BY ' ' LINES TERMINATED BY '\r\n'# or '\n' - depending on your system IGNORE 1 LINES# if applicable ( First, Last, Title ) # actual order of your columns in your txt file, mapping columns names HTH Ignatius _ - Original Message - From: JeRRy [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, March 01, 2004 10:44 Subject: Re: [PHP-DB] plain-text file (.txt) to mysql database Hi, So would I need to edit anything in my .txt file? Could you show me an example on what you mean by: you can specify which columns of your text file goes to what DB column. Because my text file has first , last , title seperated by a space and a new entry is seperated by a enter. (new line) I took a look at www.mysql.com and had a read on 'LOAD DATA' but am not 100% sure on how it works with my sort of .txt file setup. If you could show me an example that worked with my .txt file that would be great, or would I need to edit my .txt file somewhat? Sorry about this, never used a .txt file for use of mysql before but since I need to do alot of entries at once it would be the easiest way to do it. Thanks! --- Ignatius Reilly [EMAIL PROTECTED] wrote: G'day, mate, With MySQL LOAD statement, you can specify which columns of your text file goes to what DB column. HTH Ignatius _ - Original Message - From: JeRRy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 01, 2004 10:08 Subject: [PHP-DB] plain-text file (.txt) to mysql database Hi, Quick question, does anyone know of a program/site that could do the following: I have a .txt file written in notepad. Bob Someone Mr Now I have a db with the fields: First Last Title Now the .txt file looks something like this: Bob Someone Mr Susan Taylor Miss Andrea Nothing Ms ... Now I want to use a Program/site to put the names in the right field. So each field is seperated by a space as shown above. I have about 1000 entries to put in and don't think doing each query per line is going to be a 5 min job, any suggestions? Thanks! Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SUM and JOIN together
Unless you are using 4.1 (which allows subqueries), you should perform 3 queries, the first 2 creating temporary tables: - sum - difference - left join Ignatius _ - Original Message - From: rogue [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 19, 2004 04:24 Subject: [PHP-DB] SUM and JOIN together Hi all, Not sure how to handle this situation and was hoping someone with a bigger brain then me could help. 2 tables tbl_hoursbought id | client | hours 1 | test | 5 2 | test | 10 tbl_hoursused id | client | hours 1 | test | 3 What I am trying to do is sum the hours bought and the hours used, then subtract the values to get the available hours. The problem I am having is that I get a multiple (based on how many rows are in the first table) of the value in the second table. Here is my query: select sum(tbl_hoursbought.hours) as bought, sum(tbl_hoursused.hours) as used from tbl_hoursbought left join tbl_hoursused on tbl_hoursbought.client = tbl_hoursused.client and tbl_hoursbought.client = $id So my results return 15 for bought (which is correct) but I get 6 for used since there are 2 rows in bought (I think). I figure I could just divide that by the number of results, but is there a 'correct' way of doing it in the SQL statement? Thanks for any help. Please copy me with any replies as I am on the digest. thanks, rogue -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Brick Codes
Hmmm... Better try: WHERE (LEFT( Brick,3) = LEFT(`Post Code`,3)) ^^ no quotes^^ back ticks (because of the space in the column name) HTH Ignatius _ - Original Message - From: Ricardo Lopes [EMAIL PROTECTED] To: Shaun [EMAIL PROTECTED] Cc: PHP DB [EMAIL PROTECTED] Sent: Tuesday, February 17, 2004 10:23 Subject: Re: [PHP-DB] Brick Codes That may depend of what database server you are using, for mysql you can use: WHERE (LEFT('Brick',3) = LEFT(Post Code,3)) If you are using other dbserver, check your manual. - Original Message - From: Shaun [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 16, 2004 10:45 PM Subject: [PHP-DB] Brick Codes Hi, I have a table of Locations around the country. My system produces reports based on these Locations. I also have a table containing Brick Codes e.g. BrickPost Code AB51AB51 AB52AB52 AB55AB55 AB56AB56 AL01AL1 AL02AL2 AL03AL3 AL04AL4 How can I compare the first 3 or 4 letters of the postcode in the Locations table to the corresponding entry in the Brick Codes table so I can add it to my report? Thanks for your help -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help With An UPDATE Query Please
UPDATE table SET column = CONCAT( MID( column, 2, LENGTH( column ) - 1 ), MID( column, 1, 1 ) ) WHERE column LIKE 'M%' HTH Ignatius _ - Original Message - From: Shaun [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 10, 2004 14:15 Subject: [PHP-DB] Help With An UPDATE Query Please Hi, How can I update a column where the first letter begins with 'M' and adjust it so that column ends with 'M' instead. So something like 'UPDATE table SET column = 'xxxM' WHERE column = 'Mxxx'. I hope this explains what I am trying to achieve! Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Question
Quotes: $_POST['testField'] _ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 07, 2004 20:36 Subject: [PHP-DB] Question Dear friends, On submitting form to mysql database I get a parse error,There is no problem with connection code, Problem is some where around create the sql statement Can any one figure out where is the precise error, please. Following is the code from php file ?php // open the connection $conn = mysql_connect(localhost, , ); // pick the database to use mysql_select_db(testDB,$conn); // create the SQL statement $sql = INSERT INTO testtable values ('{$_POST[testField]}',' {$_POST[testFielda]}','{$_POST[testFieldb]}','{$_POST[testFieldd]}',' {$_POST[testFieldc]}','{$_POST[testFielde]}'); // execute the SQL statement if (mysql_query($sql, $conn)) { echo record added!; } else { echo something went wrong; } ? -- --- Asif -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] FW: db design - which is better
Use the second design. SQL 101 / 1st normal form. _ - Original Message - From: mayo [EMAIL PROTECTED] To: php-db [EMAIL PROTECTED] Sent: Saturday, February 07, 2004 23:19 Subject: [PHP-DB] FW: db design - which is better -Original Message- From: Gilbert Midonnet [mailto:[EMAIL PROTECTED] Sent: Saturday, February 07, 2004 5:09 PM To: php-db Subject: db design - which is better I have a client who has hundreds of articles. Each article can be seen by one or more permission groups. I have questions regarding setting up the an article_display table. The easiest table to read and to conceptualize would list the articles and use a boolean for each of the permission groups (let's call the PGs for this example). (articleNameID refers back to the article table) articleNameID---PG1---PG2---PG3---PG4---PG5 1001-1-0-0-0-0 1002-1-1-0-0-0 1003-0-0-1-0-0 Or should the table set up be: articleNameID--PG 10011 10021 10022 10033 etc... gil -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Rules in a database
If you string-concatenate atomic rules in a field, IMHO you will never manage to extract any information. Parsing these strings will be a nightmare. With the fully normalized model I have in mind, your SQL should be a breeze. This is quite logical after all: your flattened rules are polynoms of degree 1 in an arbitrary number of variables; each monome of which is homéomorphic (?) to a subset of the rule set. This structure matches well the representation of records in a SQL table as set elements: - it is easy to check that a given monome exists, - then it is easy to check that the required monomes have been associated as a complex rule. HTH (hope I am right! - not tested) Ignatius _ - Original Message - From: John Dillon [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED] Sent: Saturday, February 07, 2004 20:56 Subject: Re: [PHP-DB] Rules in a database Thanks for that. I understand you'd have one table with simple phrases like a=b being atomic rule 1, c=d being atomic rule 2...e=f being atomic rule 4, say; the second table with 1,2 as an AND group rule 1, being the 2 alternative - OR - conditions, one of which must exist; and the third table with 1-4, stating that AND group rule 1 would lead to result 4. In total, if 1 or 2 is true then e=f. I think, however, that I might find it easier to combine: - store AND rule groups in a table (1-n relation to the atomic table) - store full rules in a table (1-n relation to the AND table) into one table column and use string functions to extract the rule. The first table remains the same, being a list of a=b rules. The second table might have a record in the IF field +(12 OR 3) AND (13 OR 4) and 4 in the THEN field.. Looking beyond to the sort of queries I might want to run. If I knew a condition was true, say condition 12, I would want to know what possible rules might be relevant (I think of a rule as an IF:THEN set). Or if I knew two conditions were true, say 12 and 13, I would want to know what rules applied when those two conditions were true. The queries would be: SELECT full_rule FROM full_rules_table WHERE INSTR('/12/',IF) - I don't know if that INSTR works as shown. That would tell me if the rule might apply. To know whether the rule would actually apply - is fully qualified - I need to know if condition 13 - or alternative 4) is also true. I envisage parsing the expression +(12 OR 3) AND (13 OR 4) into array elements (12 OR 3) and (13 OR 4) and then going through each and comparing to the conditions I know exist, then reporting various facets of the rule, including alternatives or additional conditions required. The report would contain information like: These conditions are true to start with. The following results follow (since all conditions needed are true) - the same result would occur in alternative conditions: ..instead of condition 12 condition 3 applied etc The following results could occur if additional conditions were true:... - result 1 ...the following extra conditions are requiredetc. Do you think this is feasible? Regards, John - Original Message - From: Ignatius Reilly [EMAIL PROTECTED] To: DB list PHP [EMAIL PROTECTED]; John [EMAIL PROTECTED] Sent: Friday, February 06, 2004 3:13 PM Subject: Re: [PHP-DB] Rules in a database A bit of algebra first: any expression formed of atomic expressions, AND, OR and parentheses can be reduced to a canonical form, by using the De Morgan laws: a AND ( b OR c ) is equiv. to a AND b OR a AND c So a rule can eventually be reduced to AND groups, joined by OR: a(1) AND... AND a(n) OR ... OR z(1) AND ... AND z(p) Each AND group contains 1 or more rules. Therefore, to model input rules: - store atomic rules in a table - store AND rule groups in a table (1-n relation to the atomic table) - store full rules in a table (1-n relation to the AND table) Now you can model output rules likewise, and finally create a table of associations between input and output rules Problem is: once you've flattened your rules to the canonical form, they can become illegible. So perhaps a hierarchical data model (XML) would be more appropriate, for your rules would remain human-legible (and thererfore human-maintainable) HTH Ignatius _ - Original Message - From: John [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 06, 2004 15:35 Subject: [PHP-DB] Rules in a database I work in tax and thus have to read legislation - some complex - and I wanted to store some of the logic in a database so that if I know certain conditions were true I could look up what results this might have. Thus I am thinking of having two tables - one of phrases and the other of how these phrases are linked together as rules. A rule structure could be: IF A THEN B IF A OR A1 OR A2 THEN B IF A THEN B
Re: [PHP-DB] FW: db design - which is better
Hmmm... What of maintenance? One day your pointed-headed boss asks you to add a civility field (Mr|Mrs|Colonel|...), a birthdate, etc. How do you do that with a 1-table design? You will have to create 1-NF temporary tables in the process... How do you search for an author? You will have to create a needlessly large and inefficient index on (LastName + FirstName), instead of a nice integer index. And when querying the articleID, I do not think that there should be a significant performance penalty, if your indexes are properly designed. cheers Ignatius _ - Original Message - From: mayo [EMAIL PROTECTED] To: php-db [EMAIL PROTECTED] Sent: Sunday, February 08, 2004 00:10 Subject: RE: [PHP-DB] FW: db design - which is better Let's say you have a page that is hit fairly frequently and spits out 100s of results. On it you have articleTitle, authorFName, authorLName. I ran a few tests and found that if all the above fields are in one table it gets processed quicker than if there's a join. (authorID - authorFName, authorLName) So, I'm beginning to think that processing time would be quicker if I insert authorFName and authorLName into 2 tables. One the author table and the other the *VERY* frequently hit article table. That way when someone wants a list of articles, author FName, author LName all the data comes from one table. This would be probably very stupid in a financial or medical database which has tens of millions of records and 100s if not 1000s of tables but SEEMS (I'm very open to being corrected) to work better on a fairly small web accessed database. yours, Gil -Original Message- From: Ignatius Reilly [mailto:[EMAIL PROTECTED] Sent: Saturday, February 07, 2004 6:01 PM To: mayo; php-db Subject: Re: [PHP-DB] FW: db design - which is better There are perhaps such times, but I have yet to meet one. with 1NF: - your table space will be smaller - your indexes will work better - your SQL will be easier to write - ease of maintenance Just my 2 Belgian francs Ignatius _ - Original Message - From: mayo [EMAIL PROTECTED] To: php-db [EMAIL PROTECTED] Sent: Saturday, February 07, 2004 23:45 Subject: RE: [PHP-DB] FW: db design - which is better Thanks, There just seems to be times when non-normalized table structures are easier to work with. A few hundred to a few thousand records, maybe 20 fields, rarely adding another field. I wonder sometimes whether it make sense to put everything in one table instead of using joins. yours, putting-his-foot-in-his-mouth, Gil -Original Message- From: Ignatius Reilly [mailto:[EMAIL PROTECTED] Sent: Saturday, February 07, 2004 5:33 PM To: mayo; php-db Subject: Re: [PHP-DB] FW: db design - which is better Use the second design. SQL 101 / 1st normal form. _ - Original Message - From: mayo [EMAIL PROTECTED] To: php-db [EMAIL PROTECTED] Sent: Saturday, February 07, 2004 23:19 Subject: [PHP-DB] FW: db design - which is better -Original Message- From: Gilbert Midonnet [mailto:[EMAIL PROTECTED] Sent: Saturday, February 07, 2004 5:09 PM To: php-db Subject: db design - which is better I have a client who has hundreds of articles. Each article can be seen by one or more permission groups. I have questions regarding setting up the an article_display table. The easiest table to read and to conceptualize would list the articles and use a boolean for each of the permission groups (let's call the PGs for this example). (articleNameID refers back to the article table) articleNameID---PG1---PG2---PG3---PG4---PG5 1001-1-0-0-0-0 1002-1-1-0-0-0 1003-0-0-1-0-0 Or should the table set up be: articleNameID--PG 10011 10021 10022 10033 etc... gil -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http
Re: [PHP-DB] Associated popup menu (php/mysql)
By pop-up do you really mean pop-up or rather drop-down boxes? Have a look at the PEAR Quickform class and its hierselect form element (hierarchical dropdown boxes) http://pear.php.net/manual/en/package.html.html-quickform.tutorial.php HTH Ignatius _ - Original Message - From: Micah Stevens [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 06, 2004 02:33 Subject: Re: [PHP-DB] Associated popup menu (php/mysql) Javascript is client side programming, PHP is server side and unable to control actions and make decisions on what's happening in the browser except in a 'third person' manner. Simply put, you can't do this with PHP. On Thu February 5 2004 5:21 pm, alb_shop wrote: Hello all, I've been searching for hours and cannot find the answer or sample in in any forum. What is the best method (any sample or help would be appreciated), to associate popup menus in a form. Choosing the first popup menu (Main categorie) should provide to me the results for the second popup menu (subcategory). Ie : Countries -- states I know that javascript can do this sort of things, but I would like to use only php. Is that possible ? I have two tables in mysql: Countries states that can be associated by id_country. Thank you -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Acessing a excel worksheet from a php site
Check this class: http://sourceforge.net/projects/phpexcelreader/ HTH Ignatius _ - Original Message - From: Griffiths, Daniel [EMAIL PROTECTED] To: Bruno Pereira [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, February 06, 2004 10:10 Subject: RE: [PHP-DB] Acessing a excel worksheet from a php site I dont know any way to actually open and read the file with php, havent come across any classes or methods that will do this. My solution when I had this problem was to do it in 2 parts, run a macro on the excel file that will extract the data to a text file and then use php to read that into the db. if there is a way to open excel files and read them with php i'd love to know about it. -Original Message- From: Bruno Pereira [mailto:[EMAIL PROTECTED] Sent: 06 February 2004 03:36 To: [EMAIL PROTECTED] Subject: [PHP-DB] Acessing a excel worksheet from a php site I'm making a site to a company and they have a excel worksheet where i have to get the data to a site in php. My question is simple, i think, how can i get it? Cumprimentos Bruno Pereira DSI [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Rules in a database
A bit of algebra first: any expression formed of atomic expressions, AND, OR and parentheses can be reduced to a canonical form, by using the De Morgan laws: a AND ( b OR c ) is equiv. to a AND b OR a AND c So a rule can eventually be reduced to AND groups, joined by OR: a(1) AND... AND a(n) OR ... OR z(1) AND ... AND z(p) Each AND group contains 1 or more rules. Therefore, to model input rules: - store atomic rules in a table - store AND rule groups in a table (1-n relation to the atomic table) - store full rules in a table (1-n relation to the AND table) Now you can model output rules likewise, and finally create a table of associations between input and output rules Problem is: once you've flattened your rules to the canonical form, they can become illegible. So perhaps a hierarchical data model (XML) would be more appropriate, for your rules would remain human-legible (and thererfore human-maintainable) HTH Ignatius _ - Original Message - From: John [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 06, 2004 15:35 Subject: [PHP-DB] Rules in a database I work in tax and thus have to read legislation - some complex - and I wanted to store some of the logic in a database so that if I know certain conditions were true I could look up what results this might have. Thus I am thinking of having two tables - one of phrases and the other of how these phrases are linked together as rules. A rule structure could be: IF A THEN B IF A OR A1 OR A2 THEN B IF A THEN B AND C I was wondering how to do this. For instance, each rule could be one record in the table. The rules table has fields, IF and THEN. The ID field is the rule ID. Assume the phrases are numbered. One IF record could say: +/12/41/31/+/90/ meaning if phrases 12, 41 or 31 are true and phrase 90 is true. Then if I have a real situation where condition 12 is true, for instance, I can find it and access it using sub string functions. Does this scheme seem OK? Has anyone done anything like this before? Regards, John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] From MySQL to EXCEL
C'est possible! I use the PEAR Spreadsheet_Excel_Writer for this purpose. Very nice. HTH Ignatius _ - Original Message - From: Christine Clerc [EMAIL PROTECTED] To: PHP DB list [EMAIL PROTECTED] Sent: Monday, February 02, 2004 11:02 Subject: [PHP-DB] From MySQL to EXCEL Hi, I need to turn data extracted from MySQL into an EXCEL spreadsheet (.xls, not a .txt that is imported into Excel). Is it possible ? Thank you. Christine -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Row count in a query
The best way I can think of is: - create a temporary table T with an autoincrement field + desired output column structure - perform a INSERT INTO T SELECT 0, desired output in the temp table - you now have the desired result in your temp table HTH Ignatius _ - Original Message - From: Shaun [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, January 31, 2004 11:44 Subject: [PHP-DB] Row count in a query Hi, Is it possible to have an incrementing row count in my query that is not part of the table data? i.e. 1 data data 2 data data 3 data data ... This has to be done in the query not the PHP!! Thanks for your help -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Row count in a query
Hmmm... I would not bet money on John Holmes bad coding. (disclaimer: I have no financial stake in PHP|A, other than being a happy subscriber) More likely the original question was not well formulated. cheers Ignatius _ - Original Message - From: Martn Marqus [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Shaun [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, January 31, 2004 18:00 Subject: Re: [PHP-DB] Row count in a query El Dom 01 Feb 2004 12:54, John W. Holmes escribi: Shaun wrote: Is it possible to have an incrementing row count in my query that is not part of the table data? i.e. 1 data data 2 data data 3 data data ... This has to be done in the query not the PHP!! If you _have_ to get this in your query I'd say you have a flaw in your logic somewhere. However, you can do it in MySQL using these two queries. SELECT @a:=0; SELECT @a:[EMAIL PROTECTED], * FROM table; This isn't very good SQL coding. If you use a database with sequences, built a temptable to put the data in temporarly, with an INT field at the begining, and a sequence to have the autoincremental. Very easy, and compatile with any relational DB. :-) -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martn Marqus | Programador, DBA Centro de Telemtica | Administrador Universidad Nacional del Litoral - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] counting a value
SELECT favourite_nb, COUNT(*) AS tally FROM mytable GROUP BY favourite_nb HTH Ignatius _ - Original Message - From: js [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 30, 2004 19:07 Subject: [PHP-DB] counting a value i want to know what i can use to count the number of times a value appears in a column listing where different values are listed. for example, say in the column of Favorite Number we have 100 students, and for each student his or her own row. and each student can pick a number from 1-10. So, we have a column of 100 rows and each field can contain either 1-10.Now, i want to know how can i count the number of times lets say the #2 appears in this list and give that count a number. so if #2 appears 43 times in that column, then i want it to say 2 is listed 43 times. how do i do this? thank you for your help with my beginner newbie questions. -james -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] multi-language site
Preliminary note: ALL projects should require a CLEAR seperation of code and appearance. Now: To do what you describe, if you present your data as a HTML table, I would suggest retrieving data from the DB as an arra, and using the PEAR HTML_Table class to display them. Very easy to learn and extremely powerful. In addition you can use XSLT if the news are stored as XML strings in the DB. HTH Ignatius _ - Original Message - From: Muhammed Mamedov [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED]; phpdb [EMAIL PROTECTED] Sent: Friday, January 16, 2004 13:57 Subject: Re: [PHP-DB] multi-language site Hello Ignatius, I am working on a project which requires a CLEAR seperation of code and appearance. Think of this: There is a page which lists news from DB in a specific manner (latest 10 added, and next,prev links on the bottom). Of course this requires some PHP code which will retrieve data from DB and display it. Firstly, designers design appearance of the page (in pure HTML/css) and then coders re-code that page embedding pieces of PHP code. What I want to do is to make this process as easy as possible for designers/coders. I am familiar with XML and XSLT, but in practise never used XSL to transform XML... What do you suggest? Waiting for your suggestions. M.Mamedov - Original Message - From: Ignatius Reilly [EMAIL PROTECTED] To: Dan Hewins [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, January 15, 2004 8:03 PM Subject: Re: [PHP-DB] multi-language site I would not consider a DB-based design. I use two approaches (sometimes mixed): 1. Write content in XML files (one per language) and transform them with XSLT. This is nice for mostly content-based sites. 2. Write the complete application in English and translate it with the excellent PHP gettext() extension. Makes it fast, efficient and very cheap to maintain. A better option for web applications. In any case the user's language must be stored in a session variable. HTH Ignatius _ - Original Message - From: Dan Hewins [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 15, 2004 18:50 Subject: [PHP-DB] multi-language site Forgive me if this is pedestrian or has been covered before. I'm new to the list and I haven't used PHP too much (yet). Here's my question: I'm looking to use PHP for an upcoming site project where the site needs to be in either English or Spanish. Would PHP be a good approach? I was envisioning having a database with every text bit and image with text in it in two columns, one for English, and one for Spanish. Then each web page would reference some kind of global variable (a cookie?) to determine whether to pull the images and text from the English column or the Spanish column. Does this sound like a good approach? Is PHP capable of something like this? Thanks for any help or suggestions you can give. Dan Hewins -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] multi-language site
Usually it is the other way round: to assemble a page, a script will call successively several XSLT transformations: eg top, left nav bar, central content, footer... Each XSLT call returns HTML from content stored in XML. Ignatius I also wonder if XSLT can accept any php code? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL general Question...
Standard SQL for comparing strings is LIKE '=' in lieu of 'LIKE' is a MySQL extension to SQL, therefore non-standard. Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 16, 2004 15:39 Subject: [PHP-DB] MySQL general Question... What's teh diffence between 'LIKE' '=' EG: SELECT FROM my_table WHERE 'email' LIKE '[EMAIL PROTECTED]' I've just purchased an E-mail marketing piece of software, and was peakign in the code... Found that... Never seen it before (Have I been living in a box?) Cheers, Tris... * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] multi-language site
The same can be achieved in a much simpler way with Gettext! With gettext, you send a file to your translator, and receive the same file completed. Period. Instead of logging to a DB, the translator simply creates string translations with a user-friendly editor, such as the excellent POEdit (http://poedit.sourceforge.net) for Windows. Takes a dummy 2 minutes to understand how it works. I guarantee that with this method you will translate 500 strings in less than a day. In contrast, updating DB records one by one is much longer: requires a broadband connection, no cut-and-paste available (believe me, there is a lot of such!) Also, later updating your DB concurrently will be a nightmare. With Gettext, you simply regenerate the master file (eg English) from the application and send the language files to the translator(s). The few strings that are not yet translated will appear nicely in their editor. HTH Ignatius _ - Original Message - From: Dan Hewins [EMAIL PROTECTED] To: [EMAIL PROTECTED]@[EMAIL PROTECTED] Sent: Friday, January 16, 2004 16:28 Subject: Re: [PHP-DB] multi-language site This is true. And another aspect I forgot to mention is an admin version of the whole site because the user wants to be able to update and change text in either the English or Spanish site. This way I only have to build (design, code HTML) the site once and then I essentially have four different sites (English, Spanish, Admin-Eng, Admin-Esp). A separate question is this: where are the good resources for XML on the web? Thanks. Dan On Jan 16, 2004, at 4:18 AM, [EMAIL PROTECTED] wrote: The advantage of doing it the way Dan describes is that it is very easy to set up an admin tool for the person doing the translating. Dan can fill up the English half of the db, and then write a page that queries the db for any empty Spanish entries, displays them in a select box, and allows the translator to enter the Spanish text in to the db. This way, when new English text is added, all the translator has to do is check the page, the new phrases will automatically be displyed. The translator doesn't need any knowledge of HTML, and doesn't need to involve any other person to upload the text. Maybe this can be done with XML as well, I don't know. But we recently used this system for a English/French site I worked on and it worked very well. -Lisi = = = Original message = = = Forgive me if this is pedestrian or has been covered before. I'm new to the list and I haven't used PHP too much (yet). Here's my question: I'm looking to use PHP for an upcoming site project where the site needs to be in either English or Spanish. Would PHP be a good approach? I was envisioning having a database with every text bit and image with text in it in two columns, one for English, and one for Spanish. Then each web page would reference some kind of global variable (a cookie?) to determine whether to pull the images and text from the English column or the Spanish column. Does this sound like a good approach? Is PHP capable of something like this? Thanks for any help or suggestions you can give. Dan Hewins -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] multi-language site
I would not consider a DB-based design. I use two approaches (sometimes mixed): 1. Write content in XML files (one per language) and transform them with XSLT. This is nice for mostly content-based sites. 2. Write the complete application in English and translate it with the excellent PHP gettext() extension. Makes it fast, efficient and very cheap to maintain. A better option for web applications. In any case the user's language must be stored in a session variable. HTH Ignatius _ - Original Message - From: Dan Hewins [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 15, 2004 18:50 Subject: [PHP-DB] multi-language site Forgive me if this is pedestrian or has been covered before. I'm new to the list and I haven't used PHP too much (yet). Here's my question: I'm looking to use PHP for an upcoming site project where the site needs to be in either English or Spanish. Would PHP be a good approach? I was envisioning having a database with every text bit and image with text in it in two columns, one for English, and one for Spanish. Then each web page would reference some kind of global variable (a cookie?) to determine whether to pull the images and text from the English column or the Spanish column. Does this sound like a good approach? Is PHP capable of something like this? Thanks for any help or suggestions you can give. Dan Hewins -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] multi-language site
Hi. Richard, you seem to be confusing gettext with something else. Gettext is NOT an automated translation service. What you do is mark strings to translate in the original application, then have them translated by a human. When confronted with a marked string to echo, the application will look up in the translated file for the corresponding translation. Cheers Ignatius _ - Original Message - From: Hutchins, Richard [EMAIL PROTECTED] To: Dan Hewins [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, January 15, 2004 19:16 Subject: RE: [PHP-DB] multi-language site $.02 from a technical writer: If you're going to translate your content from English directly to a foreign language using machine translation (which is what gettext would amount to) be very careful. There is a difference between translation and localization. The free Babelfish service is a good example of translation. You'll get a word-for-word translation of whatever you want to type in the English box. However, what shows up in the translation box is not always what you meant in English. Have you ever bought a Japanese product whose instructions read: Use caution when opening my box. I wormhole swimming pool orange piranha yesterday, sir. Your best bet may be to write all of the English text, have it translated and put into XML files as Ignatius suggested, then use PHP to set/retrieve cookie settings to display the proper language. I can personally vouch for the difference between text that has been machine-translated only and text that has been machine translated and reviewed/corrected by a human. Machine translation cannot match a human's ability to compensate and account for context and usage. There are quite a few localzation companies (SH3, VistaTec, SDL International) who specialize in translating content for web sites even in XML format. Send them an English XML document, they'll send you a Spanish one back without messing with your tags - only the content gets translated. Of course, it DOES all come down to dollars and cents and how important the translation really is; only you can decide that. HTH Rich -Original Message- From: Ignatius Reilly [mailto:[EMAIL PROTECTED] Sent: Thursday, January 15, 2004 1:03 PM To: Dan Hewins; [EMAIL PROTECTED] Subject: Re: [PHP-DB] multi-language site I would not consider a DB-based design. I use two approaches (sometimes mixed): 1. Write content in XML files (one per language) and transform them with XSLT. This is nice for mostly content-based sites. 2. Write the complete application in English and translate it with the excellent PHP gettext() extension. Makes it fast, efficient and very cheap to maintain. A better option for web applications. In any case the user's language must be stored in a session variable. HTH Ignatius _ - Original Message - From: Dan Hewins [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 15, 2004 18:50 Subject: [PHP-DB] multi-language site Forgive me if this is pedestrian or has been covered before. I'm new to the list and I haven't used PHP too much (yet). Here's my question: I'm looking to use PHP for an upcoming site project where the site needs to be in either English or Spanish. Would PHP be a good approach? I was envisioning having a database with every text bit and image with text in it in two columns, one for English, and one for Spanish. Then each web page would reference some kind of global variable (a cookie?) to determine whether to pull the images and text from the English column or the Spanish column. Does this sound like a good approach? Is PHP capable of something like this? Thanks for any help or suggestions you can give. Dan Hewins -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP-DB] multi-language site
Quite right. When implementing gettext, one will normally use the rule 1 string = 1 sentence (such as please select a country). _ - Original Message - From: Richard Davey [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 15, 2004 19:48 Subject: Re[2]: [PHP-DB] multi-language site Hello Ignatius, Thursday, January 15, 2004, 6:41:44 PM, you wrote: IR Gettext is NOT an automated translation service. What you do is mark strings IR to translate in the original application, then have them translated by a IR human. When confronted with a marked string to echo, the application will IR look up in the translated file for the corresponding translation. I use something very similar to this on a few of my sites. I had to get the whole sentences translated though - you cannot just get individual words translated and string them together because as you know, the order of the words varies dramatically from language to language. -- Best regards, Richardmailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: L'utente Fabio Farinelli ha cambiato indirizzo di posta elettronica.
Somebody with admin rights to this list please castrate this Farinelli user. Thanks _ - Original Message - To: Ignatius Reilly [EMAIL PROTECTED] Sent: Thursday, January 15, 2004 20:22 Subject: L'utente Fabio Farinelli ha cambiato indirizzo di posta elettronica. Il nuovo indirizzo è: [EMAIL PROTECTED] La mail è stata comunque inoltrata entro 60 minuti al nuovo indirizzo di posta. Si consiglia sin da subito l'utilizzo del nuovo indirizzo; a breve il vecchio indirizzo verrà inattivato. Questa è una mail di servizio. NON rispondere. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] calculations using variables in html table cell
If you have to build complex, dynamic tables, do yourself a favour and use a class that will allow you to feed directly arrays of numbers. I use PEAR HTML_Table, which is great and easy to use. You will have recouped the investment of learning the class after about one hour. HTH Ignatius _ - Original Message - From: Christopher Adams [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 21:07 Subject: [PHP-DB] calculations using variables in html table cell I am generating html tables dynamically. Each table has multiple columns and various calculations need to be done on each column and displayed at the bottom of the column. I am including the code from one table below. The $tablerow generates the table data and the $tablefooter generates the rows at the bottom that will include the calculated values. Preceding the $tablerow declaration, I have declared some variables and done calculations. I then included these in the $tablefooter to display the calculated values. This works fine. However, I have many other calculations on other columns in other tables. Using this method, I would have to declare many new variables just for calculations. I am wondering if there is a way to do these calculations directly in the table cells. I am pretty new to PHP and have not used calculations much. $sumpop += $POP; $sumadultcirc += $ADULTCIRC; $sumjuvcirc += $JUVCIRC; $tablerow[1] = trtd . $row[name] . /td . td$POPtd$ADULTCIRC/td td$JUVCIRC/tdtd$TOTCIRC/tdtd$CIRCPERCAP/tdtd$TOTREF/tdtd$R EFPERCAP/td/tr; $tablefooter[1] = trtdbTable total/b/tdtdb$sumpop/b/td tdb$sumadultcirc/b/tdtdb$sumjuvcirc/b/tdtdb$TOTCIRC/b /td tdb$CIRCPERCAP/b/tdtdb$TOTREF/b/tdtdb$refpercap/b/td /tr trtdbTable average or per capita/b/tdtdb$POPAV/b/td tdb$ADCIRCAV/b/tdtdb$JUDCIRCAV/b/tdtdb$TOTCIRCAV/b/td tdb$CIRCPERAV/btdb$TOTREFAV/btdb$REPERAV/b/td/tr; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Fonction timer
PHP est un langage de programmation, pas un daemon. Le plus simple est de créer des tâches automatisées qui exécutent des scripts PHP. Sous Windows 2000 c'est très facile: Scheduled Task Command prompt (terminer) Ensuite tu édites la scheduled task: Properties Run c:/php/php.exe c:/tasks/myscript.php HTH Ignatius _ - Original Message - From: Michel GUIRAUDOU [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, December 02, 2003 16:09 Subject: [PHP-DB] Fonction timer Bonjoour la liste, J'ai regardé la doc php, et je n'ai pas trouvé de fonction timer. Je souhaite lancer un timer à l'expiration duquel j'exécuterai un programme. Est ce possible? Y a t'il des fonctions ou des morceaux de programme facileme à reprendre pour faire ça? Merci pour votre aide, Message Classification: [X] General Public Use [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary Michel GUIRAUDOU MOTOROLA LABS (RASSEL) Radio Access System and Spectrum Engineering Lab Parc Les Algorithmes 91193 Gif sur Yvette Cedex Tel: 33.(0)1.69.35.48.23 Fax: 33.(0)1.69.35.25.01 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Fonction timer
Dear friend, you're besides the point and needlessly condescending. Michel was asking about something very different: PHP cron jobs, not time intervals. Ignatius _ - Original Message - From: Ivan Fomitchev [EMAIL PROTECTED] To: Michel GUIRAUDOU [EMAIL PROTECTED] Sent: Tuesday, December 02, 2003 19:23 Subject: Re: [PHP-DB] Fonction timer Hello Michel, MG J'ai regard la doc php, et je n'ai pas trouv de fonction timer. MG Je souhaite lancer un timer l'expiration duquel j'excuterai un programme. MG Est ce possible? Y a t'il des fonctions ou des morceaux de programme MG facileme reprendre MG pour faire a? ! , , . time microtime ( , ). MG Merci pour votre aide, . -- Best regards, Ivan mailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Redirect.
header( Location: http://...; ) ; _ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, December 02, 2003 12:18 Subject: [PHP-DB] Redirect. Hi all, I have a problem.How can I redirect from a PHP script to another script in asp, php or a HTML page? This script redirect to another script in function of the values of a variable. Thanks in advance Francesco [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Updating multilple tables?
One possible reason you did not google back anything is that what you are asking can't be done in SQL. In SQL you can update only one table at a time. Why not write a PHP function that does the job successively on each table? To list tables in MySQL: SHOW TABLES FROM database name HTH Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: PHP DB list [EMAIL PROTECTED] Sent: Thursday, November 27, 2003 15:31 Subject: [PHP-DB] Updating multilple tables? I have scattered around about 100 tables a block of text... I wasn to serach through ALL my tables, and ALL my rows for this text, adn repalce it with another block of text. I've searched n google for mysql multiple table update But have yet to find an answer.. anyone know an easy way to do this? All the tables are on the same database, so I just need to say, search ALL tables within database Tris...? * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Updating multilple tables?
In MySQL: UPDATE mytable SETmycol = REPLACE( mycol, $replacee, $replaceor ) All you have to do is provide the loop some structure so that it can find the column to process eg an array( table = array( column1, ... ) ) or even better another table. Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED] Cc: PHP DB list [EMAIL PROTECTED] Sent: Thursday, November 27, 2003 16:02 Subject: Re: [PHP-DB] Updating multilple tables? All good, I've got a loop based on all my tables... (cheers for that) however, I still wanna look within an entry for a smaller entry.. EG: the quick brown frog jumped over the lazy dog I want to find and repace frog with fox but do this happens with text all over my database. I'll get there...! ;-) Ignatius Reilly [EMAIL PROTECTED] 27/11/2003 15:02 To PHP DB list [EMAIL PROTECTED], [EMAIL PROTECTED] cc Subject Re: [PHP-DB] Updating multilple tables? One possible reason you did not google back anything is that what you are asking can't be done in SQL. In SQL you can update only one table at a time. Why not write a PHP function that does the job successively on each table? To list tables in MySQL: SHOW TABLES FROM database name HTH Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: PHP DB list [EMAIL PROTECTED] Sent: Thursday, November 27, 2003 15:31 Subject: [PHP-DB] Updating multilple tables? I have scattered around about 100 tables a block of text... I wasn to serach through ALL my tables, and ALL my rows for this text, adn repalce it with another block of text. I've searched n google for mysql multiple table update But have yet to find an answer.. anyone know an easy way to do this? All the tables are on the same database, so I just need to say, search ALL tables within database Tris...? * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php / xml
The standard way is XSLT, for which PHP has excellent support. However, it takes some effort to learn the language. Get yourself XSLT by Michael Kay, Wrox Press. HTH Ignatius _ - Original Message - From: stefan bogdan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 26, 2003 08:32 Subject: [PHP-DB] php / xml hello i'm trying to make a pattern for an economic document using xml ex document id='unique' name='document_1' fixpart field id= 'id' visible='true' name='id' type='numeric' htmltype='textbox' /field filed id='name' visible='true' name='name' type='select' htmltype='select' sql='select 1,2 from table' value='1'2 /field /fixpart mobilepart .. /mobilepart i need a class that work with this kind of document fast an that can transform it quickly in html ps: do you think it is a good aproach thank you sbogdan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP and XML Parsing
If your is meant as a content data, as opposed to an entity call, then your XML is probably not valid. To write as a character, you can either: - use #x26; directly - declare an amp; entity having the value #x26 and write amp; in your document HTH Ignatius _ - Original Message - From: Rick Dahl [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 26, 2003 16:33 Subject: [PHP-DB] PHP and XML Parsing I have a piece of xml that has characters like and other non-normal ones. When I use the $this-parser = xml_parser_create(); functions it doesn't read the entire character sting inside the tag/tag. It stops at the . If I take out the it works perfectly. Any ideas on how I can fix this? Rick -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] convert date in german format
at the top of your script, do: setlocale ( LC_TIME, 'de_DE' ) ; (assumes your machine has German support installed) HTH Ignatius _ - Original Message - From: Ruprecht Helms [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 26, 2003 16:58 Subject: [PHP-DB] convert date in german format Hi, how can I convert a date stored in a mysql-database for output in the german format (dd.mm.yy). I tried date (d.m.y,$row-from); but I still get the english-format stored in the database. The databasefield is type date. Regards, Ruprecht -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Splitting a CSV file
You may have hit the browser time-out limit, which you can not control (at least for IE; don't know about others). To prevent this, arrange for the script send regularly some invisible content to the browser (eg send a HTML comment line every 100 lines of your CSV file) HTH Ignatius _ - Original Message - From: Chris Payne [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 25, 2003 18:54 Subject: Re: [PHP-DB] Splitting a CSV file Hi there, I did a test on my local machine, set the upload limit for PHP to 50Megs for forms (WAAA more than I need, but then atleast I know that isn't the problem). Then, I select the file through my web form, put in the delimiter which works great on small files. Then, I try the larger file - exactly the same format (As I just cut a portion of the file and pasted into another file about with just about 50 entries to test which worked) and then click send, but when I try to echo the result to debug, the array is totally empty, and even tells me it is empty, but only when the file is above a certain size (Not worked out what size that is yet though). The file itself is around 5.4 megs, and I know it's not a server timeout issue as i've increased everything I could find in my local Apache config, from a timeout of 300 to 3000 (Again, just to eliminate all possible courses that I can think of). The only thing I can think of is that there is some illegal char somewhere in the file, but I have no idea what that could be. I'm using the straight line up as the delimiter to avoid any , issues etc . as I know that | isn't used in the file at all. It's just getting to me, there has to be a reason why :-( I'm using the following code (Minus the bit that enters the DB into the database, as that works fine with small files so would with large too): if ($option == importcsv) { if ($userfile == ){ $failed = 'yes'; } else { $row = 1; $handle = fopen ($userfile,r); while ($data = fgetcsv ($handle, 10, |)) { $num = count ($data); $row++; echo $data[0];; }; fclose ($handle); }}; Chris I've never seen where the file size causes a problem that wasn't one of the file size settings either in the upload form or php.ini. I'd focus on figuring out why it's failing on the large files before trying to split it. No errors at all? Just a blank screen? Are you uploading the file through a browser? Ryan -Original Message- From: Matt Babineau [mailto:[EMAIL PROTECTED] Sent: Monday, November 24, 2003 2:37 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Splitting a CSV file Chris, If you are on a Redhat machine, you could try running a CLI command on this. Try looking up the 'split' command, it may solve your problem if you combine it with some PHP. -Matt On Mon, 2003-11-24 at 19:14, Chris Payne wrote: Hi there everyone, I'm writing an automation system to automatically insert data into a mysql database from a CSV file, and it works great - until I try to insert a large file, then it just doesn't do anything. I've set my PHP filesize to 10 Megs so that's not the issue, and a server timeout isn't the issue either. So, is that a way that I can split a CSV file into 2 files if it's larger than a certain size so that I can still use the automation I am working on? Actually, I won't see the files as it's for a company who just wants to be able to select their CSV file (No matter what size) and it will insert it automatically, and as I said it does work on small files but not large :-( Any help would really be appreciated. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] dynamic graph on web site
The jpgraph library is what you're looking for. _ - Original Message - From: Hull, Douglas D [EMAIL PROTECTED] To: Note To php mysql List (E-mail) [EMAIL PROTECTED] Sent: Monday, November 10, 2003 8:36 PM Subject: [PHP-DB] dynamic graph on web site In php/mysql is there a way to create a bar graph and/or a pie chart dynamically and then push the chart to the web? So depending on what information was selected during the filtering process would determine what data would be used to create the particular graph. Thanks, Doug -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Select Value with 's
SQL. Backticks force reading the string as a SQL object (db, table, column), as opposed to a string. Eg you could in theory have columns called select or Mes Documents, and do: SELECT * FROM `select` AS S, `Mes Documents`AS MD ... of course it is wholly unadvisable to do so. Best to steer clear of reserved words and use well-formed names, with a clear naming convention. Then you won't need backticks. HTH Ignatius _ - Original Message - From: pete M [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 06, 2003 1:58 PM Subject: Re: [PHP-DB] Select Value with 's why the backticks and not quotes ? pete Ma wrote: hi! do not quite understand your problem.. pls post some code? heres a small snippet that should work well... $qry = 'SELECT `customer` FROM `customerList` ORDER BY `customer`'; $res = mysql_query($qry); while($customer = mysql_fetch_object($res)) { echo stripslashes($res-customer).'br'.\n; } hth? _ma # life would be easier if i knew the source code... Von: Aleks @ USA.net [EMAIL PROTECTED] Datum: Wed, 5 Nov 2003 13:12:45 -0500 An: [EMAIL PROTECTED] Betreff: [PHP-DB] Select Value with 's This is a basic question but I am all messed up and need to be straightened out.. Have a select field called customer that works great except when there is a ' in the customer name. Have tried addslash and stripslashes but I think I might be using them wrong. If I addslash to the select value, the value received but the result page is truncated up to the point of the ' . Can someone refresh me on the correct use of add and strip slashes... please?? Thanks Aleks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] date function
have a look at the PEAR date package. http://pear.php.net/package/Date _ - Original Message - From: OpenSource [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, November 02, 2003 11:13 PM Subject: [PHP-DB] date function Hi guys, This might not be the best place for this but here goes. I want to create a dropdown list with a date range of -- SELECT name=bdate OPTION value=11/02/2003 SELECTEDToday OPTION value=11/01/2003Yesterday OPTION value=10/31/2003Fri 10/31 OPTION value=10/30/2003Thu 10/30 OPTION value=10/29/2003Wed 10/29 OPTION value=10/28/2003Tue 10/28 OPTION value=10/27/2003Mon 10/27 OPTION value=10/26/2003Sun 10/26 OPTION value=10/25/2003Sat 10/25 OPTION value=10/24/2003Fri 10/24 OPTION value=10/23/2003Thu 10/23 OPTION value=10/22/2003Wed 10/22 OPTION value=10/21/2003Tue 10/21 OPTION value=10/20/2003Mon 10/20 OPTION value=10/19/2003Sun 10/19 OPTION value=10/12/2003Sun 10/12 OPTION value=10/05/2003Sun 10/5 OPTION value=09/28/2003Sun 9/28 OPTION value=09/21/2003Sun 9/21 OPTION value=09/14/2003Sun 9/14 OPTION value=08/31/2003Sun 8/31 OPTION value=08/01/2003Fri 8/1 OPTION value=07/02/2003Wed 7/2 OPTION value=06/02/2003Mon 6/2 OPTION value=05/03/2003Sat 5/3 OPTION value=04/03/2003Thu 4/3 OPTION value=03/04/2003Tue 3/4 OPTION value=02/02/2003Sun 2/2 OPTION value=01/03/2003Fri 1/3 OPTION value=12/04/2002Wed 12/4 /SELECT -- I would like to know i can go about doing that. some examples, or if anyone has a function already the i could use. Thanks in advance, -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Using two colomns of mysql data as key/value pairs in arrays
mysql_fetch_array( $result ) _ - Original Message - From: Devon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, October 20, 2003 3:30 PM Subject: [PHP-DB] Using two colomns of mysql data as key/value pairs in arrays I have been scouring the online documentation and experimenting for hours trying to find a solution. I just can't do it. I have two colomns of data that I am retrieving from MySQL: SELECT id, name FROM a_table; I just cannot figure out how to get that data from the resource handle into an associative array with the 'id' colomn making up the keys and the 'name' colomn making up the values. Any help would be wonderful! :) Using PHP 4.3.3 on Linux if it matters. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Using two colomns of mysql data as key/value pairs in arrays
Easy, old boys. Nobody has holed or meant to hole anybody. Let's keep this ML what it is, that is a great learning and working instrument. Ignatius _ - Original Message - From: Jon Kriek [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, October 20, 2003 4:13 PM Subject: Re: [PHP-DB] Using two colomns of mysql data as key/value pairs in arrays That is your personal opinion to which you are entitled to, but again shooting someone down is just not the case in this situation. No, but IMNSHO he shot a rather rude hole in Ignatius. David T-G [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Multiple forms and multiple submissions
One solution is to use a javascript to set your hidden field to already_submitted (or such) at the end of the last form page. Therefore upon refresh, the user will come to the already submitted page. Add one already submitted switch case. BTW your construct switch ( ) { } else is quite non-standard. use 'default:' instead. Also if you go into these kind of forms, you will find it an immensely profitable investment to learn the PEAR Quickform and Quickform Controller. They do all the dirty work for you. You can design a tabbed form such as yours in a breeze. HTH Ignatius _ - Original Message - From: Tonya [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, October 18, 2003 8:20 AM Subject: [PHP-DB] Multiple forms and multiple submissions PHP 4.3.3 and MYSQL: I am using a multipage member registration system because all of the information is too long to put on one page. Some example code edited for brevity: Form regone with hidden field value personal Form regtwo with hidden field value computer Form regthree with hidden field value habits Form regfour with hidden field value comms Form regfive with hidden field value misc switch ($hidden) { case personal: -Check for existing users with same login name and require new login name if applicable -Check that all required fields are filled and return to form if not -Check eregs of all fields and format variables session_register('varone','vartwo','varthree',...); include (includes/regtwo.inc); break; case computer: -Check eregs of all fields and format variables session_register('varone','vartwo','varthree',...); include (includes/regthree.inc); break; case habits: -Check eregs of all fields and format variables session_register('varone','vartwo','varthree',...); include (includes/regfour.inc); break; case comms: -Check eregs of all fields and format variables session_register('varone','vartwo','varthree',...); include (includes/regfive.inc); break; case misc: -Check eregs of all fields and format variables // Prevent Double Submission upon refresh $checksub=mysql_query(Select * FROM mempersonal WHERE uniquevar='$uniquevar'); $rowcheck=mysql_num_rows($checksub); if ($rowcheck0){ $message=You are already entered into the member database. You cannot refresh this page.; include('includes/message.inc'); }else{ // Insert info into mempersonal $addtosql1=INSERT INTO mempersonal (varone,vartwo,varthree...) VALUES ('$varone','$vartwo','$varthree',...) $final1=mysql_query($addtosql1); // Insert info into memcomputer $addtosql2=INSERT INTO memcomputer (varone,vartwo,varthree...) VALUES ('$varone','$vartwo','$varthree',...) $final2=mysql_query($addtosql2); // Insert info into memhabits $addtosql3=INSERT INTO memhabits (varone,vartwo,varthree...) VALUES ('$varone','$vartwo','$varthree',...) $final3=mysql_query($addtosql3); // Insert info into memcomms $addtosql4=INSERT INTO memcomms (varone,vartwo,varthree...) VALUES ('$varone','$vartwo','$varthree',...) $final4=mysql_query($addtosql4); // Insert info into memmisc $addtosql5=INSERT INTO memmisc (varone,vartwo,varthree...) VALUES ('$varone','$vartwo','$varthree',...) $final5=mysql_query($addtosql5); $message=Hello $memberhandle! Your Registration is complete and an activation email has been sent to you. Please follow the instructions to activate your account. ; include('includes/message.inc'); session_unset(); session_destroy(); break; } Now, all of this works just dandy, inserts all the information to my database and returns the 'Registration Complete' message. However, the code I added to prevent double submission: // Prevent Double Submission upon refresh $checksub=mysql_query(Select * FROM mempersonal WHERE uniquevar='$uniquevar'); $rowcheck=mysql_num_rows($checksub); if ($rowcheck0){ $message=You are already entered into the member database. You cannot refresh this page.; include('includes/message.inc'); }else{ Add Everything to database } will allow the user to refresh and add a new row to the database ONCE - but only submitting variables from the LAST form to the LAST table (memmisc). The other tables from the previous forms are empty. Then, if the user tries to refresh AGAIN, the 'You are already entered' message appears. Any ideas on how I can fix this?? BTW, my coding is rudimentary - I have only been coding two weeks :) Tonya -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] query for multiple values
SELECT * FROM table WHERE column IN ( 'this', 'that', 'theother' ) Ignatius _ - Original Message - From: Robbie Staufer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 16, 2003 12:10 AM Subject: [PHP-DB] query for multiple values Hi, Is there a way to construct a mysql query that will select * for multiple values in the same column? For example: SELECT * FROM table WHERE column = 'this' and 'that' and 'theother' Thanks, Robbie -- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* Robbie Staufer NCAR/SCD 1850 Table Mesa Dr. Rm. 42 Boulder, CO. 80305 (303) 497-1836 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] TIME FORMAT USING PHP
$time = 0900 ; $time2 = substr( $time, 0, 2 ).:.substr( $time, 2, 2 ) ; Ignatius _ - Original Message - From: Delz [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, October 11, 2003 7:17 AM Subject: [PHP-DB] TIME FORMAT USING PHP Hi All, We have a time and attendance system that outputs the military time in and time out of an employee on an excel file wherein the format for the time is like this : 0900 1700 wherein 0900 is 9am and 1700 is 5pm. Is there a way in php where i can get output like this 09:00 17:00 which is more recognizable than the latter. Any ideas would be appreciated. Regards, Delz -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] REGEXP and Variables.
Can't you do without REGEX? eg WHERE employ_id = '($employ_id)' OR company LIKE '($name)' REGEXes are expensive. Ignatius _ - Original Message - From: Shannon Doyle [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 09, 2003 10:18 AM Subject: [PHP-DB] REGEXP and Variables. Hi People, Need a little assistance with the following MySQL query:- $query = SELECT employ_id,company FROM employers WHERE employ_id REGEXP '($employ_id)' OR company REGEXP '($name)' OR industry REGEXP '($industry)'; The above query gets the variables $employ_id, $name and $industry from a search box on a previous page. I can confirm that the variables are being parsed to the query. The problem is that the above query appears to match everything in the table, from any of the fields and thus just dumps out the entire contents of the table, instead of only selecting the ones that match the search criteria. Basically I have a variable passed to the query and it must return the values from the table that have the variable in its entirety somewhere in the fields value. In addition to this, once I have it selecting the correct values and returning them to me. What can I do to show a 'No Results' situation? Any help woul dbe gratly appreciated. Cheers, Shannon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL Regular expression
Problem is, REGEX will only test for a match, not returning anything other than 0|1 You can instead: 1. Use a UDF doing just that (counting occurences in a string): http://www.tsc.ro/free/ (haven't tried it myself, because no Windows dll available) 2. Replace successively all figures by '' and count length: SELECT CHARACTER_LENGTH( REPLACE( REPLACE( mycol, '1', '' ) , '2', '' ) ) ... and recurse - ugly, but works 3. Try successive REGEX matching the number of ',' with an integer 4. Best, of course, normalize your DB. But this may not be an option... HTH Ignatius _ - Original Message - From: O Franssen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 09, 2003 1:49 PM Subject: [PHP-DB] MySQL Regular expression I'm not a 100% sure if this is the correct list for the following question, so I shall apologise beforehand if I upset any one. Now, I have a field in my database table in the following format: 100,30,443, etc. Representing prices for 52(53) weeks of the year and comma delimited. Now I need to check the price for a given week within my query. The problem however is that the week number is variable. Is there a way to count the number of non-consecutive occurances of a character, in this case commas, in a regular expression? I know ,{#} will check for # occurances of consecutive occurances of #, but is there a similar way to check for non-consecutive? Thank you in advance. -- Regards, Owen Franssen Twisted Design -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] pass by reference
Specify it only at function definition: myFunction( $var1, $var2 ) { // ... } $var = myFunction( $var1, $var2 ) ; Ignatius _ - Original Message - From: Jeremy Shovan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 09, 2003 9:54 PM Subject: [PHP-DB] pass by reference How do you pass by reference? I tried $var = myFunction($var1, $var2); but it gave me a warning saying that pass by reference is depreciated -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Round a number
SELECT TRIM( TRAILING '.' FROM TRIM( TRAILING '0' FROM mycol ) ) Ignatius _ - Original Message - From: Shaun [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, October 03, 2003 5:12 PM Subject: [PHP-DB] Round a number Hi, I have a query that returns a number from culculation in my table. It returns say 4.00, 8.75, 0.00, 12.50 etc. How can I get MySQL to return the number without any zeros, i.e. 4, 8.75, 0, 12.5 etc? Thanks for your help -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Email Application
If your mail server supports IMAP, you should use the PHP IMAP functions. Very convenient. Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 24, 2003 11:42 PM Subject: [PHP-DB] Re: Email Application Hey Guys, I am not so new in PHP but I have a problem. I am trying to create a webmail program for my penpal site. I cant retrieve and desplay e-mails from my mail server. Any one with ideas? Regards, ~ Charles -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] update db with variables
Quotes missing around $value. Try instead: mysql_query( UPDATE tablename SET {$name} LIKE '{$value}' WHERE ID={$id}) Of course, even though the code does not show, you have properly validated user input before firing this query...blink/ HTH Ignatius _ - Original Message - From: Robbie Staufer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 24, 2003 5:20 PM Subject: [PHP-DB] update db with variables Hi, I'm writing an application that will display the contents of a db in the browser, including the db-assigned id number. The user can then enter the id number in a form and the browser will display the record corresponding to that id number, with the data in editable text fields. The user edits the text fields and submits to an 'update' script using POST, and the update script puts the new values back into the database. In the update script, I'm trying to access the field names and values in the $_POST array, and update the db using a loop: while ($data = each($_POST)) { $name = $data[ 'key' ]; $value = $data[ 'value' ]; echo $name, $value; $result = mysql_query(UPDATE tablename SET $name = $value WHERE ID=$id) or die (unable to update record); } The echo statement shows me that the script dies on the first time through the loop. The application must be on line this week. Does anyone have any suggestions? Many thanks, Robbie -- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* Robbie Staufer NCAR/SCD 1850 Table Mesa Dr. Rm. 42 Boulder, CO. 80305 (303) 497-1836 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mySQL vs pgSQL | php vs others
Yeah, banking is too serious a business in Argentina, as everybody knows, to entrust to MySQL. Ignatius _ - Original Message - From: Martin Marques [EMAIL PROTECTED] To: nabil [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, September 24, 2003 9:24 PM Subject: Re: [PHP-DB] mySQL vs pgSQL | php vs others El Mié 24 Sep 2003 07:24, nabil escribió: Dear all; I have been using Mysql for a long time, but I have a benchmark Q. Is pgsql , better ? faster ? more reliable than mysql ? Maybe not faster in FTS, but surely MORE reliable!!! any comment ? Some people say that php is not for a very big enterprise, banking , application !! they said that java or even .NET is better ... I m against that but what do you all think ? I'm not that sure. But one thing I am sure of is that I woud never put a bank account aplication using MySQL! -- 16:22:01 up 33 days, 8:04, 1 user, load average: 0.26, 0.37, 0.38 - Martín Marqués |[EMAIL PROTECTED] Programador, Administrador, DBA | Centro de Telematica Universidad Nacional del Litoral - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL: How to properly extract fields from retrieved single record ???
read the PHP manual and examples under the function mysql_fetch_array(). I find the MySQL manual is very well done and helpful. I've been using it as a reference for 2 years. Take a harder look! Ignatius _ - Original Message - From: -{ Rene Brehmer }- [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, September 22, 2003 1:57 PM Subject: [PHP-DB] MySQL: How to properly extract fields from retrieved single record ??? Hi gang Still working on this DB for my gameclan not that it's essential what it's for... and be warned: Never worked with any form of DB in PHP before I began this project, so I'm a total n00b at these MySQL commands (and the manual for MySQL is by far nowhere near as good as the PHP one). Anyways, I'm retrieving a single record from the DB table, and then, because of the way the data needs to be displayed and manipulated, need to extract every single field from that record as a seperate value. I tried this: $num2edit = $_POST['edit']; $link = mysql_connect($host,$username,$password) or die('Could not connect : '.mysql_error()); mysql_select_db($database) or die('Could not select database'); $query = SELECT countryNum,country,nw,gov,strat,spy,troops,jets,turrets,tanks,ally,owner FROM a2a WHERE countryNum=$num2edit; $result = mysql_query($query); $countryNum = mysql_result($result,1,'countryNum'); $country = mysql_result($result,1,'country'); $nw = mysql_result($result,1,'nw'); $gov = mysql_result($result,1,'gov'); $strat = mysql_result($result,1,'strat'); $spy = mysql_result($result,1,'spy'); $troops = mysql_result($result,1,'troops'); $jets = mysql_result($result,1,'jets'); $turrets = mysql_result($result,1,'turrets'); $tanks = mysql_result($result,1,'tanks'); $ally = mysql_result($result,1,'ally'); $owner = mysql_result($result,1,'owner'); /* Free resultset */ mysql_free_result($result); /* Closing connection */ mysql_close($link); But all it gives me are errors like this: Warning: mysql_result(): supplied argument is not a valid MySQL result resource in E:\web\mpe\a2aedit.php on line 350 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in E:\web\mpe\a2aedit.php on line 351 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in E:\web\mpe\a2aedit.php on line 352 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in E:\web\mpe\a2aedit.php on line 353 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in E:\web\mpe\a2aedit.php on line 354 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in E:\web\mpe\a2aedit.php on line 355 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in E:\web\mpe\a2aedit.php on line 356 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in E:\web\mpe\a2aedit.php on line 357 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in E:\web\mpe\a2aedit.php on line 358 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in E:\web\mpe\a2aedit.php on line 359 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in E:\web\mpe\a2aedit.php on line 360 Warning: mysql_result(): supplied argument is not a valid MySQL result resource in E:\web\mpe\a2aedit.php on line 361 Obviously, the first mysql_result line is line 350 in the full code. I've also tried changing the row number to 0, but results in the same errors. I can't find any decent reference on the web that shows how to do this - field extraction - when there's only the single record. So I've been mixing code from various places. And I don't even know if it retrieves the right record, or any record at all (how do I test that?). Any help is highly appreciated :) TIA Rene -- Rene Brehmer aka Metalbunny http://metalbunny.net/ References, tools, and other useful stuff... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] all files in a directory
There are many good user-contribued examples in the online PHP manual at function readdir() Ignatius _ - Original Message - From: FB [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, September 05, 2003 11:55 AM Subject: [PHP-DB] all files in a directory Hi all, I need a small script of php selecting all the files in a directory and putting the names in an array. Also, selecting a specific type might be helpfull like *.TXT I tried to write on my own but it is not a success yet :)) Anyone to help? I will use it on Win32 (2000 pro and XP) Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] UNION Clause in queries
UNION appeared in MySQL 4.0.0 Mayhap your provider has not yet upgraded. There is no such thing as disabling/ granting UNION. HTH Ignatius _ - Original Message - From: John Ryan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, August 31, 2003 8:58 PM Subject: [PHP-DB] UNION Clause in queries I have a UNION command in a query on a PHP page that works fine on my test apache/php/mysql server on windows at home but it returns an error when i upload it to the web. i checked both parts of the UNION in phpMyAdmin online and they both worked. so, can the UNION command be somehow disabled, and if so, how can i enable it again on the online site. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SELECT Part of a Field
SUBSTRING() _ - Original Message - From: Shaun [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, August 29, 2003 11:57 AM Subject: [PHP-DB] SELECT Part of a Field Hi, How can I SELECT a portion of a field in a table for example the first character, or the second two characters etc? Thanks for your help -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL: CREATE TABLE, BLOB, UNIQUE, INDEX etc
You should be very wary of the CREATE TABLE ... SELECT statement. From experience, the types created are not always conform to intuition - I've had my share of nasty surprises Much safer to do a CREATE TABLE statement defining the column types, then do an INSERT INTO ... SELECT Ignatius _ - Original Message - From: Dillon, John [EMAIL PROTECTED] To: php [EMAIL PROTECTED] Sent: Friday, August 29, 2003 5:06 PM Subject: [PHP-DB] MySQL: CREATE TABLE, BLOB, UNIQUE, INDEX etc My code: $query= CREATE TABLE IF NOT EXISTS temp3 UNIQUE(CON175) IGNORE SELECT DISTINCT CONCAT($tbl2.this,$tbl2.that) AS CON175 FROM $tbl2 WHERE $tbl2.this='$rcc' ; gives error: Query failed: BLOB column 'CON175' used in key specification without a key length. Manual suggests to give a BLOB a length: CREATE TABLE test (blob_col BLOB, INDEX(blob_col(10))); ...but how do you work this into the above query? CREATE TABLE IF NOT EXISTS temp3 (UNIQUE(CON175) BLOB, INDEX(CON175)(50))... ..does not work, I suppose because CON175 has not been created yet? CON175 is BLOB by default resulting from this part of the query: IGNORE SELECT DISTINCT CONCAT($tbl2.this,$tbl2.that)... this and that are varchar types. How do I set this as varchar instead: UNIQUE(CON175) VARCHAR(50) does not work. http://www.mysql.com/doc/en/CREATE_TABLE.html - lacks examples! John http://www.cantor.com CONFIDENTIAL: This e-mail, including its contents and attachments, if any, are confidential. If you are not the named recipient please notify the sender and immediately delete it. You may not disseminate, distribute, or forward this e-mail message or disclose its contents to anybody else. Copyright and any other intellectual property rights in its contents are the sole property of Cantor Fitzgerald. E-mail transmission cannot be guaranteed to be secure or error-free. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. Although we routinely screen for viruses, addressees should check this e-mail and any attachments for viruses. We make no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that to ensure regulatory compliance and for the protection of our customers and business, we may monitor and read e-mails sent to and from our server(s). For further important information, please read the Important Legal Information and Legal Statement at http://www.cantor.com/legal_information.html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL, PHP or ghost?
Hmmm... You have a point; the doc is not quite clear. Illegal YEAR values are converted to My understanding is that any illegal value will be first converted into '', then into the corresponding year inside the 1901-2155 interval, ie 2000 Well, all this is quite logical. I have no quarrel with this behaviour. Ignatius _ - Original Message - From: Peter Beckman [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, August 27, 2003 4:13 PM Subject: Re: [PHP-DB] MySQL, PHP or ghost? On Wed, 27 Aug 2003, Ignatius Reilly wrote: Read the MySQL manual. Hmmm, I thought I did. 6.2.2.4: Illegal YEAR values are converted to . 0 value is interpreted as 2000. Your empty string is converted to an integer, thus 0. What confuses me (what I can't find) is why a quoted empty string is converted to a quoted integer 0 for a YEAR type. Based on the manual, I assumed an empty string is considered an Illegal YEAR and thus converted to . The empty string is NOT converted to an UNQUOTED digit 0, because otherwise the field would be set to (the intended and expected action). You must specify it as a string '0' or '00' or it will be interpreted as . Can you point me to the correct portion of the manual that explains that? What you explain sounds like MySQL is working as designed, but I'm a bit embarrassed that I missed that in the manual, so I want to read up on it. Seems a bit obscure; I've been using mysql for 4+ years and have never came across this. Thanks, Beckman - Original Message - From: Peter Beckman [EMAIL PROTECTED] Seems that either I don't understand mysql, or something. My table, with the non-important things removed... mysql explain plate; +-+---+--+-+-+-- --+ | Field | Type | Null | Key | Default | Extra | +-+---+--+-+-+-- --+ | pid | mediumint(8) unsigned | | PRI | NULL | auto_increment | | year| year(4) | YES | | NULL | | [...] So my assumption is that if I insert with year= it should use the default. Or at least . mysql update plate set year=NULL where pid=65; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql select * from plate where pid=65; +-+-+--+- | pid | plate | year | +-+-+--+- | 65 | DVF0343 | NULL | +-+-+--+- But if I do this: mysql update plate set year= where pid=65; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 1 mysql select * from plate where pid=65; +-+-+--+- | pid | plate | year | +-+-+--+- | 65 | DVF0343 | 2000 | +-+-+--+- 2000? What? Why? Confused. PHP or Mysql fault? -- - Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ -- - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Simple field replace...?
hundreds of what? rows or columns? Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 11:35 AM Subject: [PHP-DB] Simple field replace...? Hi there, I need to take a field in my database, and remove the first 32 characters from each entry... There are 100's, and I know there's gotta be an easy way... I've looked up string replace, and it only appears to work one at a time... Can anyone tell me how to make it accross the whole table...? * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Simple field replace...?
Then a simple substring will do: UPDATE mytable SET url = SUBSTRING( url FROM 5 ) btw your date column looks pretty awful. HTH Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 12:06 PM Subject: Re: [PHP-DB] Simple field replace...? Sorry, I'll specify... I have one column, in a row of perhaps 4 fields. I want to remove the first 32 characters from onlt one field EG: My DB: namedateurl ip bob 1/2/99 http:// 1.1.1.1. sue 4/6/01 http:// 2.2.2.2 If I wanted to remove just the http bit and leave :// I'd have to remove the first 4 characters from all the 'url' column. this is what I wanna do, jsut 100+ times over. but the first 32 characters. Ignatius Reilly [EMAIL PROTECTED] 28/08/2003 11:04 To: [EMAIL PROTECTED], [EMAIL PROTECTED] cc: Subject:Re: [PHP-DB] Simple field replace...? hundreds of what? rows or columns? Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 11:35 AM Subject: [PHP-DB] Simple field replace...? Hi there, I need to take a field in my database, and remove the first 32 characters from each entry... There are 100's, and I know there's gotta be an easy way... I've looked up string replace, and it only appears to work one at a time... Can anyone tell me how to make it accross the whole table...? * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL, PHP or ghost?
Well, it IS logical provided one is aware of the rules of the game, meaning, as you rightly point out, that MySQL does not reject SQL statements for incorrect values, but attempts at converting them at any price. I have no clue whether it is or not a shortcoming of the implementation (I do not know what SQL-92 says about this). Therefore data validation should be done outside MySQL. Ignatius _ - Original Message - From: Martin Marques [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED]; Peter Beckman [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 2:36 PM Subject: Re: [PHP-DB] MySQL, PHP or ghost? El Mié 27 Ago 2003 11:34, Ignatius Reilly escribió: Hmmm... You have a point; the doc is not quite clear. Illegal YEAR values are converted to My understanding is that any illegal value will be first converted into '', then into the corresponding year inside the 1901-2155 interval, ie 2000 Well, all this is quite logical. I have no quarrel with this behaviour. Not at all. This is totally ilogical. Wrong date values should give error messages. See what happens when you try to bend a bad input value: http://archives.postgresql.org/pgsql-general/2003-07/msg00599.php Please don't use MySQL in monetary aplications!! -- Porqué usar una base de datos relacional cualquiera, si podés usar PostgreSQL? - Martín Marqués |[EMAIL PROTECTED] Programador, Administrador, DBA | Centro de Telematica Universidad Nacional del Litoral - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL, PHP or ghost?
Well, you're certainly right (except I didn't get the meaning of 'FS' - anything obscene?). However: 1. The job of this ML is to help people get things done 2. For criticisms concerning the design of MySQL, you may get better results posting directly at the MySQL dev team. 3. You may decide that another RDBMS may suit your needs better. Someone told me that Oracle is quite nice. Ig _ - Original Message - From: Martin Marques [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED]; Peter Beckman [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 9:37 PM Subject: Re: [PHP-DB] MySQL, PHP or ghost? El Jue 28 Ago 2003 11:25, Ignatius Reilly escribió: Well, it IS logical provided one is aware of the rules of the game, meaning, as you rightly point out, that MySQL does not reject SQL statements for incorrect values, but attempts at converting them at any price. I have no clue whether it is or not a shortcoming of the implementation (I do not know what SQL-92 says about this). Therefore data validation should be done outside MySQL. The thing that IS ilogical is the way MySQL plays the game. What would you think if all of a sudden the date command in linux did something like that (try to add some strange date when the given date isn't a valid date)? Now lets suppose this is a good idea, and one would have to program to get the data integrity (data integrity isn't only when the database server fails). Then why do I have to put different data types? Let's use text everywhere! Or if I do use different data types, what if I have a bug? I could have people loading erronous data in the database and not getting an error, and after loading lots of information I find the bug, but see that all the data is bogus (like the numeric example I gave earlier). To state it more clearly, I havn't seen Oracle, Informix or PostgreSQL do things like this, which reminds me of what someone told me once: MySQL is just a FS with an lousy SQL language (and pretty incomplete). Maybe the problem is that most people never read Codd's 12 rules for a RDBMS: http://www.byte.com/art/9406/sec8/art11.htm -- 16:23:01 up 6 days, 8:13, 4 users, load average: 0.16, 0.31, 0.18 - Martín Marqués |[EMAIL PROTECTED] Programador, Administrador, DBA | Centro de Telematica Universidad Nacional del Litoral - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL, PHP or ghost?
Read the MySQL manual. 0 value is interpreted as 2000. Your empty string is converted to an integer, thus 0. HTH Ignatius _ - Original Message - From: Peter Beckman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 27, 2003 3:39 AM Subject: [PHP-DB] MySQL, PHP or ghost? Seems that either I don't understand mysql, or something. My table, with the non-important things removed... mysql explain plate; +-+---+--+-+-+-- --+ | Field | Type | Null | Key | Default | Extra | +-+---+--+-+-+-- --+ | pid | mediumint(8) unsigned | | PRI | NULL| auto_increment | | year| year(4) | YES | | NULL| | [...] So my assumption is that if I insert with year= it should use the default. Or at least . mysql update plate set year=NULL where pid=65; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql select * from plate where pid=65; +-+-+--+- | pid | plate | year | +-+-+--+- | 65 | DVF0343 | NULL | +-+-+--+- But if I do this: mysql update plate set year= where pid=65; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 1 mysql select * from plate where pid=65; +-+-+--+- | pid | plate | year | +-+-+--+- | 65 | DVF0343 | 2000 | +-+-+--+- 2000? What? Why? Confused. PHP or Mysql fault? Beckman -- - Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ -- - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Need For SPEED
Sorry I don't seem to get it. 1. What isthe import function provided in PHPList ? 2. What do you mean by initialize each data record ? Ignatius _ - Original Message - From: Creigh Shank [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED] Sent: Thursday, August 21, 2003 7:26 PM Subject: Re: [PHP-DB] Need For SPEED Thanks. We're using the import function provided in PHPList. Looked at a more direct method, but we need to properly initialize each data record in the database. Sorry about the cross-posting. Not sure which list can help. Creigh At 07:13 PM 8/21/2003 +0200, you wrote: What is your data load method? What is the type of your table(s)? With LOAD DATA and text files, I load several million rows in about a minute. Also please don't cross-post. Better first find out what the most suitable mailing list is. Ignatius _ - Original Message - From: Creigh Shank [EMAIL PROTECTED] To: MySQL Users [EMAIL PROTECTED]; PHP-db List [EMAIL PROTECTED]; PHPList Users [EMAIL PROTECTED]; Michiel Dethmers [EMAIL PROTECTED] Sent: Thursday, August 21, 2003 6:58 PM Subject: [PHP-DB] Need For SPEED Using an Apache/PHP/MySQL/Linux (Redhat 8.0) solution, PHPList, to create an e-mailing list for our 5.6 million book club members. Unfortunately, the import speed for importing records (at record number 150,000 the rate is about 2,000 records per hour). We're running on the following: P4 (1.5 Ghz), 1.2 Gbytes RAM (650 Mbytes RAM Disk using ramfs), IDE drive (72,00 rpm) So far we've moved the MySQL data files (var/lib/mysql), PHP /tmp and upload directories and PHPlist web site files to RAM Disk (still just testing - not yet dealing with data safety issues). With all of this tuning we're still at only 2,000 records per hour for uploading. We need to be at 100,000 records per hour (uploading and sending seem to run at about the same rate - we need to be able to send to all book club members in the same week). Any suggestions? Creigh (We're planning to run the system on a server with dual Opterons, 8 Gbytes RAM and RAID-5 SCSI drives, but I don't think the additional system horsepower will solve our problem.) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Need For SPEED
What is your data load method? What is the type of your table(s)? With LOAD DATA and text files, I load several million rows in about a minute. Also please don't cross-post. Better first find out what the most suitable mailing list is. Ignatius _ - Original Message - From: Creigh Shank [EMAIL PROTECTED] To: MySQL Users [EMAIL PROTECTED]; PHP-db List [EMAIL PROTECTED]; PHPList Users [EMAIL PROTECTED]; Michiel Dethmers [EMAIL PROTECTED] Sent: Thursday, August 21, 2003 6:58 PM Subject: [PHP-DB] Need For SPEED Using an Apache/PHP/MySQL/Linux (Redhat 8.0) solution, PHPList, to create an e-mailing list for our 5.6 million book club members. Unfortunately, the import speed for importing records (at record number 150,000 the rate is about 2,000 records per hour). We're running on the following: P4 (1.5 Ghz), 1.2 Gbytes RAM (650 Mbytes RAM Disk using ramfs), IDE drive (72,00 rpm) So far we've moved the MySQL data files (var/lib/mysql), PHP /tmp and upload directories and PHPlist web site files to RAM Disk (still just testing - not yet dealing with data safety issues). With all of this tuning we're still at only 2,000 records per hour for uploading. We need to be at 100,000 records per hour (uploading and sending seem to run at about the same rate - we need to be able to send to all book club members in the same week). Any suggestions? Creigh (We're planning to run the system on a server with dual Opterons, 8 Gbytes RAM and RAID-5 SCSI drives, but I don't think the additional system horsepower will solve our problem.) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Queries probably timing out
- Original Message - From: Dillon, John [EMAIL PROTECTED] To: PHP-DB List [EMAIL PROTECTED] Sent: Tuesday, August 19, 2003 11:47 AM Subject: [PHP-DB] Queries probably timing out I'm doing queries on tables with 45,000 rows in one table and 1-2000 rows in another.. I think the queries are failing due to timeout on the server. The server is not dedicated to me and I may not be able to affect the timeout settings...though I'll ask my hosting company (Positive Internet). If I decide to do the queries on my local PC (I don't need or want to do them over the internet), (1) do I have to set up my PC as a server, Yes. (2) if so what's the quickest and easiest server to get started with, Install Apache, PHP and MySQL. There are countless tutes on the web on how to do so. It is a breeze under Windows 2000 (3) are there complications running the server on the same PC as the client applications (ie my PHP code), No, except maybe performance (4) do I then download MySQL and PHP onto it, though I read PHP comes bundled with MySQL, PHP has an API to MySQL, but you have to have first a MySQL server running (5) will it become clear to me what host name/IP address to use to connect to the database (up to now I've been told by the hosting company). You can use a dynamic DNS set-up (look for instance www.dnsmadeeasy.com) if you need a name-based address. Also a breeze to set up. Any other suggestions on timeouts on queries? Thanks, John http://www.cantor.com CONFIDENTIAL: This e-mail, including its contents and attachments, if any, are confidential. If you are not the named recipient please notify the sender and immediately delete it. You may not disseminate, distribute, or forward this e-mail message or disclose its contents to anybody else. Copyright and any other intellectual property rights in its contents are the sole property of Cantor Fitzgerald. E-mail transmission cannot be guaranteed to be secure or error-free. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. Although we routinely screen for viruses, addressees should check this e-mail and any attachments for viruses. We make no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that to ensure regulatory compliance and for the protection of our customers and business, we may monitor and read e-mails sent to and from our server(s). For further important information, please read the Important Legal Information and Legal Statement at http://www.cantor.com/legal_information.html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Breaking down a table field....
SELECT DISTINCT unit... Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 07, 2003 3:37 PM Subject: [PHP-DB] Breaking down a table field I have a table, wth many entries. Each entry has been asigned a unit to belong to. I want to list all the units dynamically. How can I display all the units, without displaying each instance of the unit? EG: Unititem breakfast cereal breakfast toast lunch salad lunch sandwich dinner steak dinner pie lunch soup dinner lasagne and so on.. I'd wanna get a list of: breafast lunch dinner not several instances of each... how can I do this? * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] checking a string for numbers
$extract = preg_replace( /[^0-9]/, , $str ) // will extract the figures from your string HTH Ignatius _ - Original Message - From: Jamie Saunders [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 26, 2003 1:04 PM Subject: [PHP-DB] checking a string for numbers Hi, I'm trying to find a way of simply checking a string for numbers. e.g. if ($myVar contains a number) { //numbers present } else { //no numbers present } Thanks, -- Jamie Saunders Media Architect [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL editor
Try also DBTools (forWindows). Very nice. Been using for 2 years, and happy about it. http://www.dbtools.com.br/EN/ Ignatius _ - Original Message - From: Achilles Maroulis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 19, 2003 10:46 AM Subject: Re: [PHP-DB] MySQL editor MySQL CONTROL CENTER from mysql.org (very nice) SQLYOG from sqlyog.com PHPMYADMIN from phpmyadmin.net (web interface) - Original Message - From: Angelo Zanetti [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 19, 2003 11:40 AM Subject: [PHP-DB] MySQL editor Hi all. I need to get a program (interface) for MySQL, I was using MySQL Front but they've discontinued its use. Any suggestions. thanx in advance -Angelo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] time without seconds
Check the TIME_FORMAT(time,format) MySQL function. Ignatius _ - Original Message - From: Lisi [EMAIL PROTECTED] To: PHP-DB [EMAIL PROTECTED] Sent: Tuesday, June 17, 2003 1:16 PM Subject: [PHP-DB] time without seconds If I have a time stored in MySQL, and I only need the hour and minutes without seconds: 1) Can I crop this in PHP after retrieving it? 2) Is there a way to store this without the seconds in MySQL? Same goes for storing a date without the year. I could use a regular char field, but I want to be able to retrieve a row that corresponds to the current month and day, currently I am doing this with $month = date(n); $day = date(d); $query = SELECT ... WHERE MONTH(date) = $month AND DAYOFMONTH = $day; Is there a better way to do this without storing unnecessary data? Thanks, -Lisi -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php