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 Type your words: Now type some words here: 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
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
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 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
[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] 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] PHP-DB - ot browser compatibility
Peter, et al -- ...and then Peter Lovatt said... % % Hi Hi! % % I test on NS 4.75 and IE4 as a minimum browser spec. Those are too maximum, actually. % % I test on the following % % IE 4, 5, 5.5, 6.0 % NS 4.75, 7 (NS 6 has very low distribution and flaky table handling ) % Opera 5.0 and 6.0 % Mozilla 1.1 No lynx? bash-2.05a$ lynx --version Lynx Version 2.8.4rel.1 (17 Jul 2001) Built on freebsd4.5 Jan 23 2002 07:28:38 I'm crushed! ;-) 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! msg17912/pgp0.pgp Description: PGP signature
Re: [PHP-DB] backing up databases
Chris -- ...and then Chris Payne said... % % Hi there everyone, Hi! % % I have way too many databases to backup manually or with PHPMyADMIN, how, using PHP with MySQL could I backup multiple databases easily? 1) What level of 'manual' is too much? 2) Are all of the databases on the server yours to back up, or only some of them? 3) Do you have access to the command line through your php script as might be expected, or are you somehow limited? 4) Do you have a user/password who can dump your databases? 5) Can you use cron to run jobs repeatedly? I'd write a script (php CLI, perl, shell, whatever) to do the dump and then just call it from your web click or, better yet, from a crontab. % % Any examples would be really appreciated :-) Answers first, grasshopper :-) % % Thank you. % % Regards % % Chris 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! msg18010/pgp0.pgp Description: PGP signature
Re: [PHP-DB] How can i upload files
Gabriel -- ...and then Gabriel Gramajo said... % % Hi All, % Can anyone tell me how can i select and upload files using php. You can begin by not hijacking a thread and changing the topic. When you want to start something new, start a fresh message. You could next check the list archives; this comes up at least twice a month. After that you could take a look at the Fine Manual and read the Fine Example and try it out. That's all there is to it! % % Thanks in advance, % % Gabriel, 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! msg18431/pgp0.pgp Description: PGP signature
Re: [PHP-DB] List Server Configuration; Was [Import text file]
Mitch, et al -- ...and then [EMAIL PROTECTED] said... % % Well ... in fact, most lists that I've been on use the Reply-To header to % automate this. MOST email clients I have used do not recognize email as That doesn't make it right :-) % "list email" and while they have a Reply and Reply All option, I've never That doesn't mean they're doing it right :-) % seen a Reply-List option. That doesn't mean it doesn't exist :-) % % So ... what is right, and who is broke could be argued all day. The one % I've seen used the most would be implemented as a change to the list % server. I invite you to surf over to http://www.unicom.com/pw/reply-to-harmful.html and have a read on why this is such a bad idea. % % -- Mitch Now back to our regularly schedule discussions... 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! msg18438/pgp0.pgp Description: PGP signature
Re: [PHP-DB] .htaccess
Matt -- ...and then Matt said... % % I have a php script that accesses a folder, and displays all the photos % inside the folder. I want to use this script to display images that people % upload from the anonymous ftp account. I know that when they upload a photo, % it goes into the: % % /home/username/public_ftp/incoming/ folder 1) Just change your script to point to this directory just like it points to any other folder. 2) Is the public_ftp/incoming/ folder available to the browser, or is it outside the DOCUMENT_ROOT tree? If the latter, you will have to serve up the images yourself rather than relying on http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg18501/pgp0.pgp Description: PGP signature
Re: [PHP-DB] disable right-click in all frames.
Matt -- ...and then Matt said... % % hey everyone. i have a php script that opens up a new window with multiple % frames. i am using javascript to disable the right-click mouse button on ... To answer your question, you might instead of calling the other content directly just have your script spit out the leading javascript and then passthru the actual file. Note that those of us who have javascript turned off can use the right mouse button all we want :-) It may not be worth your effort. 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] compare php and perl
Mignon -- The short answer is that the two are fairly equivalent and if you're asking the question then you're not going to run up against the nitty gritty differences for a while. In general, I bet you get more "PHP is better" answers on this list ;-) Both can talk directly to databases, both are quick, and both are easy to use (and once you know one picking up the other is pretty easy because they are quite similar). Both are popular and many things are written for both because porting is pretty easy. That said, I would be inclined to point a new user who is only writing web pages and web scripts toward PHP because - you can, indeed, easily scatter your php all over your web site (even if some might not think that that's terribly pure :-) while doing so with perl takes a little more manual configuration - perl is incredibly powerful (not to say that php isn't, but...) and picking up php may be likened to learning to fly in a Cessna instead of a multi-engined jet even though I am a fan and user of both and often use perl because an existing script will translate so easily to a web page. For an advanced programmer I'd say to pick up bother because of the awesome depth of functionality available through CPAN, a collection of modules and tools for perl that already do, and generally quite well, anything most people are likely to want to do :-) 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] compare php and perl
Scott -- ...and then NIPP, SCOTT V (SBCSI) said... % ... % correct any of my errors. One other big advantage of PHP is this mailing % list. The people in this list are quite knowledgeable and extremely % helpful. I honestly have not found a group this supportive and responsive Aha -- you obviously haven't found the beginners, beginners-cgi, and db lists at perl.org yet :-) % for my Perl scripting. (This last may sound like sucking up, but it's the % honest truth.) Hey, these *are* awesome lists :-) 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] Generating view of tree?
Craig -- ...and then Craig Kohtz said... % ... % The script I've included works for a table named "structure" with the % following fields: Sounds interesting. Care to actually post the script? ;-) I'd like to see it. 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] Related to WAR - 1
My dear ckra -- ...and then [EMAIL PROTECTED] said... % % The War % By Eduardo Galeano Would you please keep this crap off of the php-db list (and, before I see it anywhere else, any other php list at the very least)? I am here to discuss php and nothing else unless it is related to php. If you want to show how you've used php to create an anti-war site, then that's great. If you want to ask for help in your php project praising GWBush, then do so. If you want to talk/evangelize/whine about war, however, then go and do it elsewhere. It is NOT welcome here. TIA :-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] Sorting issue
Jeff -- ...and then Jeff said... % % Yes duh... *grin* % % I didn't realize numbers weren't considered characters. % What's the sql entry for numeric characters? Integer looks like it will do the trick for you. % % I'm new at this, and figure I'm not doing to bad so far. . I know what you mean :-) Spend a *lot* of time with the manual! 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] Sorting issue
Jeff -- ...and then Jeff said... % % One last question. % % I changed all the DB values where numbers are used - (varchar - int) Well, you should only change for those where the numbers are numbers... % % But for the well locations, there are dashes in them, I.E. 10-15-065-22 Exactly. % % With setting the field to int, it only displays the first part. % 10-15-065-22 shows as 10 % There are also several other fields that use dashes. Then those are an alphanumeric mixture and should be a varchar. % % If I set it back to varchar, will it sort it right because the numbers are % separated by an alfa character, or will I have the same problem as before? If the numbers are padded then it will sort right. That is, is the 065 holding three places with a zero? If it's always 2-2-3-2 digits then sorting will be just fine (just like "00055" would have sorted as you expected against "14000" in a varchar field). 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] MySQL, PHP or ghost?
Peter -- ...and then Peter Beckman said... % % Seems that either I don't understand mysql, or something. Looks like it, though I admit that the manual doesn't adequately explain your results. Check out section 6.2.2.4 for details. % % My table, with the non-important things removed... ... % % So my assumption is that if I insert with year="" it should use the % default. Or at least . That makes sense. And so what is the default? Looks like it is, for some reason, 2000. [This isn't a TIMESTAMP field, so we don't necessarily expect it to be "this year".] % ... % mysql> update plate set year="" where pid=65; ... % +-+-+--+- % | 65 | DVF0343 | 2000 | % +-+-+--+- % % 2000? What? Why? Confused. PHP or Mysql fault? Looks like it's standard mysql behavior: mysql> create table ytest (pid int unsigned not null auto_increment primary key, y year(4)); Query OK, 0 rows affected (0.00 sec) mysql> describe ytest; +---+--+--+-+-++ | Field | Type | Null | Key | Default | Extra | +---+--+--+-+-++ | pid | int(10) unsigned | | PRI | NULL| auto_increment | | y | year(4) | YES | | NULL|| +---+--+--+-+-++ 2 rows in set (0.00 sec) mysql> insert into ytest values ('',1),('',''),('','2000'); Query OK, 3 rows affected (0.00 sec) Records: 3 Duplicates: 0 Warnings: 4 mysql> select * from ytest; +-+--+ | pid | y| +-+--+ | 1 | 2001 | | 2 | 2000 | | 3 | 2000 | +-+--+ 3 rows in set (0.00 sec) mysql> update ytest set y = "" where pid = 3; Query OK, 0 rows affected (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 mysql> select * from ytest; +-+--+ | pid | y| +-+--+ | 1 | 2001 | | 2 | 2000 | | 3 | 2000 | +-+--+ 3 rows in set (0.00 sec) mysql> update ytest set y = '0' where pid =3 ; Query OK, 0 rows affected (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 0 mysql> update ytest set y = '45678' where pid = 2; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 1 mysql> select * from ytest; +-+--+ | pid | y| +-+--+ | 1 | 2001 | | 2 | | | 3 | 2000 | +-+--+ 3 rows in set (0.00 sec) Note that I sometimes get warnings and sometimes don't. I haven't dug into them, though. % % Beckman % --- % Peter Beckman Internet Guy % [EMAIL PROTECTED] http://www.purplecow.com/ % --- 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] MySQL, PHP or ghost?
Peter, et al -- ...and then Peter Beckman said... % % On Wed, 27 Aug 2003, David T-G wrote: % % > Looks like it, though I admit that the manual doesn't adequately explain % > your results. Check out section 6.2.2.4 for details. % % I did; see my previous (moments ago) email on my read on that manual % section. Ah; I will when it comes through :-) % % > % So my assumption is that if I insert with year="" it should use the % > % default. Or at least . % > % > That makes sense. And so what is the default? Looks like it is, for % > some reason, 2000. [This isn't a TIMESTAMP field, so we don't % > necessarily expect it to be "this year".] % % The default at the time was . At the time of the mysql release, you might mean? Certainly at the time of the manual writing... % ... % > Looks like it's standard mysql behavior: % % But that's what I'm questioning. Should it be that way? If so, the % manual page for YEAR should be altered. If it shouldn't work that way, it % should be submitted as a bug. Makes sense. Having removed all php elements, you'd probably get a better answer on the mysql list. 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] Email bouncer Program(s) - know any?
Jerry -- This is neither a PHP nor PHP-DB question, even though you use php and mysql, but here's a reply anyway. ...and then JeRRy said... % % Hi, Hi! % % I run PHP and mysql on my site. I allow people to use % a PHP page to send me an email that is logged in the % mysql for logging reasons. Good enough. % % If someone sends me an email to [EMAIL PROTECTED] % (fake address, not real) when it is sent it does not By the way, if you're going to use an example domain, you should generally use example.com since it's been dedicated to that purpose :-) You're approaching this the wrong way; instead of trying to trash the mail that comes to root, keep your form from bouncing back to root if there is a problem. Set the envelope header to specify the sender address (ie [EMAIL PROTECTED]) as well as the From: address (presumably your visitor's email address, but if you're not actually getting that (and if not then why are you using an email form??) then your local one) so that a bounce will go back to where you can control it rather than into the root mailbox. With the example above, you can just direct all mail to invalidemail@ into the bit bucket. Since this is your form and it's supposed to send email to you, how on earth are users entering some bogus address for you in the first place? % bounce, instead it gets sent to the root email % account. :( I don't want this as I don't read the I imagine you don't! % root account all the time because emails that go there Ah. No, that's not really a good reason :-/ % are mainly spam or from people who do not have the % correct email address to send to. I don't reply to % any in there. Just delete them, they take up space % sitting there. They also tell you about possible problems on your server. It would be good to read that mail every once in a while! % % Is there a Program(s) I can download or change a % setting on my server to make them bounce back with a % message? (like other web server do) You could install spamassassin on the box, have root's mail delivered through that, set a whitelist rule for your own local mail, and then mark everything else as spam, to be thrown away later by something like procmail. This isn't very safe (it would be much better, for instance, to periodically pump root's mailbox with successfully-delivered messages through SA and procmail), but you don't seem terribly concerned with the health of your box and so some lost root mail is probably not a big deal to you (and certainly no worse than what you're doing now). Note that even that isn't really very good because each domains is supposed to have a working postmaster@ account where any problem reports for the domain can go. If you just bounce any mail from the outside then you're not playing nice with the rest of the world. Just because other web servers bounce possibly-valid mail to root (very probably because it's a Win box whose master account is 'administrator') or other system accounts doesn't mean that you should. If you use qmail then it's easy enough to run whatever tests you want and, if they fail, bounce the message back. And qmail, which was built from the ground up to be reliable, would get around the problems of unsafe delivery - even for root :-) % % Sure I could setup a autoresponder of some kind but I % don't want to reveal the root account email. Can If you've gotten mail in the root mailbox then you've already revealed it. No, you don't want an autoresponder, since that's not a bounce, but the revelation is pretty insignificant. % anyone help? I'm sure someone can :-) Perhaps even this reply is particularly helpful. % % Also I host other sites and domains, if I install a What's your host name again? I need to remember never to host where someone just deletes the root email. % program on my web server for my emails to bounce will % they work for them? Preferrably is there a program I No reason it shouldn't, and slightly less reason that the would be forced to use it (you could certainly cock up the mail system so that nothing gets in, no matter what domain, but you'd have to work a bit at that). % can use to just use for my domain? And others can ask % for it to be installed for their accounts. You should be keeping all of the domains' mail separate anyway, so that's no big deal. % % All help mostly appreciated. I wonder how 'mostly' this input will strike you :-) % % Thanks! 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']}\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']}\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
Re: [PHP-DB] Using two colomns of mysql data as key/value pairs in arrays
Chris, et al -- ...and then Chris Boget said... % ... % > than maybe making my script run a little more slowly, I fail to see how % > mysql_fetch_array() is a bad thing. From what I can see, all it does is give % > me an additional numerically indexed reference to the data in my result set ... % % foreach(); list(); each(); % None are good ideas when iterating through an array generated by *_array(). Ahhh... The light begins to dawn. I only ever use while ( $row = fetch ) to go through my rows and then directly handle the fields I pull out, but I can see that one might loop across $row and for that you need only the indices that matter. [Actually, maybe I'm just too new at this, but I can't think of a practical example for which I would loop over $row... Care to help me out?] % And I'd hazard to guess that one of the most significant uses of any query is % to iterate through it's result set. Well, I typically do loop over the result set but typically don't loop over the fields in each record, so I don't know that I can agree with the weight you put on that. But at least I see why I could care :-) % % 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
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jon, et al -- ...and then Jon Kriek said... % % Perhaps if you would stop sending your posts at attachments ;) Oh, that. I blame your mail mangler still, but this message has been folded, spindled, and mutilated just for you :-) 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! -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.7 (FreeBSD) iD8DBQE/k/xoGb7uCXufRwARApHSAJ45R/0IzE0/pJhLLnsYkz5P03J1BACg6PbK x+fgoWcYOpWWl45qxCLGEqI= =B4Vv -END PGP SIGNATURE- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: crosstab (was "Re: [PHP-DB] Using two colomns ...")
Chris, et al -- ...and then Chris Boget said... % [quoting Cpt John Holmes] % > From: "Chris Boget" <[EMAIL PROTECTED]> % > > If MySQL had crosstab functionality, that *might* be able to help. % > A "crosstab" is just a specifically formatted query, of which MySQL is % > certainly capable of handling. I've done them in the past, but maybe you're ... % % Then I'm not calling it the right thing... just the name of the type of query that % was told. The kind of query I'm talking about is the one that rotates the result % set from tall to wide. Basically doing exactly what the OP had asked for. If Hmmm... You mean like taking results 1 a 2 b 3 c 4 d and changing it to 1 2 3 4 a b c d or such? I'm certainly confused. 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
[PHP-DB] Re: looping over $row (was "Re: [PHP-DB] Using two colomns ...")
John, et al -- ...and then CPT John W. Holmes said... % % From: "David T-G" <[EMAIL PROTECTED]> % % > can't think of a practical example for which I would loop over $row... % > Care to help me out?] % % How about a dynamic query where you do not know the number of columns Hmmm... I suppose so, but I can't picture it. Shouldn't you always know the DB schema and format of what you're going to get back? I can see not knowing how many RECORDS you'll get back but I should think you would know how many FIELDS will be in each. Or maybe I'm just being too compulsive :-) % that'll be returned? You would not want to use _array() as you'll have the % duplicates to worry about / skip over. using _row() or _assoc() and just % looping through that will suffice. Oh, I can see that. It's the first half that still gets me. % % ---John Holmes... 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
[PHP-DB] Re: running total (was "Re: [PHP] php|cruise ...")
Edward, et al -- ...and then Becoming Digital said... % ... % I'm asking all of you to join me in Operation "Send Captain on the Cruise." All it takes is a few minutes to PayPal a contribution to [EMAIL PROTECTED] Donations of any size are welcome, and every little bit helps. If enough of us chip in, John and his wife can get away for a bit, significantly reducing the chance that she'll cut off his PHP Mailing List privileges. ;) A wonderful idea. Now the only other thing is to 1) know how much a php|cruise ticket costs and 2) know where the donations stand. We need John to update us once a month or so -- or for you to bug him and then YOU update us once a month or so. Thanks again to all, including 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] 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] 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] 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] 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] - ereg_replace
Hi! ...and then ÍÉÊÏÓ ÃÁÔÓÇÓ said... % ... % ereg_replace("^$", "", $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 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] 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] 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] 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] 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 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] {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] 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] Reading emails with PHP
2 where EMAIL = ?" ;# user status query my $b = "insert into eteam.MAIL_BOUNCE values (?,?,?,?,?)" ; # bounce mail log query my $ur = $eteam->prepare($u) ;# prepare query (user) my $br = $eteam->prepare($b) ;# prepare query (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
endmail uses. Think of forwarding your snail mail, but of course enormously more capable (like just about anything compared to snail mail :-) The easiest way to play with this stuff and more is to just set up a *NIX box at home and start playing with it. The second easiest way is to read lots of man pages, but that's a very good approach because you'll find out ALL about each piece. Another way is to just beg/buy an account on a *NIX box and then pester the admin / help staff :-) % on a server % with perl installed (as my shared host provider has)...just trying to % visualise. No problem, 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
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=1071585&r=1&w=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] 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] 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 " 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] 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] 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
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