Re: [PHP-DB] use php variable within postgresql query
My friends, Would not the syntax of "$query=$_GET['databasecolumn'[;" be part of the issue? I believe the brackets should be closed like this, no? "$query=$_GET['databasecolumn'];" ~G. On Fri, 9 Jun 2023 at 10:53, Aziz Saleh wrote: > Read and understand these, should help you: > > https://www.php.net/manual/en/language.types.array.php > > Basically its databasecolumnname get param is not defined (set) causing the > query to fail also. > > On Fri, Jun 9, 2023 at 5:06 AM e-letter wrote: > > > Readers, > > > > Suppose: > > > > $query=$_GET['databasecolumn'[; > > > > $anotherquery=pg_query($databaseconnection, 'SELECT * FROM > > databasename WHERE databasecolumnname="'.$query.';"'); > > > > Two errors are reported: > > > > PHP Notice: Undefined index: databasecolumnname > > > > PHP Warning: pg_query(): Query failed: ERROR: column ";" does not exist > > > > Any advice please? > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > >
Re: [PHP-DB] French and Spanish Accent Letters
Hi Ron, you should use CHARSET=utf8 COLLATE=utf8_unicode_ci in your table for a wide option of languages. Example: CREATE TABLE `t_my_table` ( `row_id` int(10) unsigned NOT NULL, `row_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL, ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; Cheers. -- Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] big table / hadoop / map reduce
Hi Artur, in your IPs examples, lets supouse you have ten access log files (from ten different servers), there you already have the mapping part done. Then you reduce each log into anonther new file, indicating the IP address and the times it's repeated. At this stage you have a reduced version of each log file; then you need to map them into a new unique file, this file will be the merge of all the reduced versions of the log files. This this unique file, you will need to reduce it again, and there you will have an unique file with all the IPs address and the times they appear. There is no limit on the times you can call map and reduce. Cheers. On 30 October 2010 15:51, Artur Ejsmont ejsmont.ar...@gmail.com wrote: sure that was a bit more helpful, thanks :) i was still wondering to what other use cases would that apply. This is a good article (best so far i guess): http://code.google.com/edu/parallel/mapreduce-tutorial.html The thing is that reduce has to aggregate data or it would be impractical. So i am trying to see more examples to fully understand the limitations of the method. Lets say i want to find top 10 IP addresses in an access log: - split log into small files - i take one fragment (one file) - worker maps to a list of ip, 1 - before reduce is called data is sorted by ip - reduce makes ip, totalCountPerLogFileSample so i have a bunch of files with aggregated lists of IP, totalCountPerFile. But then would it not have to be merged across all results again? with another sort/reduce call? or to avoid that do i need initial data to be already clustered so one ip appears only in one chunk file? Does it make sense? As i said i am still trying to figure out how should it be applied and when ... also how to transform problems to make it still work : ) I want to write some simple map reduce like the one above just to see it working and play around a bit :) cheers Art On 22 October 2010 16:49, Andrés G. Montañez andresmonta...@gmail.com wrote: Imagine you have to get track of some kind of traffic, for example, ad impressions; lets supose that you have millions of those hits; you will have to have a few servers to receive the notifications of the impression of an ad. After the end of the day, you will have that info across a bunch of servers; mostly you will have a record of each impression indicating the Identifier (id) of the Ad. To this info to become useful, you will have to agregate it; for example to know which is the Ad with most impressions. You will have to iterate over all servers and MAP the info into one place; now that you have all the info, you will have to REDUCE it; so you will have one record per Ad identifier indicating the TOTAL impressions of that day. That's the basic idea. It's like aftermath of Divide and Conquer. Hope this will be useful. Cheers. On 22 October 2010 13:27, Artur Ejsmont ejsmont.ar...@gmail.com wrote: hehe sorry but this does not help :-) i can google for wikipedia definitions. I was hoping for some really good articles/examples that would put it into enough context. I would like to have good idea when it could be useful. So far had no luck with that. Its like with design patterns ... people who dont understand them should not write articles trying to explain them to others :P Art On 22 October 2010 15:29, Andrés G. Montañez andresmonta...@gmail.com wrote: Hi Artur, Here is an article on wikipedia: http://en.wikipedia.org/wiki/MapReduce And here are the native implementations in php: http://www.php.net/manual/en/function.array-map.php http://www.php.net/manual/en/function.array-reduce.php The basic idea is to gather a lot of data, from several nodes, and map them togheter; then, assuming a lot of this data is repeated across the dataset, we reduce them. Cheers. On 22 October 2010 12:14, Artur Ejsmont ejsmont.ar...@gmail.com wrote: Hi there guys and girls Have anyone came across any reasonable explanation / articles on how hadoop and map reduce work in practice? i have read a few articles now and then and i must say i am puzzled am i stupid or they just cant find an easy way to explain it? :P What i would hope for is explanation on simple example of application with some code samples preferably. anyone good at it here? cheers -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- Visit me at: http://artur.ejsmont.org/blog/ -- Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- Visit me at: http://artur.ejsmont.org/blog/ -- Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Variable Assignment
mysql SET @st=100; mysql SELECT @st; +--+ | @st | +--+ | 100 | +--+ Cheers. On 28 October 2010 19:10, Ethan Rosenberg eth...@earthlink.net wrote: Dear List - I cannot figure this one out: mysql $st=1000; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$st=1000' at line 1 Ethan MySQL 5.1 PHP 5 Linux [Debian (sid)] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Incrementing Primary Key
Hi Ethan, in this case, you should manage the keys by your application, and store the used ids in aonther table, similar to a sequence in Oracle or Postgresql. Thats so if you want all the records un one table (a field for the letter, and the other for the numeric part). Otherwise, having a table for each site will be enough, as Jimmy suggests. -- Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Incrementing Primary Key
Yes indeed, as Jimmy says, having a database for each site is impractical and a waste of resources. On 27 October 2010 11:23, Jimmy Sole jimmys...@gmail.com wrote: In my opinion, having a database for each site would require a lot of unnecessary work, as you would have to connect to every database in order to handle the sites. Having one database with tables for all the sites would be more productive as you would not have to change the connection info for PHP every time you want to use a different database. I use the PDO mysql adapter, what do you use? -Original Message- From: Andrés G. Montañez [mailto:andresmonta...@gmail.com] Sent: Wednesday, October 27, 2010 9:19 AM To: Ethan Rosenberg Cc: php-db-lists.php.net Subject: Re: [PHP-DB] Incrementing Primary Key Hi Ethan, in this case, you should manage the keys by your application, and store the used ids in aonther table, similar to a sequence in Oracle or Postgresql. Thats so if you want all the records un one table (a field for the letter, and the other for the numeric part). Otherwise, having a table for each site will be enough, as Jimmy suggests. -- Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Parsing Tab Delimited file
Hi Ethan, fist you need to read the file, you could use the file() function which reads the file as an array, being each line an element; the you have to navigate the array and exploding the lines into an array: $data = file('myfile.txt'); foreach ($data AS $row) { $row = explode(\n, trim($row)); var_dump($row); } And there you go. Cheers. On 24 October 2010 16:46, Ethan Rosenberg eth...@earthlink.net wrote: Dear list - Thanks for all your help. I have a tab delimited file which I wish to import into a data base. In MySQL I can use the LOAD DATA command. As far as I know, that command cannot be used in PHP as a mysqli_query. As I understand, I have to parse the file and use the INSERT command. How do I do it? Code samples, please. Thanks. Ethan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How to Sync MySQL with iPhone or Google Contacts
Hi Ron, what's what you want to sync? Contacts? Or everything else? You want to sync it over the internet? Or over wire? You should research the iPhone API/SDK for sync; and not focus with MySQL, wich is just an storage. Cheers. On 23 October 2010 03:09, Karl DeSaulniers k...@designdrumm.com wrote: I believe there is a MySQL for the iphone iMy? http://forums.mysql.com/read.php?58,249718,249718 You'd probably want o use JASON or an equiv. to talk back and forth with your database and app. At least thats the consensus I'm finding on posts about it. HTH Karl On Oct 22, 2010, at 11:21 PM, listread wrote: Hey all! Does anyone know how to go about syncing a MySQL db with an iPhone over the internet? An alternative would be syncing with Google Contacts, which then could sync with the iPhone. I think Google Contacts uses Exchange Server to sync with devices. Thanks! - Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How to Sync MySQL with iPhone or Google Contacts
Hi Ron, watchout with the jailbrake becaous it will void your warranty over the iphone. If you want to sync the phone's contact with something, you really should check the iphone API and build an iphone application which hooks and listens for contact's change and then notify the changes to your server. I know building an iphone app is a pain, but I think its the right way to do it, if not the only. Is this need for a hobbie or you need to implement this for a public application? Cheers. On 23 October 2010 13:57, listread listr...@cze.com wrote: Karl / Andrés Thanks for your replies. iMy appears to be only a client and I can already access servers with php on the iPhone web browser. I would like MySQL on my iPhone. There was a way to make a jailbroke iPhone a MySQL server, but I'm not sure it is available any longer. My immediate desire is to sync the iPhone's native contacts and, perhaps, the calendar with our online server over the internet. Preferably syncs would be pushed. With a Google Gmail account, you can already do just exactly that. Once set up, if you update your Gmail contacts, a minute or two later your iPhone contacts will be sync'd. It's supposed to work with the Google calendar, too, but I haven't tried it. It appears that Google is using a MS Exchange Server or similar. The setup in the iPhone uses the Exchange server settings. See http://www.google.com/mobile/sync/ The solution I'm looking for would be server side -- if not completely, in part. Again, it would be best to sync directly to the iPhone, but if the server would sync with the Google calendar and Google sync'd with the iPhone, that would be an acceptable 2nd choice. Thanks again for your reply! - Ron On 10/23/2010 5:47 AM, Andrés G. Montañez wrote Hi Ron, what's what you want to sync? Contacts? Or everything else? You want to sync it over the internet? Or over wire? You should research the iPhone API/SDK for sync; and not focus with MySQL, wich is just an storage. Cheers. On 23 October 2010 03:09, Karl DeSaulniersk...@designdrumm.com wrote: I believe there is a MySQL for the iphone iMy? http://forums.mysql.com/read.php?58,249718,249718 You'd probably want o use JASON or an equiv. to talk back and forth with your database and app. At least thats the consensus I'm finding on posts about it. HTH Karl On Oct 22, 2010, at 11:21 PM, listread wrote: Hey all! Does anyone know how to go about syncing a MySQL db with an iPhone over the internet? An alternative would be syncing with Google Contacts, which then could sync with the iPhone. I think Google Contacts uses Exchange Server to sync with devices. Thanks! - Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.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 -- Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How to Sync MySQL with iPhone or Google Contacts
Hi Ron, yes,you should try to use Google as a gateway; the Google API is very well documented, I think all you need is just the user account (and password) and then through the API you should access all data. Cheers. On 23 October 2010 19:10, listread listr...@cze.com wrote: Andrés, It would be tempting to build an app for this, but we don't have a single Mac in the place. Maybe syncing with Google is the way to go? That would keep the iPhone out of the equation. (This is not intended for the market.) Thanks, - Ron On 10/23/2010 2:16 PM, Andrés G. Montañez wrote: Hi Ron, watchout with the jailbrake becaous it will void your warranty over the iphone. If you want to sync the phone's contact with something, you really should check the iphone API and build an iphone application which hooks and listens for contact's change and then notify the changes to your server. I know building an iphone app is a pain, but I think its the right way to do it, if not the only. Is this need for a hobbie or you need to implement this for a public application? Cheers. On 23 October 2010 13:57, listreadlistr...@cze.com wrote: Karl / Andrés Thanks for your replies. iMy appears to be only a client and I can already access servers with php on the iPhone web browser. I would like MySQL on my iPhone. There was a way to make a jailbroke iPhone a MySQL server, but I'm not sure it is available any longer. My immediate desire is to sync the iPhone's native contacts and, perhaps, the calendar with our online server over the internet. Preferably syncs would be pushed. With a Google Gmail account, you can already do just exactly that. Once set up, if you update your Gmail contacts, a minute or two later your iPhone contacts will be sync'd. It's supposed to work with the Google calendar, too, but I haven't tried it. It appears that Google is using a MS Exchange Server or similar. The setup in the iPhone uses the Exchange server settings. See http://www.google.com/mobile/sync/ The solution I'm looking for would be server side -- if not completely, in part. Again, it would be best to sync directly to the iPhone, but if the server would sync with the Google calendar and Google sync'd with the iPhone, that would be an acceptable 2nd choice. Thanks again for your reply! - Ron On 10/23/2010 5:47 AM, Andrés G. Montañez wrote Hi Ron, what's what you want to sync? Contacts? Or everything else? You want to sync it over the internet? Or over wire? You should research the iPhone API/SDK for sync; and not focus with MySQL, wich is just an storage. Cheers. On 23 October 2010 03:09, Karl DeSaulniersk...@designdrumm.com wrote: I believe there is a MySQL for the iphone iMy? http://forums.mysql.com/read.php?58,249718,249718 You'd probably want o use JASON or an equiv. to talk back and forth with your database and app. At least thats the consensus I'm finding on posts about it. HTH Karl On Oct 22, 2010, at 11:21 PM, listread wrote: Hey all! Does anyone know how to go about syncing a MySQL db with an iPhone over the internet? An alternative would be syncing with Google Contacts, which then could sync with the iPhone. I think Google Contacts uses Exchange Server to sync with devices. Thanks! - Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.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 -- Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] big table / hadoop / map reduce
Hi Artur, Here is an article on wikipedia: http://en.wikipedia.org/wiki/MapReduce And here are the native implementations in php: http://www.php.net/manual/en/function.array-map.php http://www.php.net/manual/en/function.array-reduce.php The basic idea is to gather a lot of data, from several nodes, and map them togheter; then, assuming a lot of this data is repeated across the dataset, we reduce them. Cheers. On 22 October 2010 12:14, Artur Ejsmont ejsmont.ar...@gmail.com wrote: Hi there guys and girls Have anyone came across any reasonable explanation / articles on how hadoop and map reduce work in practice? i have read a few articles now and then and i must say i am puzzled am i stupid or they just cant find an easy way to explain it? :P What i would hope for is explanation on simple example of application with some code samples preferably. anyone good at it here? cheers -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] big table / hadoop / map reduce
Imagine you have to get track of some kind of traffic, for example, ad impressions; lets supose that you have millions of those hits; you will have to have a few servers to receive the notifications of the impression of an ad. After the end of the day, you will have that info across a bunch of servers; mostly you will have a record of each impression indicating the Identifier (id) of the Ad. To this info to become useful, you will have to agregate it; for example to know which is the Ad with most impressions. You will have to iterate over all servers and MAP the info into one place; now that you have all the info, you will have to REDUCE it; so you will have one record per Ad identifier indicating the TOTAL impressions of that day. That's the basic idea. It's like aftermath of Divide and Conquer. Hope this will be useful. Cheers. On 22 October 2010 13:27, Artur Ejsmont ejsmont.ar...@gmail.com wrote: hehe sorry but this does not help :-) i can google for wikipedia definitions. I was hoping for some really good articles/examples that would put it into enough context. I would like to have good idea when it could be useful. So far had no luck with that. Its like with design patterns ... people who dont understand them should not write articles trying to explain them to others :P Art On 22 October 2010 15:29, Andrés G. Montañez andresmonta...@gmail.com wrote: Hi Artur, Here is an article on wikipedia: http://en.wikipedia.org/wiki/MapReduce And here are the native implementations in php: http://www.php.net/manual/en/function.array-map.php http://www.php.net/manual/en/function.array-reduce.php The basic idea is to gather a lot of data, from several nodes, and map them togheter; then, assuming a lot of this data is repeated across the dataset, we reduce them. Cheers. On 22 October 2010 12:14, Artur Ejsmont ejsmont.ar...@gmail.com wrote: Hi there guys and girls Have anyone came across any reasonable explanation / articles on how hadoop and map reduce work in practice? i have read a few articles now and then and i must say i am puzzled am i stupid or they just cant find an easy way to explain it? :P What i would hope for is explanation on simple example of application with some code samples preferably. anyone good at it here? cheers -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- Visit me at: http://artur.ejsmont.org/blog/ -- Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] NULL to 0
SELECT IFNULL(SUM(`my_Bible_trivia_knowledge_questions_answered`.`score`), 0) AS total_score, IFNULL(`my_Bible_trivia_knowledge_profile`.`questions_answered`, 0) AS questions_answered In these cases you must use the IFNULL function, for testing the value. -- Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Is this Code Correct??
echo 'Name: a href=' . $url . '' . $runrows['name'] . '/a'; On 11 February 2010 08:54, nagendra prasad nagendra802...@gmail.com wrote: Hi All, I want to link the actual file when the result is displayed. url = actual MP3 location Name = Name of the MP3 Here is the code that I want to link with: echo Name: .a herf='$url'.$runrows['name']; Is above code is correct ?? Best, -- Guru Prasad Ubuntu Voice GTK+ Forum -- Atte, Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Is this Code Correct??
Make sure your $url variable has the right value. On 11 February 2010 09:06, nagendra prasad nagendra802...@gmail.com wrote: Thanks Buddy, its working but the linking is not working properly. Its taking me the same page address on which right now I am. http://localhost/searchengine/download.php?url=mj_bad_track01.mp3 I want to connect the url directly to the MP3 file so that user can download the MP3. Best, -- Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] comparing stored timestamp with NOW()
If your timestamps is an UNIX Timestamp, and your DB is MySQL, this should do the trick $days = 7; $sql = 'SELECT (UNIX_TIMESTAMP() - ' . $timeStamp . ') = (3600*24*' . $days . ');'; 3600*24 is one day in seconds, so multiply it by the days limit (7 days). Example Query: mysql SELECT (UNIX_TIMESTAMP() - 1235861716) = (3600*24*7) AS valid FROM dual; +---+ | valid | +---+ | 1 | +---+ Enjoy. -- Atte, Andrés G. Montañez Zend Certified Engineer Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Aborting long running DB queries with browser Stop button
Hello, I've run into a brick wall implementing functionality in my PHP scripts to detect when the user has hit the Stop button so that I can abort my long running DB queries. Apache 2.2.9, PHP 5.2.6-5 with Suhosin-Patch, MySQL 5.0.67 running on a Debian unstable machine. As a simple test case, I wrote this script (edited for brevity) to figure out how PHP scripts are terminated: ?php // print headers... ignore_user_abort(TRUE); system(( echo -n \1: \ ; date ) /tmp/phptmplog, $rv); print p1/p; sleep(3); flush(); if (connection_aborted()) { system(( echo -n \Aborted 1: \ ; date ) /tmp/phptmplog, $rv); exit(0); } system(( echo -n \2: \ ; date ) /tmp/phptmplog, $rv); print p2/p; sleep(3); flush(); if (connection_aborted()) { system(( echo -n \Aborted 2: \ ; date ) /tmp/phptmplog, $rv); exit(0); } system(( echo -n \3: \ ; date ) /tmp/phptmplog, $rv); print p3/p; sleep(3); flush(); if (connection_aborted()) { system(( echo -n \Aborted 3: \ ; date ) /tmp/phptmplog, $rv); exit(0); } system(( echo -n \4: \ ; date ) /tmp/phptmplog, $rv); print p4/p; sleep(3); flush(); if (connection_aborted()) { system(( echo -n \Aborted 4: \ ; date ) /tmp/phptmplog, $rv); exit(0); } // print headers... ? This script continues to execute a while after the browser terminates the connection (lines are written to /tmp/phptmplog even though connetion is closed); if I hit Stop after getting 1 in my browser the /tmp/phptmplog file will have entries for 1: Fri Feb 6..., 2: Fri Feb 6..., 3 Fri Feb 6..., and Aborted 3: Fri Feb 6 But at least the script doesn't run all the way through. With ignore_user_abort(TRUE); I get an Aborted line meaning that connection_aborted() has returned true, while with ignore_user_abort(FALSE); the script stops writing to /tmp/phptmplog without writing an Aborted line. Using this knowledge I want to do something like this in my DB query script: // initialize... $a = mysql_connect('db', 'user', 'pwd', true); $tid = mysql_thread_id($a); $b = mysql_connect('db', 'user', 'pwd', true); $r = mysql_unbuffered_query($potentially_slow_query, $a); while (true) { $p = poll_mysql($r); // poll_mysql() doesn't exist! if (HAS_DATA == $p) { $row = mysql_fetch_row($r); handle_row($row); } else if (NO_MORE_DATA == $p) { // could also check mysql_fetch_row() == FALASE break; } print ; // ugly way to get some I/O going to detect closed connection flush(); // make sure I/O happens usleep(200); // don't waste too many CPU cycles; also gives us time to detect that flush() failed sending data if (connection_aborted()) { mysql_query(KILL $tid, $b); break; } } // clean up... But obviously this doesn't work as I have found no way to poll() unbuffered mysql queries. So my question is quite obvious: how do I solve this problem? Surely I can't be the first one running into it, someone else should already have encountered it and found a solution, but I can't find it by searching. Perhaps I'm just not asking Google clever enough questions... I've already optimized the DB queries, but a few cases are hard-to-impossible to speed up so now I want to give users who accidentally issue these queries a chance to abort. I've done extensive web searches, read all of the PHP manual pages beginning with mysql_, wasted days on trial-and-error experimenting (signal handling etc.), seen the [PHP-DB] Long running db queries and the STOP button thread from the end of 2005, but my problem remains. Help! Please?
Re: [PHP-DB] resources and resource types
The ID of the resource changes on every new resource. There is no co-relation between resources and resources id. The only thing you can get is the Type of the Resource, read: * http://www.php.net/manual/en/language.types.resource.php * http://www.php.net/manual/en/resource.php * http://www.php.net/manual/en/function.get-resource-type.php -- Atte, Andrés G. Montañez PHP Senior Técnico en Telecomunicaciones Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Efficient way to access MS SQL server
charlie wrote: The native SQL driver for PHP has a problem with a limit on the number of characters in a string, so can't use that. hmmm interesting. how much is the limit? i used PHP's mssql_* functions and while i only used about 20 chars on a character search string in the WHERE, i found them to be as simple as the mysql_* functions... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] md5() function
MD5 is also known as an one-way crypt system; you can encryptit but never unencrypted; only using brute force or a hash list you can retrive a 'string' that it's hash is the one stored; but it is not necesary the same original string; this is also known as a hash collision. So, in short... no, there isn't a unMd5(). If you need to retrive the original string, try GPG. On 14/01/2008, Miguel Guirao [EMAIL PROTECTED] wrote: Hi!! I'm using the md5() function to encrypt a password and store it into a database. Now I want to retrieve that MD5 password and convert it into it's human readable condition. Is there a function opposite to md5()?? Best Regards, M Guirao -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Atte, Andrés G. Montañez Técnico en Redes y Telecomunicaciones Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: backup of database record before update
Stephen Sunderlin wrote: Neil, Have you had success with triggers. I couldn't get one to work and then saw discussion on the board here that MYSQL triggers were not so reliable and still somewhat problematic so I archive through the application. Just curious. i have used a couple simple triggers on a 5.0.20nt box. one thing i read recently is triggers and stored procedures do use more system resources though... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] What is the most efficient way to store SELECT results
Robert Palmer wrote: I'm not I was clear in my question. A query returns 1,000 rows from the table. I want to store the entire result of that query in order to be able to create separate pages to return the results rather than all on one page e.g. Page 1 2 3 4 ... . Not sure if it's important but I'm using persistent connections. test out your server. create a test script to load the results into an array. keep track of memory usage. then calculate that to how much traffic that script will be seeing. so taking that into consideration, if you run separate boxes for your web server/php and db, you can balance out: lots of hits on memory on the web server or lots of disc access on the db server if you decide to go with the re-call the db server paging methods... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Looking for a small open-source PHP-DB app that utilize OOP.
check out UCCASS. not only oop, but smarty as well... http://www.bigredspark.com/survey.html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Pages not fully loading
Has anyone had this strange and frustrating experience? Hopefuly no. But, what session storage are you using? Maybe there is a problem there (quota reached, etc), and the session fail is causing the page fail. Anyway, try to the help desk to review the Apache Logs, and see if there is no inusual activity, like segmentations faults, etc. Good luck. -- Atte, Andrés G. Montañez Técnico en Redes y Telecomunicaciones Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] widthheigh
The HTML attributes must be encloesd in double quotes (at least in xHTML). So, the code should be td width=90 height=70 ?php echo img src=\/album/img/\.$photoFileName[2].\ width=\90\ height=\70\ border=\0\ /; ? /td Note the \ for escaping the double quotes in the double quotes defined string. -- Atte, Andrés G. Montañez Técnico en Redes y Telecomunicaciones Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Email Article, Print Article
[EMAIL PROTECTED] wrote: Hello, I am running an article-based site, where I would like to add two buttons: print this article and email this article. Does anyone know where I could look to find out how to program this code into my article.php page? anothing this is to use CSS to strip out all of the fancy tables and graphics and stuff in the printed page option. plus, i use this trick to read a site that separates the article into multipages. when you click on the PRINTED option, it dumps the whole article into a graphics free format... ;) -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Postgres Bytea Field + Adodb
Hi, someone can helpme with inserting a binary data (from a file) to a Postgres Database with the ByteA field, i'm using the ADOdb class. THX -- Atte, Andrés G. Montañez Técnico en Redes y Telecomunicaciones Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Newbie with mail problem
Use a real hostname, not 'localhost'.- -- Atte, Andrés G. Montañez Técnico en Redes y Telecomunicaciones Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How many rows for 100 questions?
I have a questionary that has 100 questions, Should I create 2 tables 1 with the user information and the second one with the 100 questions? What is your recommendation? I recommend you the next table configuration: 1 table for users 1 table for the questions (so you can have more than 100) IF the User can Input the Answer - 1 table with User ID, Questin ID and the Answer IF the User only selects a pre-defined Answer - 1 table Answer ID, Questin ID, Answer 1 table User ID, Questin ID, Answer ID IF the User can select a pre-defined answer OR input, a MIX of both solutions. -- Atte, Andrés G. Montañez Técnico en Redes y Telecomunicaciones Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] multiple queries, one transaction - REWORDED
Crate an Array, where the Key is the ItemId, and the value is the ItemQty. If the client want to delete an the item, unset the key, if the client wont to add or remove an item quantity, just change the value. Then when the items and quantities are correct, just start transaction begin foreach If (! (INSERT . (order, ItemID (the array key), ItemQty (the array value of the key))...)) rollback transaction break end foreach commit transaction So if the insert is failed, you rollbackit. No need for a DELETE -- Atte, Andrés G. Montañez Técnico en Redes y Telecomunicaciones Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHPMySQL left/substring etc problem
But when I tried, select left (loc1,3) from openart_table where.. Try without the space between 'left' and '(', I mean... LEFT(loc1, 3) where loc1 is the name of the column, and 3 the characters you want to show. -- Atte, Andrés G. Montañez Técnico en Redes y Telecomunicaciones Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] stuck on module of apache
Check for the slashes (/). Even in Windows you must use UNIXish paths. From the httpd.conf file # NOTE: Where filenames are specified, you must use forward slashes # instead of backslashes (e.g., c:/apache instead of c:\apache). # If a drive letter is omitted, the drive on which Apache.exe is located # will be used by default. It is recommended that you always supply # an explicit drive letter in absolute paths, however, to avoid # confusion. -- Atte, Andrés G. Montañez Técnico en Redes y Telecomunicaciones Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] using POST data for a readfile
I didn't mean to offend or say your way was wrong. I was just offering an alternative method. Oh no, you didn't offended me in anyway! I was saying that my example should not be used, because it do not work. -- Atte, Andrés G. Montañez Técnico en Redes y Telecomunicaciones Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] using POST data for a readfile
I give the exaple just as an guide not a working one. -- Atte, Andrés G. Montañez Técnico en Redes y Telecomunicaciones Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] using POST data for a readfile
You should use some JavaScript. Try something like this: form name=downloads medoth=post action=callFile.php input type=hidden value=test.pdf a href=# onclick=document.downloads.submit(); target=_blank /form -- Atte, Andrés G. Montañez Técnico en Redes y Telecomunicaciones Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DATETIME MySQL - using only month and date
$month_start : starting month $month_end : ending month $day_start : starting day $day_end : ending day You could add something like this in the WHERE clause: ((MONTH(closing) = $month_start AND DAY(closing) = $day_start) AND (MONTH(closing) = $month_end AND DAY(closing) = $day_end)) -- Atte, Andrés G. Montañez Técnico en Redes y Telecomunicaciones Montevideo - Uruguay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] dbase and Debian
Ricardo Markiewicz wrote: Unfortunately, I can't convert the dbf files to SQL tables, so, i need dbase support in PHP :( connect via ODBC, perhaps? then ADOdb or PEAR it? -- Leo G. Divinagracia III [EMAIL PROTECTED] z -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL problem..
okay.. i'm stumped. what client libraries? using php 5, so is it php_mysql.dll??? i'm using a canned script, so i have to make the changes there too? i checked out the mysql help link. i even started the mysqld with the --old-passwords parameter... still getting the error... thanks... Bastien Koert wrote: Check the mysql website. Have you upgraded from 4.0x to 4.1 recently. If so you need to update the client libraries that come with mysql. There are significant protocol changes from 4.0x to 4.1. Bastien From: ian [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL problem.. Date: Mon, 08 Nov 2004 17:02:53 + Any body met this error? Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in /usr/local/apache2/html/poems/browse.php on line 15 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Leo G. Divinagracia III [EMAIL PROTECTED] z -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL backup software
Perry, Matthew (Fire Marshal's Office) wrote: Does anyone know a free MySQL backup program to schedule regular backups? mysql has the ADMINISTRATOR, well at least for win32... does timed backups. -- Leo G. Divinagracia III [EMAIL PROTECTED] z -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Generate Menu based on database structure
graeme wrote: Hi, Rather than writing a recursive function I'd suggest that you create a menu class and store each record as an object of the class. why reinvent the wheel: http://www.destroydrop.com/javascripts/tree/ -- Leo G. Divinagracia III [EMAIL PROTECTED] z -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] User Activities
balwantsingh wrote: hi may pls. help me i am using PHP and MYSQL. is there any command through which i can record which user modifiyed the data through which command (insert / update / delete etc.) on which time and date in a table in mysql. maybe you should describe your application or needs. reason is, MYSQL with PHP, usually, there is one account you create that allows a PHP script to do those commands. typically, this is a sub-account from the master or root account. you need to be familiar on how MYSQL manages its user accounts. now if this is a web application, then anyone in the world can run this application and unless you have a facility on your web site to login users, then this is what you can use throughout the life of the web session. for example, the phpBB web app, multiple people log into the bulletin board. but the account that is used to connect to the MYSQL (in this case) backend is a single account that is created when you first install phpBB. phpBB then uses this account to do all the work needed and logs that into a table so you know who posted (or edit or deleted) what post on the forum. you might be still thinking in the MS ACCESS mode. that is diff from the way MYSQL works. -- Leo G. Divinagracia III [EMAIL PROTECTED] z -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mySQL searching through serialized arrays
I am storing array of user IDs as TEXT using the serialize() function on the array, since several users, one or none can be part of each record... and I noticed that the serialized array has the values in double quotes like :21; for example... so since I know that the values will be enclosed, i am using the sql statement, with 21 as the example variable: SELECT FROM table WHERE userarray LIKE '%\21\%' is there a better way or a built-in mySQL function to filter through the serialized array -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Unable to parse message
You should remove (removethis) to send via email. This is just a precaution because often Newsgroups are scanned for email address and added spammers list. Just want to avoid that. Justin Patrin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] What mail program are you using? I'm getting mail parsing errors. In addition, you have your From set as: Harry G harry (removethis)@gabha.net Likely, ( and ) aren't supposed to be in there (invalid chars) and it also makes it impossible to reply to you. There is no other from or reply to in the headers. Answer to your question inline below. On Mon, 26 Jul 2004 08:47:08 +1000, wrote: Hi, I want to run a query on a table while joining it with other tables. Table 1- members id - firstname - middlename - - country - region3 Fields country and region3 hold the integer codes for country and region3 is state Table 2- country id - countryname Countryname is where the actual Country name is stored and id is the country code Similarly Table 3 - region3 id - region3 where region3 is the state name and id is the region code. I perform the following query to search the names in the database but the result only gives me the integer values for Country and Region3. That's because, the code is only stored in the database. But I need to join the table 23 with 1 so I can extract names of country or region3 rather than integer values. How would I modify the query below? $keywords are the search words. You want a JOIN, obviously. I'm assuming you're using Mysql. If you aren't, you may need a different syntax. $query = SELECT id, firstname, familyname, middlename, fathername, region3, region4, country, country.countryname MATCH(firstname, middlename, familyname, fathername) AGAINST ('$keywords' IN BOOLEAN MODE) AS score FROM members LEFT JOIN country ON members.country = country.id WHERE MATCH(firstname, middlename, familyname, fathername) AGAINST ('$keywords' IN BOOLEAN MODE) ORDER BY score DESC; And do the same kind of thing for region3. -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Joining Tables for Search
Thanks Pablo, that worked. Pablo M. Rivas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello Harry, you can use left join: http://dev.mysql.com/doc/mysql/en/JOIN.html $query = SELECT members.id, firstname, familyname, middlename, fathername, region3.region3, region4, members.country, country.countryname, MATCH(firstname, middlename, familyname, fathername) AGAINST ('$keywords' IN BOOLEAN MODE) AS score FROM members left join country on members.country = country.id left join region3 on members.region3 = region3.id WHERE MATCH(firstname, middlename, familyname, fathername) AGAINST ('$keywords' IN BOOLEAN MODE) ORDER BY score DESC; good luck. HG Hi, HG I want to run a query on a table while joining it with other tables. HG Table 1- members HG id - firstname - middlename - - country - region3 HG Fields country and region3 hold the integer codes for country and region3 is state HG Table 2- country HG id - countryname HG Countryname is where the actual Country name is stored and id is the country code HG Similarly Table 3 - region3 HG id - region3 where region3 is the state name and id is the region code. HG I perform the following query to search the names in the database but the result only gives me the integer values for Country and Region3. That's because, the code is only stored in the database. HG But I need to join the table 23 with 1 so I can extract names of country or region3 rather than integer values. HG How would I modify the query below? HG $keywords are the search words. HG $query = HGSELECT id, firstname, familyname, middlename, fathername, region3, region4, country, HG MATCH(firstname, middlename, familyname, fathername) AGAINST ('$keywords' IN BOOLEAN MODE) AS score HG FROM members HGWHERE MATCH(firstname, middlename, familyname, fathername) AGAINST ('$keywords' IN BOOLEAN MODE) ORDER BY score DESC; HG Thanks HG Harmeet -- Best regards, Pablo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Match Against Query with Integers
Hi Here's the senario... Table 1- members id - firstname - middlename - - country - region3 Fields country and region3 hold the integer codes for country and region3 is state Table 2- country id - countryname Countryname is where the actual Country name is stored and id is the country code Similarly Table 3 - region3 id - region3 where region3 is the state name and id is the region code. I want to query country code and state code in the database but the fields are integer values. I am trying to modify the following query, but I think it will not work for integers? Is that correct?? $keywords are the contry state codes (integers). $query = SELECT id, firstname, familyname, middlename, fathername, region3, region4, country, MATCH(country, region3, region4) AGAINST ('$keywords' IN BOOLEAN MODE) AS score FROM members WHERE MATCH(country, region3, region4) AGAINST ('$keywords' IN BOOLEAN MODE) ORDER BY score DESC; Thanks Harry
[PHP-DB] Joining Tables for Search
Hi, I want to run a query on a table while joining it with other tables. Table 1- members id - firstname - middlename - - country - region3 Fields country and region3 hold the integer codes for country and region3 is state Table 2- country id - countryname Countryname is where the actual Country name is stored and id is the country code Similarly Table 3 - region3 id - region3 where region3 is the state name and id is the region code. I perform the following query to search the names in the database but the result only gives me the integer values for Country and Region3. That's because, the code is only stored in the database. But I need to join the table 23 with 1 so I can extract names of country or region3 rather than integer values. How would I modify the query below? $keywords are the search words. $query = SELECT id, firstname, familyname, middlename, fathername, region3, region4, country, MATCH(firstname, middlename, familyname, fathername) AGAINST ('$keywords' IN BOOLEAN MODE) AS score FROM members WHERE MATCH(firstname, middlename, familyname, fathername) AGAINST ('$keywords' IN BOOLEAN MODE) ORDER BY score DESC; Thanks Harmeet
[PHP-DB] What's wrong with this QUERY??
Hi, I have a database with members details and PK is id. $thing = [EMAIL PROTECTED]; $query = SELECT id, email, familyname FROM members WHERE email=$thing; $result = mysql_query($query); If i do a query where id=$thing. and $thing=20; this works fine and I get the desired result. But what is wrong with the other one, when I do search for the email address?? The email address does exist exactly as quoted above in the email field in my members table but still doesn't produce any results. Any help is much appreciated. Harmeet -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: What's wrong with this QUERY?? - Thanks all.
Thank you everybody. Harry G [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I have a database with members details and PK is id. $thing = [EMAIL PROTECTED]; $query = SELECT id, email, familyname FROM members WHERE email=$thing; $result = mysql_query($query); If i do a query where id=$thing. and $thing=20; this works fine and I get the desired result. But what is wrong with the other one, when I do search for the email address?? The email address does exist exactly as quoted above in the email field in my members table but still doesn't produce any results. Any help is much appreciated. Harmeet -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php, javascript and db - your help is needed
Hello, I have a HTML form with 2 select boxes, lets say students and courses. When the from loads for the first time, I fill the students select box with data from database. The courses selectbox remains empty. When the user selects a value from the students selectbox (onchange event), I should go to the db to reterive the courses for the selected student and fill the courses selectbaox. I found it very complicated to do the interaction between javascript and php: apparently, I have to submit the from for the selected student id to be passed as a parameter to php (so that php can access the db with the student id and retrieve his courses), and at the same time I want the form to stay with the list of students, and the selected student. This should not be that hard, should it?! this is something trivial, I hope? I also tried using cookies, with no success. If someone knows how to do that, please let me know. Best Regards, G. Cohen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[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
Re: [PHP-DB] HELP: best way to TEXT dump a MySQL table to a local file...
would be nice... but since this is a hosted site and no shell access or anything, i thought i would write the php script to dump the file to my web path... Ignatius Reilly wrote: 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 -- Leo G. Divinagracia III [EMAIL PROTECTED] z -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] where to find tutorial
Doug -- ...and then redhat said... % % I have some very crude scripts that I have mangled together to allow % customers to request CSR call-backs when they want new service. I am % trying to make the page more user-friendly. I have three fields that I ... % What I want to do is to allow someone to select a zip code and the city % and state fields automatically change appropriately - and visa versa on If you mean that you want the city and state to change without the user having to press a submit button, you'll need to look at some client-side javascript to detect when a value is filled in and redisplay the page. If, on the other hand, you hate javascript as much as I do, you could accept either the zip OR the city and state (and perhaps just the city, if they're unique enough in your not-ever-going-to-expand scenario) with a buttonclick and then return a page with more goodies filled in. So what did you mean and what do you want? HTH HAND PS -- Change your name to SuSE; it's better than RedHat :-) :-D -- David T-G [EMAIL PROTECTED] http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgpkK3rYoq22M.pgp Description: PGP signature
Re: [PHP-DB] no temp var for mysql_fetch_array results
Justin, et al -- ...and then Justin Patrin said... % % David T-G wrote: % % ...and then Justin Patrin said... % % ... % % Of course, this leaves the result handle open. It's best to store the % % result handle and free it with mysql_free_result(). % % Makes sense. I actually hadn't thought of that; do I need to do that % after a typical while(mysql_fetch_array()) or does the exhaustion caused % by the while loop then close and free for me? % % Nope, it's kept open so that you can use a seek to go back to the % beginning i fyou want to (at least, I'm pretty sure that's what it's % doing). You should always use mysql_free_result on your statement/result % handle. Ah... Very interesting. One learns something every day :-) % % Of course, you don't *really* need to do this if your script is small as % PHP will free everything when it's done, but it's good coding style and % can keep you from (possibly) running out of memory in larger scripts. Right. And surely someone who so fastidiously fclose()s every fopen()ed file, even if it was opened read-only, would want to tie up any loose db ends in the same way! One last question... If I make a query and run through the results and then make another query, reusing the same result handle, should I have freed the first result before assigning the second? That is, does that handle get closed automatically or orphaned for garbage collection at the end of the script? % % -- % paperCrane Justin Patrin Thanks again HAND :-D -- David T-G [EMAIL PROTECTED] http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Linux/PHP/Access Database - oh boy :(
Alex, et al -- Sorry I'm late, and I hope that your upcoming mysql install works out well for you. Since you have the ability to convert this DB to something else (I was going to ask but got busy and then this whole thread happenned :-) could you also just dump it to a CSV file? That would be easy to read in with PHP, and since you have so few records the performance impact should be negligible. That way you also don't have to learn how to do something new (talk to a dbase5 file in mysql) while you are under such pressure (but go back and learn mysql anyway :-) HTH HAND :-D -- David T-G [EMAIL PROTECTED] http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] no temp var for mysql_fetch_array results
Jeff, et al -- ...and then [EMAIL PROTECTED] said... % [quoting me] % % mysql_fetch_array() returns an array, and I know I want a field from just % this one row (not looping), could I just % % $i = mysql_fetch_array($r)[0] ; % % Hi David % How about: % $i = mysql_result(mysql_query($q,$dbro),0); Well, I *thought* it was perfect. Unfortunately, it ain't in practice. Running $r = mysql_query(select ID from customer where EMail = '$email',$dbro) ; $row = mysql_fetch_array($r) ; $id = $row[0] ; works, but $id = mysql_result(mysql_query(select ID from customer where EMail = '$email',$dbro),0) ; or even $r = mysql_query(select ID from customer where EMail = '$email',$dbro) ; $id = mysql_result($r,0) ; fails with Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 4... Now this makes some sense; the manual says that mysql_result ( resource result , int row ) will jump to row $row in the output but says nothing about returning me a given fields. Any other thoughts? % HTH % Jeff TIA again HAND :-D -- David T-G [EMAIL PROTECTED] http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] no temp var for mysql_fetch_array results
Jeff, et al -- ...and then [EMAIL PROTECTED] said... % % Hey David... Hi again! % % Does this mean you are potentially brining back more then one row, and % mysql_result doesn't know where to get it from? Does this change if you % add, LIMIT 1 to the query. In this case, we're absolutely sure; the email addresses are unique, so I'd only get back one. And since mysql_result() is supposed to jump to a certain row it shouldn't matter whether I get back one or more... Still confused, :-D -- David T-G [EMAIL PROTECTED] http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] no temp var for mysql_fetch_array results
Jeff (and John) -- ...and then [EMAIL PROTECTED] said... % ... % $r = mysql_query($q,$dbro) ; % $row = mysql_fetch_array($r) ; % $i = $row[0] ; ... % this one row (not looping), could I just % % $i = mysql_fetch_array($r)[0] ; % % Hi David Hi! % How about: % $i = mysql_result(mysql_query($q,$dbro),0); Oooh! Cool! Just right. % HTH % Jeff Thanks HAND :-D -- David T-G [EMAIL PROTECTED] http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] no temp var for mysql_fetch_array results
Justin, et al -- ...and then Justin Patrin said... % % David T-G wrote: % % ...and then [EMAIL PROTECTED] said... % % ... % % How about: % % $i = mysql_result(mysql_query($q,$dbro),0); % % Oooh! Cool! Just right. ... % % Of course, this leaves the result handle open. It's best to store the % result handle and free it with mysql_free_result(). Makes sense. I actually hadn't thought of that; do I need to do that after a typical while(mysql_fetch_array()) or does the exhaustion caused by the while loop then close and free for me? Thanks TIA HAND :-D -- David T-G [EMAIL PROTECTED] http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
[PHP-DB] no temp var for mysql_fetch_array results
Hi, all -- I have some code which looks about like if ( $_POST['signup']['referrer'] ) # a friend? { $q = select InvitedBy from customer where EMail = '{$_POST['signup']['referrer']}' ; $r = mysql_query($q,$dbro) ; $row = mysql_fetch_array($r) ; $i = $row[0] ; } else # no referrer supplied { $i = '' ; } and I would really prefer not to have to use $row just to set $i. Since mysql_fetch_array() returns an array, and I know I want a field from just this one row (not looping), could I just $i = mysql_fetch_array($r)[0] ; somehow? TIA HAND :-D -- David T-G [EMAIL PROTECTED] http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] RE: [tcphp] Hella fun project I'm about to throw at some tech col lege students
Rafi -- ...and then Rafi Sheikh said... % % Hi List. A quick question. I have some categories that are really long % and I would like to re-word or re-format them when I am bring data in from a % DB. Now which would be better: Can you describe an algorithm for doing so? Your example appears fairly arbitrary -- that is, I can guess that Co is Company and so whatever is before it is the company name and otherwise hypothesize that 'USA North Upper is a region and thus *not* part of the company name, but until you pin down some sort of an algorithm you needn't try to choose between languages. You may end up having to go with prolog :-) Good luck HAND :-D -- David T-G [EMAIL PROTECTED] http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Re: [PHP] What's wrong with this IF statement?
if ($cat_id != 53 || $cat_id != 54 || $cat_id != 55 || $cat_id != 117 || $cat_id != 118 || $cat_id != 74) anyone else see the problem with the IN clause instead: ie. if !($cat in (53, 54, 55, 117, 118, 74))... makes building SQL statements much easier. especially with mutiple SELECTS in a pull down form object. -- Leo G. Divinagracia III [EMAIL PROTECTED] z -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] getting one line of info at a time
Doug -- ...and then Hull, Douglas D said... % % 1. I have a regular html textarea field for a person to enter in words with a carriage return after each word. In PHP how would I go about getting one line (or word) at a time? Then I will be needing to get character by character. You'll get it all because the user will type in as many entries as he will and then hit the submit button and it all comes to you. Or were you thinking of some javascript on your page to do things one word at a time? [One word about that: YUCK! :-] If your page looks like form action='/path/to/script.php' method='POST' Type your words:br textarea cols='20' rows='4' name='ta' /textareabr Now type some words here:br input type='test' size='20' name='i'br input type='submit' value='Click!' /form and you feed a b c and a b c to the fields then your script will have something like Array ( [ta] = a b c [i] = a b c ) for its input. You can just use a foreach to walk through the list, or explode based on newlines for multiword input, or whatever you need to do. HTH HAND :-D -- David T-G [EMAIL PROTECTED] http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
[PHP-DB] php to mysql client problem.
This is my setup: Not really worried about security. W2kPro w\sp4 Mysql 5.O Mysqlcc0.9.4 Php 5.0.0.b3 [As CGI] Apache2.0.48 I can now connect to my server from anywhere using Mysqlcc or another server... home, work, etc. I can run Php scripts. I can connect to the Apache Server. Login to Mysql: Works. ==C:\mysql -u mike -p ==Enter password: ==Welcome to the MySQL monitor. Commands end with ; or \g. ==Your MySQL connection id is 28 to server version: 5.0.0-alpha-max-nt ==Type 'help;' or '\h' for help. Type '\c' to clear the buffer. PhpInfo Shows: ==MySQL Support enabled ==Active Persistent Links 0 ==Active Links 0 ==Client API version 3.23.57 ==Directive Local Value Master Value ==mysql.allow_persistent On On ==mysql.connect_timeout 60 60 ==mysql.default_host localhost localhost ==mysql.default_password no value no value ==mysql.default_port 3306 3306 ==mysql.default_socket no value no value ==mysql.default_user root root ==mysql.max_links Unlimited Unlimited ==mysql.max_persistent Unlimited Unlimited ==mysql.trace_mode Off Off I Try to connect from PHP and I get: ==Not connected : Client does not support authentication protocol ==requested by server; consider upgrading MySQL client Could this be the Reason?: From the PHP info above. ==Client API version 3.23.57== I'm thinking yes, but since copying the new files to the same directory overwrote all the others, is this the client version for all servers currently?? If not how do I force it to update. I have all the servers working. I don't really at this point want to delete anything. Michael G. Tracey ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] connection problem??
I'm using an example from a book [see below]... First I was getting: 0:0 as the result. I dropped the complete Mysql 4.1.1 backup into my directory. Ran code below as phpconn.php html head title/title /head body ?php $lnk = mysql_connect('localhost', 'my_username', 'my_pass') or die('Not connected : ' . mysql_error()); // make foo the current db mysql_select_db('mysql', $lnk) or die ('Can\'t use foo : ' . mysql_error()); ? /body /html Now keep getting the error below... Any ideas??? Not connected : Client does not support authentication protocol requested by server; consider upgrading MySQL client I dropped the same version as before. Cannot remember if I specified another authentication protocol or how I did it. Michael G. Tracey ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] getting font size from browser
thanks, wil use a java group next time, did not know that roy Miles Thompson [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] PHP is SERVER side, not browser side. That's a Javascript question. Miles At 11:14 AM 1/30/2004 +0100, Roy G. Vervoort wrote: Is it possible to retreive the font size or view size from the browser. In the browser it is possible to change the screenview (make it larger or smaller for people with a visual aid). I would like to ineract my stylesheet with these default settings. thans Roy -- 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] getting font size from browser
Is it possible to retreive the font size or view size from the browser. In the browser it is possible to change the screenview (make it larger or smaller for people with a visual aid). I would like to ineract my stylesheet with these default settings. thans Roy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Wonder Program Question
Paul -- 1) You've hijacked this thread. Don't do that. You don't even get the benefit of explanation, however, because ... 2) What does this have to do with PHP (or, worse yet, PHP with databases)? 3) STFW HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] test
Florian -- ...and then Florian Habegger said... % % test Please don't post tests here. We got this and your THREE copies of your oci8 question (for which I can only wish you good luck). HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
[PHP-DB] PhP 5.0, Mysql4.11,Apache2.0.48
I have PhP 5.0, Mysql4.1.1,Apache2.0.48 on Win2k Pro... PhP is configured as CGI... I have been able to run simple PhP scripts. I hear this setup is suicidal though...Aside from the fact these are the latest versions... why??? I have not had time to use this setup to access MySQL with PhP. Will try sometime this week. I want to use MySQL to access some MS-Access databases from a program I use at work [With ODBC]. The manual says support is built in to PhP for MySQL. But I thought it was'nt any longer. Michael G. Tracey ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: L'utente Fabio Farinelli ha cambiato indirizzo di posta elettronica.
Hi, all -- ...and then Justin Patrin said... % % Ignatius Reilly wrote: % % Somebody with admin rights to this list please castrate this Farinelli % user. % % +1 on that! for(;;++); :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] csv export...?
Andre, et al -- [Sorry for the delay...] ...and then Andre Speelmans said... % % Hi David, Hi! % % On Fri, Jan 09, 2004 at 11:04:21AM -0500, David T-G wrote: % %header (Content-Type: application/csv;) ; # this is a CSV %header (Content-disposition: attachment; filename=authorized-visitors.$d.csv) ; # file name %... % [suck in file and dump into $a array] % foreach ( array_keys($a) as $ak ) # walk thru the array %{ print \$a[$ak]\, ; }# print the field (yes, even if blank) % % But this would go wrong if $a[$ak] contained a double quote. Remember you have Oooh; good point. My input is all sanitized, so becoamse quot; and so on, but for raw data that would definitely be a factor. % to escape those characters. Can't the database of OP do a dump, like MySQL % can? Well, in my case each record is a file on disk, so that doesn't apply. Thanks HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] csv export...?
Tristan -- ...and then [EMAIL PROTECTED] said... % % Google is not my friend today... ... % Now I have found loadsa sites that let me upload a csv file, but not the % other way around... You might check PHPClasses to see if anyone has done this; I wouldn't be surprised. In general, though, you declare the file type and then run through a loop. From some code I have: header (Content-Type: application/csv;) ; # this is a CSV header (Content-disposition: attachment; filename=authorized-visitors.$d.csv) ; # file name ... [suck in file and dump into $a array] foreach ( array_keys($a) as $ak ) # walk thru the array { print \$a[$ak]\, ; }# print the field (yes, even if blank) print \n ;# end the row $total[$d]++ ; # keep count } # if($age||$ftime) // }}} } # if(is_file) } # while(readdir)// }}} % % Anyone care to help? There ya go :-) HTH HAND Happy New Year :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] csv export...?
Viorel, et al -- ...and then Viorel Dragomir said... % % It looks like is not so simple. But is not difficult at all.. Right. % ... % while($row = mysql_fetch_row($result)){ % print implode(,, $row); I agree that implode is a better way to go. I had to have my fields export in a particular order when they were stored differently, so I loop through my format array to get the order of the keys to pull from the data array. HTH HAND HNY :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] csv export...?
Tristan -- ...and then [EMAIL PROTECTED] said... % % Getting there... % That did indeed output my results to the screen... Yay! % Next steo is to output that same data to a new file... A file on the surfer's computer or a file on your server? % % I've done downloads on my site elsewhere, using header(), but with % existing files... % I guess I need to learn how to use fwrite? Only if you plan to store the result file on your server, and since you have the DB there I don't see why you would. HTH HAND HNY :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] csv export...?
Tristan -- ...and then [EMAIL PROTECTED] said... % % On the users computer... OK; that's what I figured. % When my bosses look at the reporting tool I built. % They are gonna hit the export link, and get directed to a page that let's % them save the data as a csv file, for use in excel. Yep. % That's the code I'm working on here today... Look at the header() lines in my reply outside of this subthread. % % ho hum... is it the weekend yet ;-) Not quite, but you're closer :-) HTH HAND HNY :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Reading emails with PHP
Manuel, et al -- ...and then Manuel Lemos said... % % Hello, Hi! % ... % A more useful solution is one based on setting the return path address % of the message being sent in such a way that you can retrieve the % original recipient address from the bounced message recipient address. Agreed. Full VERPing can be done if the client is interested :-) % % This has just been discussed here: % % http://marc.theaimsgroup.com/?t=1071585r=1w=2 Thanks! % % -- % % Regards, % Manuel Lemos HAND Happy Holidays :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Reading emails with PHP
(bounce) ## }}} where the '?' is a placeholder for the values you'll provide at execution time. This, IMHO, is a pretty slick feature; it essentially turns your query string + resource connection into a function that accepts your varying input and then executes the call. So there you have it... This perl script is only 58 lines long and handles just about every sort of bounce known to man and then goes and updates two DB tables with the info it pulls out. It's called from the apparent sender's .qmail (like .forward) file, which also dumps a copy of the message onto a mail spool for us to review if we ever need to. HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Reading emails with PHP
, and good for you for digging in! % % HTH HAND % % :-D % % Thanks, % John [snip] There probably isn't the slightest chance that you could avoid having that gawdawful book of a footer put on your messages, but if you could I'd sure appreciate it. HTH HAND Happy Holidays :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Reading emails with PHP
Chris -- ...and then Chris Payne said... % % Hi there everyone, Hi! % % A quick question, is it possible to read a failed mail email ... % % Any help, tips would be REALLY appreciated as I REALLY don't want to spend a few days doing it manually. It may be sacrilege to mention it here, but there is an excellent perl module for handling mail bounces; I've used it to write a handler that catches the returned mail, gets the address(es) and reason(s) for the bounce, and then goes into our DB and flags the matching users. I looked all around at the time (this summer) but saw no php code like it, so I overrode my client's desire for PHP with his desire for savings :-) % % Oh and Merry Christmas / Happy Holidays. And to you! % % Chris HTH HAND Happy Holidays :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] {PHP-DB} password generator
Nikos -- ...and then Nikos Gatsis said... % % Hello list Hi! % % Is there any PHP script that generate password with digits from [a-zA-Z0-9] to suggest me? This just came up on the php list recently... The best one that I saw was a one-liner which peels the first N chars from an md5 string, like $password = strtolower(substr(md5(uniqid(time())), 0, 7)); or so (here N = 8 and so we're using chars 0..7). % Thanx HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Downloading PHP source from a PHP filename, possible?
Jerry -- ...and then JeRRy said... % % Hi, Hi! % % Thanks for the code(s), finally got it to display in a % page. But I crashed the server in the attempt. Very % bad thing I did... Which threw out over 3000 processes % for just visiting the page the one time... eck! Oops :-) % % It was nasty, I hope noone else attempts it. If % people want the code that I used that simply caused % more headaches than anything else I am happy to post % it. Than again why would you want it? So than again % I may not. :P *grin* % % Okay finally I have multiple domains. % % domain1.com % domain2.com Yay. % % Is it possible to grab the source using some PHP code % from domain2.com and display it on domain1.com? Nope. Well, not unless you have it on domain2 so that anyone could get it (eg as a .phps or a .txt or even a not-interpreted .php). % % There *must* be some way, because when you point your % web-browser to domain1.com it loads the source, so % windows reads the source to display and the webserver Not quite. % handles the requests. So there must be some way to % actually grab it? Or no? I don't mean the HTML % source I mean the entire PHP source. Exactly. That's what you can't have. % % Thinking about it more maybe it is not that possible % as the web-server handles the PHP requests and than % the browser outputs it from what the web-server says. Yep. % % I dunno, but how is it possible to grab local PHP % source but not from another domain? I'd think it work % in the same manner but guess there is something % locking that out. If you can read the file from your disk then you can load it up; it's part of domain1's local files even if it's meant to be displayed somewhere else. Hmmm... That brings up two points. The sane one is that if both domains are hosted on the same server then you can often share the file (but if safe mode and the like are on you may not be able to get out of your own jail). The insane one is that if you mount the other server's disk via NFS or such then it looks local and apache can go and load the file -- but that's quite insane indeed. % % I own both domains and thought it be easier to have % one domain for the code and one domain for displaying % the code. So I could use the other domain to test Again, if they're hosted together, then it becomes a piece of cake. What we do on our server, for instance, is / home/ sites/ .php/ dev/ code.inc tst/ pro/ index.inc site1/ web/ code.php site2/ web/ index.php where the two .php files just look like ?php include(/home/sites/.php/dev/code.inc); ? ?php include(/home/sites/.php/pro/index.inc); ? and all of the magic is done in our protected area where users cannot go (they are jailed at the siteX level) and certainly can't change it. % with and users could also and the other domain for % demo's on what to do to achieve things with PHP/mysql % etc. Which Only I can edit. Well, don't give your users permission to edit the central repository on the other machine, of course... % % I understand PHP has a ftp service in PHP, could this % work to download the source? Only if you want it to be downloadable, and I still don't recommend it. % % Thanks for your time. That's why we're here :-) % % Jerry HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Buy beer and smoke at ANY age
George, et al -- ...and then George Patterson said... % % On Fri, 28 Nov 2003 07:28:36 -0800 % [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: % % This is not Spam. You signed up with partner site asking for fake % license info. % % If it is not Spam, it is a good imitation. *grin* % % Can someone un-subscribe this email. Ban godaddy.com could be a good % idea as well, as I am not aware of any legitimate users coming from % there. Surely you don't *really* think that this actually came from godaddy, do you? % % Thanks, % % George HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Downloading PHP source from a PHP filename, possible?
Jerry -- ...and then JeRRy said... % % Hi, Hi! % ... % If a file is called blah.php and is only tailored to % PHP code is it possible to make it downloadable either % as a file-download or appear as plain text in a % browser window? You could probably manage anything, though it might be a little tricky; if you really insisted on having just the one file, I'd actually have a wrapper script which is allowed to display the php source of another file. Hmmm... As I think about it, there's probably no reason that special script couldn't display itself, which means there's no reason your original file couldn't display itself either; you'd no doubt have a display function just for that. Gonna have to think about that one. Anyway, what I usually do if I have a need to display the source of running code is just make a symlink as either blah.txt or blah.phps (depending on whether I want it to be readable on the surfer's windows box after downloading or want colorization by apache) so that I save space and have only one thing to maintain. I could use a hard link but then it's easy to forget that it's a link :-) But I'm going to have to go and think about including and recursion for a bit, starting with how to do it for some specific other file. It could be as easy as print file(blah.php) ; or such... HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] a LITTLE bug with my CSV importer :-)
Chris -- ...and then Chris Payne said... % % Hi there everyone, Hi! % % OK So I kind of have my CSV utility working nicely, except for one thing - if I import the file with PHPMyADMIN it imports over 1000 rows (Which is correct) but with the below code on the same file, it's only importing 92 rows, can anyone see anything obvious that's wrong? I think it could be the MySQL query, as I have a count statement which counts the number of rows in the loop and it counts correctly and if I print the data on the screen it prints the data correctly, just when it writes to the DB argghhh i'm going nuts, i've been trying hard to figure it out without hasstling the group (Sorry). The first thing that comes to mind is to check the PHPMyAdmin code to see how they do a CSV import and steal that code :-) The second thing is, since you suspect your mysql query, to just read in the file and verify your count without trying to do anything with the data; if you get all 1k rows then you don't have to worry about your input mode. If you don't get all of the rows, then see if you really read the whole file and either stopped early or skipped over some, and check those rows for problems. [You haven't shown us sample data -- no, I don't want all thousand rows! -- so it's tough to be more specific.] Don't think of it as hassling the group; think of it as coming for help :-) It's why we're all here! HTH HAND good luck :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Splitting a CSV file
Chris, et al -- ...and then Chris Payne said... % % Hey there, Hiya! % % I just want to thank everyone for their time and help, you've all been so % valuable and solved my problems :-) I needed the hidden max_file_size bit Glad to hear it, and sorry it took me so long to get here. There's that other thread on the PHP list... *sigh* % in the form. But i'm also going to look at all your other suggestions Yep. I was going to suggest that you need post_max_size upload_max_filesize and perhaps memory_limit max_input_time bumped up from the defaults. A good way to check this sort of thing is to look at phpinfo() output and see what could be keeping you back. In my case, I didn't have _filesize and so I could watch the files spool up in /var/tmp and then suddenly disappear even before the upload finished! HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] - ereg_replace
Hi! ...and then ÍÉÊÏÓ ÃÁÔÓÇÓ said... % ... % ereg_replace(^a href=\([:alnum:])\$, a href=\\\1\ % target=\_blank\, $string) % % I echo the result but nothing changing. % What Im doing wrong? Is your string really the only thing on a line, or could it be anywhere in the input? The ^ (beginning) and $ (ending) anchors are probably messing you up. If your format *is* like this, you could do a quick preg_replace('/$/',' target=_blank',$string) (untested) and be done with it :-) % Thanx HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] - ereg_replace
Hi again! ...and then ÍÉÊÏÓ ÃÁÔÓÇÓ said... % % Thank you for reply, but the a is not the only tag in my string. You're quite welcome, and now we definitely know that ^ and $ are not what you need. HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] No tuples available
Ryan -- ...and then Ryan Jameson (USA) said... % % Is there a way to tell PHP to not show just this warning? Maybe there Have you tried using @ in front of the odbc_fetch_row call? That will shut it up: PHP supports one error control operator: the at sign (@). When prepended to an expression in PHP, any error messages that might be generated by that expression will be ignored. I'd bet a twinkie that you get it when you have no more data. You should implement the PEAR FutureGaze module so that you know to stop one row earlier ;-) HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] RE: Adding in MySQL
John -- ...and then Dillon, John said... % % Thanks for the three replies and two tickings-off. It was a spelling % mistake in my table name. I hate those :-) But I'm glad to see you found your answer. % % The reason I tend to top post is that you then don't have to read the % disclaimer or address details from my company in a reply. Sometimes in easy The proper answer isn't to bottom-post, either; that's just as bad. The proper answer is to trim away that which is not relevant as you reply in context. See this reply as a good example (though it has been argued that leaving such as Regards, John is *still* excessive). Remember, just because Outhouse ruined email/news netiquette and lawyers insist on ridiculous disclaimers doesn't mean that you have to give in and do it wrong. % situations the question is clear from the reply plus the subject line. Then trim away everything. % % Regards, % % John HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] BRU Help
Nitin -- ...and then Nitin said... % % I'm sorry, I know this is not the list, to ask this question, but I couldn't find the right one. You're right; it isn't. Neither is the PHP list. Although I've heard of it, I've never had any involvement with BRU; I think it's safe to say I'm pretty new to it. Less than sixty seconds with google led me to BMTMicro's Tech Support page where I see I am an end user. I am having all sorts of problems. Can you help me? Yes we can help you. which certainly seems like the sort of thing you need. Go there. HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] UNSUBSCRIBE PLEASE (FW: L'utente Fabio Farinelli ha cambiato indi rizzo di posta elettronica.)
Richard -- ...and then Hutchins, Richard said... % % Can the list admin please remove this user from the list? Every post I make % results in the reply below. % % -Original Message- % From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] ... % Il nuovo indirizzo è: [EMAIL PROTECTED] I'd say if we all start forwarding these to this address Fabio might take care of it himself :-) HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] UNSUBSCRIBE PLEASE (FW: L'utente Fabio Farinelli ha cambiato indi rizzo di posta elettronica.)
Richard -- ...and then Hutchins, Richard said... % % I'm pretty sure the message says that it comes from an autoresponder and not % to respond to that e-mail. I don't speak Italian so I can't vouch for that % being an accurate translation, but that's what it looks like. I asked babelfish and it looks more like an autoresponder saying that your mail will be forwarded on to Fabio at this new address within 60 minutes or so but to change your addressbook. We'll see; I just bounced two messages there. Maybe I'll forward the next one to give it a return path... HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Using two colomns of mysql data as key/value pairs in arrays
Devon -- ...and then Devon said... % ... % 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. You won't get that directly; you'll have to build your final array from the results. You can read your info out of the DB as an indexed or associative array (via mysql_fetch_array) or just as values (mysql_fetch_row), but you'll only get one result at a time. You need to loop through the results with something like $result = mysql_query(select id,name from a_table) ; $everyone = () ; while ( $row = mysql_fetch_array($result) ) { $everyone[$row['id']] = $row['name'] ; } or so to fill up $everyone so that you can then look up by $everyone[$id]. Note that I don't recommend this as the best approach, and I don't think that anyone else does, either. Usually you want to avoid sucking an entire database into your script's memory; the database (and its coders) almost always handles data better than we mere mortals. A much better approach is to make your select call per specific ID and get out only the name(s) that you need, and then go back later and make a different call. The only time I can see sense in scanning the whole table is when you want to dump the entire list of people or some such, and then rather than doing it in two steps of loading your $everyone and then spitting out I'd probably do something like $sql = select id,name from a_table order by department ; $result = mysql_query($sql) ; while ( $row = mysql_fetch_array($result) ) { print ID: {$row['id']}\tName: {$row['name']}br\n ; } to just run through the data. I'm sure others here know of even better ways to print a roster :-) % % Any help would be wonderful! :) HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Using two colomns of mysql data as key/value pairs in arrays
Jon, et al -- ...and then Jon Kriek said... % % Ignatius, the original poster mentioned an associative array - The [snip] The original poster actually mentioned an associative array with one db field as the index and another as the value. None of these, just like Ignatius's suggestion, will do the job. I didn't think it worth shooting down someone who was being helpful, though, when I made my response. HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Using two colomns of mysql data as key/value pairs in arrays
Chris, et al -- ...and then Chris Boget said... % % Actually, for an associative array (which the OP had made reference % to), you use mysql_fetch_assoc(). See my response to Jon. No single function of which I know is going to pull what he requested out of the database in the format he desires. % I avoid mysql_fetch_array() like the plague unless there is a very % specific need. I'm interested in this... The manual reports that there is a very trivial slowdown. Do you find that to not be true? It's easier for me to just always use mysql_fetch_array instead of figuring out whether I want mysql_fetch_row, mysql_fetch_assoc, or both. % % Chris HTH TIA HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Using two colomns of mysql data as key/value pairs in arrays
Chris -- ...and then Chris Boget said... % % The original poster actually mentioned an associative array with one db % field as the index and another as the value. None of these, just like % Ignatius's suggestion, will do the job. % % Actually, mysql_fetch_assoc() will do quite nicely. Really? How? I must be quite confused. Given a DB table that looks about like idname 01david 02anna 03eunice 04bob 05celeste 06fred then code like $result = mysql_query(select id,name from table) ; while ( $row = mysql_fetch_assoc($result) ) // or mysql_fetch_array($result,MYSQL_ASSOC) for those who like mysql_fetch_array but for some reason care about the memory used by a single record { ... } will yield $row like array ( 'id' = 01, 'name' = 'david' ) or so every time. How on earth is that going to get Devon his desired array ( '01' = 'david' , '02' = 'anna' , ... ) as requested without some php work? % % I didn't think it worth shooting down someone who was being helpful, though, % when I made my response. % % It didn't seem like he was shooting you down. No, but IMNSHO he shot a rather rude hole in Ignatius. % % Chris TIA HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Using two colomns of mysql data as key/value pairs in arrays
Jon -- ...and then Jon Kriek said... % % Easier is not always right or good script-logic Admitted. I just want to know why it's wrong or so-very-not-good. % % Would it be easier for you to type: % % mysql_fetch_array($result, MYSQL_ASSOC) { If I needed to care about the space used by a single record I would probably do that; it leaves me with only one function to have to remember and if I have a real need to tune it down to one or the other then I can specify the array index format. % % It's easier for me to just always use mysql_fetch_array instead of % figuring out whether I want mysql_fetch_row, mysql_fetch_assoc, or both. % David T-G [EMAIL PROTECTED] wrote in message % news:[EMAIL PROTECTED] Dude, your quoting *really* needs some help... Oh, Outhouse. My condolences. Thanks HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Using two colomns of mysql data as key/value pairs in arrays
Jon, et al -- ...and then Jon Kriek said... % % Trust me, I was not shooting anyone down, I would rather quit programming % then do that - seriously. Fair enough, and truce declared. Now to simply discuss the finer points of mysql_fetch_* :-) % % -- % Jon Kriek % http://phpfreaks.com HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Using two colomns of mysql data as key/value pairs in arrays
Chris, et al -- ...and then Chris Boget said... % % % Actually, mysql_fetch_assoc() will do quite nicely. % Really? How? I must be quite confused. % % No, actually, I am the one who's confused. I misread the OP's email such % that *_assoc() would do the job. *whew* Glad to hear that -- you actually had me reading and rereading the manual pages to try to figure out where my confusion lay! % % My bad. % If MySQL had crosstab functionality, that *might* be able to help. I'll take your word for it; I don't know what crosstab is or gets me :-) % % But I still stand by my assertion that *_assoc() is better than *_array() in % almost all circumstances. OK. I still want to know whether I can trust the manual and believe that the measure if that betterness is so small as to almost be theoretical or must instead see how I've been led down the primrose path. % % Chris Thanks HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] Using two colomns of mysql data as key/value pairs in arrays
Devon -- ...and then Devon said... % % David T-G wrote: % % Note that I don't recommend this as the best approach, and I don't think ... % doing it in two steps of loading your $everyone and then spitting out I'd % probably do something like % % $sql = select id,name from a_table order by department ; % $result = mysql_query($sql) ; % while ( $row = mysql_fetch_array($result) ) % { print ID: {$row['id']}\tName: {$row['name']}br\n ; } % % to just run through the data. I'm sure others here know of even better % ways to print a roster :-) ... % % Indeed, I was trying to simply display a list of the data. I had coded % the formatting and displaying first, based on the array I described, % then tackled the MySQL part last. I see now that it prevented me from Been there; oops-ed that. You can even let the DB format your output for you so that it spits out HTML and then you're *really* on your way to just dumping the output to the page! :-) % seeing the better idea of removing the array from the equation % completely. Your information was invaluble. Happy to help! % % I did however go with mysql_fetch_assoc instead of mysql_fetch_array for % efficiency. :) I hear more and more that that's the way to go :-) HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature