[PHP-DB] REQ code help for case statement
Hi all, Trying to move code into MySQL rather than php, but can't find any examples of what I want to do. I have a number of fields and want to be able to check a number of fields (most containing workflow dates or text) and return a 'message' for web display. The message will take the form of 'Status of record' followed by a date taken from the appropriate field (not always the same one). The example in the manual doesn't refer to field data at all but to numbers. How do I write the code to do this? I need to do this on two web pages, one for a single record and one which shows a list of records (each will display the 'message'. MTIA George, Edinburgh --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Replacing * with %
Hello all! I can't for the love of god get neither ereg_replace nor str_replace to work. I wan't to replace * with % so I can use SELECT ... WHERE whatever LIKE string% in MySQL. I've tried ereg_replace(*,%,$search_name). Didn't work. I tried escaping the asterisk. I tried double-escaping the asterisk. I tried str_replace(*,%,$search_name), and that didn't work either. I tried just about everything I could think of, escaping, double- escaping and triple-escaping ad nauseum, but it just wont work. Oh, yes, I also tried $search_name=ereg_replace(blablabla); What a surprise. It didn't work. Yes, I've RTFM, RTMFM, read from my PHP Blackbook to phpbuilder.net and just about everything in between. Pretty soon I'll start bashing away on that Solaris 8 box over there. Markus - frustrated -- Markus Lervik Linux-administrator with a kungfoo grip Vaasa City Library - Regional Library [EMAIL PROTECTED] +358-6-325 3589 / +358-40-832 6709 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Replacing * with %
/* sorry markus, forgot to post this to the list, so here it is again! */ don't know if this is the solution without doing some reading, so i'll tell you what i think it might be and you can read up on it! is either (or both?) * and % special characters in regular expressions? if so, it may be possible to delimit them with slashes, that would be my thinking anyway. Let me know if i'm right or (more likely) wrong! cheers, Matt -Original Message- From: Markus Lervik [mailto:[EMAIL PROTECTED]] Sent: 15 January 2002 09:40 To: [EMAIL PROTECTED] Subject: [PHP-DB] Replacing * with % Hello all! I can't for the love of god get neither ereg_replace nor str_replace to work. I wan't to replace * with % so I can use SELECT ... WHERE whatever LIKE string% in MySQL. I've tried ereg_replace(*,%,$search_name). Didn't work. I tried escaping the asterisk. I tried double-escaping the asterisk. I tried str_replace(*,%,$search_name), and that didn't work either. I tried just about everything I could think of, escaping, double- escaping and triple-escaping ad nauseum, but it just wont work. Oh, yes, I also tried $search_name=ereg_replace(blablabla); What a surprise. It didn't work. Yes, I've RTFM, RTMFM, read from my PHP Blackbook to phpbuilder.net and just about everything in between. Pretty soon I'll start bashing away on that Solaris 8 box over there. Markus - frustrated -- Markus Lervik Linux-administrator with a kungfoo grip Vaasa City Library - Regional Library [EMAIL PROTECTED] +358-6-325 3589 / +358-40-832 6709 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Replacing * with %
just checked it out, and * is a special character unless enclosed in class brackets. so using [*] should hopefully work! give it a go and see. cheers, Matt -Original Message- From: matt stewart [mailto:[EMAIL PROTECTED]] Sent: 15 January 2002 09:54 To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Replacing * with % /* sorry markus, forgot to post this to the list, so here it is again! */ don't know if this is the solution without doing some reading, so i'll tell you what i think it might be and you can read up on it! is either (or both?) * and % special characters in regular expressions? if so, it may be possible to delimit them with slashes, that would be my thinking anyway. Let me know if i'm right or (more likely) wrong! cheers, Matt -Original Message- From: Markus Lervik [mailto:[EMAIL PROTECTED]] Sent: 15 January 2002 09:40 To: [EMAIL PROTECTED] Subject: [PHP-DB] Replacing * with % Hello all! I can't for the love of god get neither ereg_replace nor str_replace to work. I wan't to replace * with % so I can use SELECT ... WHERE whatever LIKE string% in MySQL. I've tried ereg_replace(*,%,$search_name). Didn't work. I tried escaping the asterisk. I tried double-escaping the asterisk. I tried str_replace(*,%,$search_name), and that didn't work either. I tried just about everything I could think of, escaping, double- escaping and triple-escaping ad nauseum, but it just wont work. Oh, yes, I also tried $search_name=ereg_replace(blablabla); What a surprise. It didn't work. Yes, I've RTFM, RTMFM, read from my PHP Blackbook to phpbuilder.net and just about everything in between. Pretty soon I'll start bashing away on that Solaris 8 box over there. Markus - frustrated -- Markus Lervik Linux-administrator with a kungfoo grip Vaasa City Library - Regional Library [EMAIL PROTECTED] +358-6-325 3589 / +358-40-832 6709 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Including a file using php //
Hi, I was trying to include a url file on another server but could't make this to work. It displays nothing actually.. ?php $retvalue = include('http://192.168.129.103/noc/chikkaps.txt'); echo $retvalue; ? Can someone help me please? thanks, louie... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Replacing * with %
The following works fine for me: $currentword = ereg_replace(\*,%,$currentword); Chris }:) -Original Message- From: matt stewart [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 9:57 AM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Replacing * with % just checked it out, and * is a special character unless enclosed in class brackets. so using [*] should hopefully work! give it a go and see. cheers, Matt -Original Message- From: matt stewart [mailto:[EMAIL PROTECTED]] Sent: 15 January 2002 09:54 To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Replacing * with % /* sorry markus, forgot to post this to the list, so here it is again! */ don't know if this is the solution without doing some reading, so i'll tell you what i think it might be and you can read up on it! is either (or both?) * and % special characters in regular expressions? if so, it may be possible to delimit them with slashes, that would be my thinking anyway. Let me know if i'm right or (more likely) wrong! cheers, Matt -Original Message- From: Markus Lervik [mailto:[EMAIL PROTECTED]] Sent: 15 January 2002 09:40 To: [EMAIL PROTECTED] Subject: [PHP-DB] Replacing * with % Hello all! I can't for the love of god get neither ereg_replace nor str_replace to work. I wan't to replace * with % so I can use SELECT ... WHERE whatever LIKE string% in MySQL. I've tried ereg_replace(*,%,$search_name). Didn't work. I tried escaping the asterisk. I tried double-escaping the asterisk. I tried str_replace(*,%,$search_name), and that didn't work either. I tried just about everything I could think of, escaping, double- escaping and triple-escaping ad nauseum, but it just wont work. Oh, yes, I also tried $search_name=ereg_replace(blablabla); What a surprise. It didn't work. Yes, I've RTFM, RTMFM, read from my PHP Blackbook to phpbuilder.net and just about everything in between. Pretty soon I'll start bashing away on that Solaris 8 box over there. Markus - frustrated -- Markus Lervik Linux-administrator with a kungfoo grip Vaasa City Library - Regional Library [EMAIL PROTECTED] +358-6-325 3589 / +358-40-832 6709 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Replacing * with %
excellent! two ways to do it - Markus confirmed that [*] works too - so don't know which is better, but we have two solutions anyway. -Original Message- From: Rosser, Chris [mailto:[EMAIL PROTECTED]] Sent: 15 January 2002 10:54 To: '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Replacing * with % The following works fine for me: $currentword = ereg_replace(\*,%,$currentword); Chris }:) -Original Message- From: matt stewart [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 9:57 AM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Replacing * with % just checked it out, and * is a special character unless enclosed in class brackets. so using [*] should hopefully work! give it a go and see. cheers, Matt -Original Message- From: matt stewart [mailto:[EMAIL PROTECTED]] Sent: 15 January 2002 09:54 To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Replacing * with % /* sorry markus, forgot to post this to the list, so here it is again! */ don't know if this is the solution without doing some reading, so i'll tell you what i think it might be and you can read up on it! is either (or both?) * and % special characters in regular expressions? if so, it may be possible to delimit them with slashes, that would be my thinking anyway. Let me know if i'm right or (more likely) wrong! cheers, Matt -Original Message- From: Markus Lervik [mailto:[EMAIL PROTECTED]] Sent: 15 January 2002 09:40 To: [EMAIL PROTECTED] Subject: [PHP-DB] Replacing * with % Hello all! I can't for the love of god get neither ereg_replace nor str_replace to work. I wan't to replace * with % so I can use SELECT ... WHERE whatever LIKE string% in MySQL. I've tried ereg_replace(*,%,$search_name). Didn't work. I tried escaping the asterisk. I tried double-escaping the asterisk. I tried str_replace(*,%,$search_name), and that didn't work either. I tried just about everything I could think of, escaping, double- escaping and triple-escaping ad nauseum, but it just wont work. Oh, yes, I also tried $search_name=ereg_replace(blablabla); What a surprise. It didn't work. Yes, I've RTFM, RTMFM, read from my PHP Blackbook to phpbuilder.net and just about everything in between. Pretty soon I'll start bashing away on that Solaris 8 box over there. Markus - frustrated -- Markus Lervik Linux-administrator with a kungfoo grip Vaasa City Library - Regional Library [EMAIL PROTECTED] +358-6-325 3589 / +358-40-832 6709 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Replacing * with %
Hi Markus, I think you forgot to assign the value of ereg_replace to a variable. I made this test and it worked: ? $t = 'abc*cde*'; printf(%s\n, ereg_replace(\*, \%, $t)); // or $result = ereg_replace(\*, \%, $t); ? Hope it helps, Bruno Pereti. - Original Message - From: Markus Lervik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 15, 2002 7:40 AM Subject: [PHP-DB] Replacing * with % Hello all! I can't for the love of god get neither ereg_replace nor str_replace to work. I wan't to replace * with % so I can use SELECT ... WHERE whatever LIKE string% in MySQL. I've tried ereg_replace(*,%,$search_name). Didn't work. I tried escaping the asterisk. I tried double-escaping the asterisk. I tried str_replace(*,%,$search_name), and that didn't work either. I tried just about everything I could think of, escaping, double- escaping and triple-escaping ad nauseum, but it just wont work. Oh, yes, I also tried $search_name=ereg_replace(blablabla); What a surprise. It didn't work. Yes, I've RTFM, RTMFM, read from my PHP Blackbook to phpbuilder.net and just about everything in between. Pretty soon I'll start bashing away on that Solaris 8 box over there. Markus - frustrated -- Markus Lervik Linux-administrator with a kungfoo grip Vaasa City Library - Regional Library [EMAIL PROTECTED] +358-6-325 3589 / +358-40-832 6709 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] A local file copy question
I am trying to copy a file on my system from one local place to the path of my script. So... FILE TO COPY = c:\dir\filename.php COPY TO = ../dir/filename.php I need to work out how to determin the local path of my script thus allowing my script to know where ../dir is relitive to. I Think I can not fix the scripts path as i dont know where people un zip the script to on thier local system. Any help or guidence as aways, is most appreiciated. Yours Dave C The two rules for success are: 1. Never tell them everything you know. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Including a file using php //
On Tuesday 15 January 2002 12:35, you wrote: Yes it work's on local / but how about when the file comes from a remote server? ### works ?php $file = one.php; include($file); ? ### ### did not work at all ?php $file = http://192.168.129.103/noc/chikkaps.txt;; include($file); ? ### There are two possible reasons for this as I see it: a) You're on a Windows platform From the manual: Note: You can't use remote files in include() and require() statements on Windows. or b) You've compiled PHP with the option --disable-url-fopen-wrapper or set allow_url_fopen to off in php.ini If the answer to option a is yes, then sorry, Harry, it wont work. -- Markus Lervik Linux-administrator with a kungfoo grip Vaasa City Library - Regional Library [EMAIL PROTECTED] +358-6-325 3589 / +358-40-832 6709 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Problem with mail function
Hi Faye Maybe I shouldn't be trying to send that many emails at a time. I am on apache using mysql and php... -- put the line set_time_limit(0); at the top of your PHP script Regards Jon -- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 Mob 07763 620378 PGP Key available, send email with subject: Send PGP Key -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] mail() on Mac OS X
I have been trying for months now (on and off) to get mail() working in OS X. I have trid various things, but this is my current setup. If you have any suggestions or if you could put me in the right direction, then I would be glad. - I am using PHP v4.0.6 on Mac OS X 10.1 (pre-compiled with cool options from entropy.ch) - I installed Communigate Pro (a mail server -- and this works when I use it in Mail.app) - I don't want to use sendmail, I want to use the mail server I have already installed. - I have these two lines in my php.ini SMTP = ifunk.dyndns.org sendmail_from = [EMAIL PROTECTED] my sendmail_path is still the same as default... but I was just thinking that PHP would use my smtp server(ifunk.dyndns.org) Can someone slap me in the face if I'm misunderstanding something, or help me if you can. Thanks, Adam. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] MySQL/PHP and the case of Good Lord, that's a lot ofstatements
Hi All, Normally I try not to take work home with me, mainly because I'm good enough at breaking my own code. In this case, however, I think it might be a good idea if I knew the answer to the question I was asked. Basically, there's a PHP script. This script is a rather kludgy way of keeping a bunch of data in a flat file generated on a certain server reasonably up to date with the data in a MySQL database on the frontend webserver. The script's responsibility is to go through this file line by line (some 8000 of them), parse the data on each line, perform a simple transform or two on that data, create a query to REPLACE that data into the database (the flat file and the backend server are authoritative over the MySQL server), execute the statement and then move on to the next line. The problem is, somewhere in the middle of this script (more like closer to the beginning) the script just *dies*. I say that because there's no error message, no warnings, no footer content that's included after the processing is done, nothing. It just dies in the middle of the while loop that reads the file and executes the statements. Some rather exhaustive checking by both myself and the actual owner of the script indicate that there are no glaring errors in the PHP or the SQL the PHP generates, and the lack of an error message of any kind indicates the same thing. That said, here's where I'm sitting currently: I think it's a matter of some limitation in the system. Almost certainly not one that's hardcoded in there by anyone, but perhaps along the line of some sort of system-dependent limit that needs to be increased. I think it'll probably be hard to give a definitive answer right out off the bat (and that's not what I'm looking for), but I'd like some ideas as to possible places I could start looking. Here are the details I _do_ have: OS: BSD/OS MySQL: 3.22 (Upgrading isn't much of an option, or I would have) PHP: 4.0 (Might be 4.0.1. Same situation as above, but perhaps a CGI version can be built if this is the limitation) The data file is right around 8600 lines, and all told the script is executing just over 1 statement per line. Any light someone could shed on the situation would be much appreciated. Cheers, Toby -- Tobyn Baugher [EMAIL PROTECTED] http://www.cartoonviolence.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Combining INSERT...SELECT and INSERT INTO
On 1/14/2002 12:54 PM +0200 Markus Lervik wrote: Is there any way to combine INSERT...SELECT and INSERT INTO so one could insert a new row with a few values inserted by hand and others from another table? something like INSERT INTO mag_table (mag_id,issn,year,info,volume,numbers,remarks) VALUES ( (SELECT id FROM mag_names WHERE mag_names.name=Asdf), 1234-5678,2001,foobar,1-4,1-52,foobar); Try doing something like: INSERT INTO mag_table (mag_id,issn,year,info,volume,numbers,remarks) SELECT mag_names.id as mag_id, '1234-5678' as issn, '2001' as year, 'foobar' as info, '1-4' as volume, '1-52' as numbers, 'foobar' as remarks, FROM mag_names WHERE mag_names.name='Asdf'; I don't know if that will work as-is, but something along those lines should give you what you need. Cheers, Toby -- Tobyn Baugher [EMAIL PROTECTED] http://www.cartoonviolence.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: MySQL/PHP and the case of Good Lord, that's a lot of statements
The problem is, somewhere in the middle of this script (more like closer to the beginning) the script just *dies*. I say that because there's no error message, no warnings, no footer content that's included after the processing is done, nothing. It just dies in the How long does this take to run? Could it be timing out? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Re: MySQL/PHP and the case of Good Lord, that's alot of statements
On 1/15/2002 9:17 AM -0500 Hugh Bothwell wrote: How long does this take to run? Could it be timing out? Well, it's echo-ing each statement it's executing (added later to help debug), so from a connection standpoint I don't think it's timing out. None of the browsers seem to think it is, at the very least. The process itself has a 30-second CPU time limit imposed on it by the OS, and that is not a factor (it's dying at about 5 seconds). Toby -- Tobyn Baugher [EMAIL PROTECTED] http://www.cartoonviolence.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: WebMail
On which platform ? For the webmail program, see: http://www.upenn.edu/computing/group/webmail/2000/ http://www.devshed.com/Server_Side/PHP/PHPMail (email client) Or try: http://sdb.suse.de/en/sdb/html/katlist.SUSEIMAP.html http://hyper-cgi.com/grn/webware.html http://www.hotscripts.com/Perl/Scripts_and_Programs/Email_Systems/Web-based_ Email/index.html There are so many out there... ;-) Jerry Michael K. Dolan Jr. [EMAIL PROTECTED] wrote: Hi, I'm looking for a good web based email client (preferably easy to setup and done in PHP of course). We have a sendmail server that works great. I'm not sure how the webmail systems work though. Can I use a different Apache server or do I have to setup the PHP webmail on the actual mail server? I guess I have 2 questions, what's a good webmail program, and 2nd what's the basic setup of this all? Mike Dolan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] mail() on Mac OS X
on 1/15/02 7:38 AM, Adam Royle at [EMAIL PROTECTED] appended the following bits to my mbox: I have been trying for months now (on and off) to get mail() working in OS X. I - I am using PHP v4.0.6 on Mac OS X 10.1 (pre-compiled with cool options from entropy.ch) - I installed Communigate Pro (a mail server -- and this works when I use it in Mail.app) 1) This post should've gone to PHP-General since it isn't related to databases. SMTP = ifunk.dyndns.org sendmail_from = [EMAIL PROTECTED] 2) These values are only valid for Windows php installs, not for Unix (i.e., Mac OS X. - I don't want to use sendmail, I want to use the mail server I have already installed. FWIW, OS X comes with sendmail installed, you just need to enable it in the /etc/hostconfig file. Perhaps Communigate Pro has a sendmail type wrapper that you can point the php sendmail value to. I've heard that qmail has such a script. Check with CG Pro support for more info. Another option would be to use Manuel Lemos' excellent SMTP class for sending you email directly through an smtp server. http://phpclasses.upperdesign.com/ Of course, then you wouldn't actually be using the mail() function. HTH. Paul ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] TNS name problem -php_oracle.dll library
Hello, I have the follow problem: I have installed oracle 7.3 client and work right, and I have installed apache and php the last version. When I try to connect to oracle with the libray php_oracle.dll I get the follow message: Oracle: Connection Failed: ORA-12154: TNS:could not resolve service name and testing the tns name solve very well(command window) The script is the follow: html head titleEjemplo PHP/title /head body ?php print HTMLPRE; $connn = ora_logon(name@TNSNAME,password); function select_data($conn) { $stmt = ora_parse($conn,select * from scott.names); ora_exec($stmt); echo $conn.selecting\n\n; while (ora_fetch($stmt)) echo $conn. .ora_do($stmt,TEST).\n\n; echo $conn.done\n\n; } select_data($connn); // result of c1 ora_logoff(connn); ? /body /html I need your help. Thanks in advance. Enrique -- ___ 1 cent a minute calls anywhere in the U.S.! http://www.getpennytalk.com/cgi-bin/adforward.cgi?p_key=RG9853KJurl=http://www.getpennytalk.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Re: MySQL/PHP and the case of Good Lord, that's a lot of statements
Uoh, It's a big one... Some thougths I had while reading your e-mail: - There is an option in php.ini where you can disable error messages (someone wrote to the list, it might be in the archive). And I found in my php.ini now the error_reporting option, maybe you could set it to E_ALL to see if it show any error. - I had the same problem writing squid log to mysql. It always died when find a line with http://www...com/file.cgi?option=+'bust'+ because it breaks the SQL. Probably this is not problem because you are echoing the SQL but it's worth to look at the last statement. - Another thing that don't see to be the problem is the memory limit because my squid log is very bigger than that and my memory_limit is the default 8M. (I'm running this script in the shell, not in the browser). - Does it die always in the same statement? I think that if it's a system limitation and you have any other thing running in you machine it won't die always the same way. If it does, I think it's a script or SQL problem. Just some ideas to help... good luck, Bruno Pereti. - Original Message - From: Tobyn Baugher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 15, 2002 12:22 PM Subject: Re: [PHP-DB] Re: MySQL/PHP and the case of Good Lord, that's a lot of statements On 1/15/2002 9:17 AM -0500 Hugh Bothwell wrote: How long does this take to run? Could it be timing out? Well, it's echo-ing each statement it's executing (added later to help debug), so from a connection standpoint I don't think it's timing out. None of the browsers seem to think it is, at the very least. The process itself has a 30-second CPU time limit imposed on it by the OS, and that is not a factor (it's dying at about 5 seconds). Toby -- Tobyn Baugher [EMAIL PROTECTED] http://www.cartoonviolence.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Moving from MySQL to MSSQL Server 2000
Sorry for the late reply to this, but if you were to move to MS SQL I'd highly recommend using FreeTDS (www.freetds.org) to access the database from PHP. Due to the lack of an MS SQL client library in Mac OS X I have to use FreeTDS to contact another MS SQL server ( I use MySQL myself ). Setup was very easy, you just build FreeTDS and then configure PHP using --with-sybase-ct=/path/to/freetds. Then you can use the mssql_* group of functions to access the database. Or you could use ODBC... but I was never able to get that to work correctly, and the general consensus seems to be that ODBC is slow. On Saturday, January 12, 2002, at 03:24 PM, Boaz Yahav wrote: Hi I'm planning to move my site (Very successful / high traffic Auctions site) from MySQL to MSSQL Server 2000. I was wondering if anyone has done this move and if there are any pit falls to notice. 1. Is ODBC the only way to work from a Solaris / Apache / PHP 4 machine to a Win2K / SQL Server 2000? 2. What could be the performance cost (if any). 3. Are there any special points that need to be taken into consideration on either side? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Moving from MySQL to MSSQL Server 2000
Hi, You can indeed use ODBC, and that will get around some issues that FreeTDS has with SQLServer 2000. Some ODBC drivers are slow, but you will find OpenLink's drivers to be exceptionally fast. To use ODBC, you will need to link PHP against iODBC as per the howto at www.iodbc.org The drivers are available as a free download (2-connection license) from www.openlinksw.com Hope this helps! Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- From: Gabriel Ricard [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 10:59 AM To: Boaz Yahav Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Moving from MySQL to MSSQL Server 2000 Sorry for the late reply to this, but if you were to move to MS SQL I'd highly recommend using FreeTDS (www.freetds.org) to access the database from PHP. Due to the lack of an MS SQL client library in Mac OS X I have to use FreeTDS to contact another MS SQL server ( I use MySQL myself ). Setup was very easy, you just build FreeTDS and then configure PHP using --with-sybase-ct=/path/to/freetds. Then you can use the mssql_* group of functions to access the database. Or you could use ODBC... but I was never able to get that to work correctly, and the general consensus seems to be that ODBC is slow. On Saturday, January 12, 2002, at 03:24 PM, Boaz Yahav wrote: Hi I'm planning to move my site (Very successful / high traffic Auctions site) from MySQL to MSSQL Server 2000. I was wondering if anyone has done this move and if there are any pit falls to notice. 1. Is ODBC the only way to work from a Solaris / Apache / PHP 4 machine to a Win2K / SQL Server 2000? 2. What could be the performance cost (if any). 3. Are there any special points that need to be taken into consideration on either side? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] crypt and decrypt and xor
Hello All, Does PHP have a crypt and decrypt algorithm? Is xor supported by php and can you give me some examples for it? Thanks Thomas omega Henning -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] crypt and decrypt and xor
On Tue, 15 Jan 2002, Thomas omega Henning wrote: Hello All, Does PHP have a crypt and decrypt algorithm? You have the crypt() function, and more crypto algorithms can be found in the mcrypt package. Is xor supported by php and can you give me some examples for it? $c = $p ^ $k ^ is the XOR operator. -- patrik_wallstrom-foodfight-[EMAIL PROTECTED]+46-709580442 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[Fwd: [PHP-DB] A local file copy question]
oops. -- -- Dan Barton Terrestrial Program Biologist Asst. Data Manager Point Reyes Bird Observatory http://www.prbo.org [EMAIL PROTECTED] [EMAIL PROTECTED] ---BeginMessage--- Hi, There are several PHP-Apache environment variables that may do what you're interested in. (I'm not 100% sure I understand the question, though...correct me if I'm wrong?) To determine the local path (relative to the actual server) of your script, simply use the environment variable $SCRIPT_FILENAME. For paths relative to the web server's path, use a combination of $DOCUMENT_ROOT, $PHP_SELF, and $SCRIPT_NAME. Hope this helps. -db Dave Carrera wrote: I am trying to copy a file on my system from one local place to the path of my script. So... FILE TO COPY = c:\dir\filename.php COPY TO = ../dir/filename.php I need to work out how to determin the local path of my script thus allowing my script to know where ../dir is relitive to. I Think I can not fix the scripts path as i dont know where people un zip the script to on thier local system. Any help or guidence as aways, is most appreiciated. Yours Dave C The two rules for success are: 1. Never tell them everything you know. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- -- Dan Barton Terrestrial Program Biologist Asst. Data Manager Point Reyes Bird Observatory http://www.prbo.org [EMAIL PROTECTED] [EMAIL PROTECTED] ---End Message--- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] passing variable through an html email
On Wednesday 16 January 2002 03:32, Kevin Ruiz wrote: This isn't a db related question! I'm writing a page that allows me to add users to a table. Once the users are in the table they will be able to gain access to our downloads section, they will be validated against their user/pass in a mysql database. Here's my question. I understand how to send mail using mail(). I also understand how to send mail in an html format which is what I'd prefer to do but what I'm having trouble with is passing my variables to the email being generated in the html format. This works fine in the plain text emails but can't seem to get it to work in the html emails. Here's my situation...once a new user is added to the database an email is generated with their user/pass. The code I am using to send them the email is this: //mails the new account holder his/her username and pass //for testing purposes I'm sending all mail to myself /* recipients */ $to = Kevin Ruiz [EMAIL PROTECTED]; /* subject */ $subject = Access to downloads section at Worktiviti.com; /* message */ $message = ' You're using single quotes to define the $message string thus no variable expansion takes place. I suggest breaking up the assignment into several chunks, for example: $message = 'Hello ' . $name . ', how are you'; hth -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Love is in the offing. -- The Homicidal Maniac */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] mysql_insert_id?
Hi, Is it possible that I would get the wrong ID (Not the ID I just inserted in Auto_Increment field) by using mysql_insert_id function if someone is also inserting record at the same time? How does mysql_insert_id work accurately? Thanks, Wee -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] passing variable through an html email
Hi Could it be that your message block starts with ' (single quote) so the variables are not evaluated. Variables are only evaluated when using (double quotes) which does not mix well with HTML. try using $message='text and HTMLtag name=zapit'.$variable.' more text and HTML'; Peter -Original Message- From: Kevin Ruiz [mailto:[EMAIL PROTECTED]] Sent: 15 January 2002 19:33 To: [EMAIL PROTECTED] Subject: [PHP-DB] passing variable through an html email I'm writing a page that allows me to add users to a table. Once the users are in the table they will be able to gain access to our downloads section, they will be validated against their user/pass in a mysql database. Here's my question. I understand how to send mail using mail(). I also understand how to send mail in an html format which is what I'd prefer to do but what I'm having trouble with is passing my variables to the email being generated in the html format. This works fine in the plain text emails but can't seem to get it to work in the html emails. Here's my situation...once a new user is added to the database an email is generated with their user/pass. The code I am using to send them the email is this: //mails the new account holder his/her username and pass //for testing purposes I'm sending all mail to myself /* recipients */ $to = Kevin Ruiz [EMAIL PROTECTED]; /* subject */ $subject = Access to downloads section at Worktiviti.com; /* message */ $message = ' html head titleAccess to downloads section at Worktiviti.com/title style p{font-family:arial; font-size:8pt;} /style /head body table width=100% border=0 cellspacing=2 cellpadding=0 tr td valign=topimg src=http://www.worktiviti.com/images/gifs/logo.gif; alt=worktiviti/td /tr /table table width=100% border=0 cellspacing=2 cellpadding=0 tr td p Dear $real_name ,br /br / An account has been created for you to access the downloads section of the Worktiviti website.br /br / You can log into your account a href=http://www.worktiviti.com/protected/login.phphere/a.br /br / Your username and password are as follows:br / Username: $usernamebr / Password: $passwordbr /br / If you have any problems loggin into your account or have any questions please contact the a href=mailto:[EMAIL PROTECTED]webmaster/a. /p /td /tr /table /body /html '; /* To send HTML mail, you can set the Content-type header. */ $headers = MIME-Version: 1.0\r\n; $headers .= Content-type: text/html; charset=iso-8859-1\r\n; /* additional headers */ $headers .= From: Do Not Reply[EMAIL PROTECTED]\r\n; /* and now mail it */ mail($to, $subject, $message, $headers); If you sent the code now it would send fine except the variables $real_name, $username, $password would not echo anything. They would simply print themselves. I've tried a number of variations. Some of which include \$real_name\, $real_name, '$real_name',?= $real_name ?. Nothing seems to work. I'm editing the page in dreamweaver. As soon as I try to put the ? ? into the code to tell it that some php is coming it tells me I have an error. Does anyone have any idea what I'm doing wrong? Any help woudl be greatly appreciated. Thanks, Kevin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Exporting data
HI, How do I export the result on my browser received from Sybase using PHP to .rtf/.txt format and save on to my local hard disk? Regards, Ajaya Sharma -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] mysql_insert_id?
on 1/15/02 4:08 PM, Wee Chua at [EMAIL PROTECTED] appended the following bits to my mbox: Is it possible that I would get the wrong ID (Not the ID I just inserted in Auto_Increment field) by using mysql_insert_id function if someone is also inserting record at the same time? How does mysql_insert_id work accurately? 1) Please don't cross post to two lists. 2) No. MySQL uses separate threads for each connection. They don't interact with one another. Check the mysql docs for more info. Paul Paul ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Logicproblem in WHERE statement
Hi there, I am building a user search engine. Now I do not know how to gett following: a mandatory field and a voluntary field For example I would like to get all female users and those who are from canada. The results should show all users who are female regardless of nationality But it should also show all users from canada. How would this look like? SELECT * FROM table WHERE sex=1 AND country='CA' This is wrong I know. But how does it work??? Thanx for any help cheers Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] How to design a user table with 1 mio entries
Hi there, I am having a search engine on á user table. It works fine for a few users. But I asume that it is gonna be realy slow for 1 Million entries. That because I have all parameters in on table and I am doing to select stmt on it. The first one gets all users for storing the ranking, the other one gets as many as fit on one site. How could I improve performance? Splitting into different tables? How would this look like. I am pretty knew on db design and guess there is a better way. Can anybody help who has more knowledge about db design than I have? Thanx for any help cheers guys and girls, Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] How can recommend a book for SQL and DB design
Hi, I am searching for a good book on how to design a db for web apps. Normalisation rools, performancejust describing how to do it on a proffesional way. The second one, I am searching for is a book about SQL for MySQL. Any good books on the market? Thanx for the recommendation Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] How can recommend a book for SQL and DB design
Any O'Reilly book is always a good choice. O'Reilly is the publisher - they do the Nutshell books and a bunch of others. They are also the books with animals on them, if that helps :-) -Natalie -Original Message- From: Andy [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 5:11 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] How can recommend a book for SQL and DB design Hi, I am searching for a good book on how to design a db for web apps. Normalisation rools, performancejust describing how to do it on a proffesional way. The second one, I am searching for is a book about SQL for MySQL. Any good books on the market? Thanx for the recommendation Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] FreeBSD 4.2 and ODBC
Hi All, I'm just new to this list and I'm hoping somebody might have information leading to a PHP that can access an MS Excel Spreadsheet. FreeBSD 4.2, PHP 3.0.18 (for gif GD), Apache1.3.12. I have had no luck getting any of the ODBC functions to work with this OS (odbc_connect, php compiled with and without --with-iodbc switch results in Fatal error: Call to unsupported or undefined function odbc_connect() ). I also had no luck compiling iODBC, which resulted in syntax errors and ultimately stoppage. Wondering if anybody has a gem out there. |:) Ever pull something like this off? Got any ideas? Thanks Alot! -Paul
[PHP-DB] Re: Logicproblem in WHERE statement
Andy I am building a user search engine. Now I do not know how to gett following: a mandatory field and a voluntary field For example I would like to get all female users and those who are from canada. The results should show all users who are female regardless of nationality But it should also show all users from canada. ok... if the second field is not mandatory... you should not include it in the where clause... the select will show all the rows regardless the value in this field... How would this look like? SELECT * FROM table WHERE sex=1 AND country='CA' SELECT * FROM table WHERE sex = 1 it will show all the rows... == relevance ?? ok... if you want to show the Sex= 1 and country='CA' rows first... may be you can use an UNION, maybe something like this... SELECT * FROM table WHERE sex = 1 and country = 'CA' UNION SELECT * FROM table WHERE sex = 1 and country 'CA' ... or define a calculated field for these relevance... and order the results by this value... SELECT (sex = 1 AND country = 'CA') AS relevance, sex, country FROM table WHERE sex = 1 ORDER BY 1 DESC ... note the relevance includes all the fields... and the where just the mandatory conditions... the order must be DESC, because the relevance is 1 if the two conditions are match... and 0 if not == is this the problem ?? if not... may be you are intereseted in different JOIN and UNION clauses... may be a LEFT JOIN or similar http://www.mysql.com/doc/J/O/JOIN.html http://www.mysql.com/doc/U/N/UNION.html 8-) jaime -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] FreeBSD 4.2 and ODBC
Paul, You can simply download the binary at www.iodbc.org and configure --with-iodbc as per the HOWTO. If you tried this and then got undefined function then this means you didn't use the correct php binary or somesuch. Ensure that ODBC support is compiled in by examining the output of a phpinfo(); You will still need an ODBC driver, as iODBC is simple the Driver Manager (enabling use of a driver). To enable BSD to access an Excel spreadsheet will require the following configuration. BSD Client PHP --with-iodbc (using iODBC SDK, use non-threaded option if you get pthread errors) Client-side ODBC - OpenLink MT Client DSN (in odbc.ini) configured with: Host = windows box below ServerType = odbc Database = server-side DSN below (foo) Environment variables in your PHP script: putenv(ODBCINI=path/to/odbc.ini); putenv(LD_LIBRARY_PATH=path/to/odbcsdk/lib); (ODBCINSTINI is optional) Windows Server --- Server-side ODBC: OpenLink MT ODBC Agent (choose Access in the selection dropdowns) foo - DSN configured with the Microsoft driver for Excel that can open the spreadsheet All components are available as free downloads from OpenLink's website. Free support is available at http://www.openlinksw.com/support/suppindx.htm Hope this helps! Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- From: Paul G [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 5:29 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] FreeBSD 4.2 and ODBC Hi All, I'm just new to this list and I'm hoping somebody might have information leading to a PHP that can access an MS Excel Spreadsheet. FreeBSD 4.2, PHP 3.0.18 (for gif GD), Apache1.3.12. I have had no luck getting any of the ODBC functions to work with this OS (odbc_connect, php compiled with and without --with-iodbc switch results in Fatal error: Call to unsupported or undefined function odbc_connect() ). I also had no luck compiling iODBC, which resulted in syntax errors and ultimately stoppage. Wondering if anybody has a gem out there. |:) Ever pull something like this off? Got any ideas? Thanks Alot! -Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How can recommend a book for SQL and DB design
Andy (and Natalie), In fact the O'Reilly book on PHP is the exception that might well prove the rule - normally I think them v.good The reference work on MySQL is by Paul DuBois (who often stops by here - hi Paul) and published by New Riders. Unfortunately none of my favorite texts (of the moment) go into the background of db theory, eg normalisation. Perhaps one of the (recent) students on the list can help with that one... Regards, =dn - Original Message - From: Leotta, Natalie (NCI/IMS) [EMAIL PROTECTED] To: 'Andy' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: 15 January 2002 22:14 Subject: RE: [PHP-DB] How can recommend a book for SQL and DB design Any O'Reilly book is always a good choice. O'Reilly is the publisher - they do the Nutshell books and a bunch of others. They are also the books with animals on them, if that helps :-) -Natalie -Original Message- From: Andy [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 5:11 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] How can recommend a book for SQL and DB design Hi, I am searching for a good book on how to design a db for web apps. Normalisation rools, performancejust describing how to do it on a proffesional way. The second one, I am searching for is a book about SQL for MySQL. Any good books on the market? Thanx for the recommendation Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Tricky Quiestion!!!
it seems to me that the problem with your encryp' function has to do with your 'separators'. Try replacing every ocurrence of your especial chars ( in this case the values $sep could get ) before using your encrypting function. hope i got it right, andy Thomas omega Henning [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello all, I encrypt a text lets say omega home with an home made encryption algorithm. Lets say i encrypt omega home. It will result oomoeogoao ohooomoeo. When i decrypt it it ses omega hme Home isn't typed out due 2 exlopde(o,oomoeogoao ohooomoeo); In this case. H My quiestion how i make the PHP code put the first char in this case o in its right place? Thomas omega Henning ok this is my code elseif($cmd==@) { $sep=substr($enc,0,1); $denc=explode($sep,$enc); for($i=0;$istrlen($enc);$i++) { if() $dencf=$dencf.$denc[$i]; } $dencf=substr($enc,0,1).$dencf; irc_put_message(PRIVMSG $nickto :$nick,encrypted message $enc:$dencf); } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] FreeBSD 4.2 and ODBC
Thanks Andrew, I will attempt this in the morning. Is it okay with you if I email you on the iODBC stuff? PHP was compiled like so: Configure command: ./configure '--with-apxs=/usr/local/apache/1.3/bin/apxs' '--with-config-file-path=/usr/local/lib' '--with-system-regex' '--enable-track-vars' '--enable-trans-sid' '--enable-versioning' '--with-ttf' '--with-ftp' '--with-gd=/usr/local' '--enable-memory-limit' '--enable-fast-install' 'with-iodbc=/usr/local/src/odbcsdk' php3.ini file path is set to: /usr/local/lib (iODBC resulted in syntax errors last time I tried. I am new to this I should emphasize!) Also, any ODBC driver you would recommend? -Paul - Original Message - From: Andrew Hill [EMAIL PROTECTED] To: Paul G [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, January 15, 2002 2:37 PM Subject: RE: [PHP-DB] FreeBSD 4.2 and ODBC Paul, You can simply download the binary at www.iodbc.org and configure --with-iodbc as per the HOWTO. If you tried this and then got undefined function then this means you didn't use the correct php binary or somesuch. Ensure that ODBC support is compiled in by examining the output of a phpinfo(); You will still need an ODBC driver, as iODBC is simple the Driver Manager (enabling use of a driver). To enable BSD to access an Excel spreadsheet will require the following configuration. BSD Client PHP --with-iodbc (using iODBC SDK, use non-threaded option if you get pthread errors) Client-side ODBC - OpenLink MT Client DSN (in odbc.ini) configured with: Host = windows box below ServerType = odbc Database = server-side DSN below (foo) Environment variables in your PHP script: putenv(ODBCINI=path/to/odbc.ini); putenv(LD_LIBRARY_PATH=path/to/odbcsdk/lib); (ODBCINSTINI is optional) Windows Server -- -- --- Server-side ODBC: OpenLink MT ODBC Agent (choose Access in the selection dropdowns) foo - DSN configured with the Microsoft driver for Excel that can open the spreadsheet All components are available as free downloads from OpenLink's website. Free support is available at http://www.openlinksw.com/support/suppindx.htm Hope this helps! Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- From: Paul G [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 5:29 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] FreeBSD 4.2 and ODBC Hi All, I'm just new to this list and I'm hoping somebody might have information leading to a PHP that can access an MS Excel Spreadsheet. FreeBSD 4.2, PHP 3.0.18 (for gif GD), Apache1.3.12. I have had no luck getting any of the ODBC functions to work with this OS (odbc_connect, php compiled with and without --with-iodbc switch results in Fatal error: Call to unsupported or undefined function odbc_connect() ). I also had no luck compiling iODBC, which resulted in syntax errors and ultimately stoppage. Wondering if anybody has a gem out there. |:) Ever pull something like this off? Got any ideas? Thanks Alot! -Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Problem with mail function
Nope - haven't figured it out, even after sending 50 at a time, and pausing the script for 30 seconds. The page would refresh and do everything over and over and overuntil manually stopped in the browser. I will try that set_time_limit(0); tomorrow. Have had to work on other stuff today. Another option i might implement is utilizing a mailing list manager, such as Majordomo or something. Thanks for all your help, the open source community is the best. -- Faye Keesic Computer Programmer Analyst/Web Page Design From: [EMAIL PROTECTED] Date: Tue, 15 Jan 2002 14:57:21 -0800 (PST) To: Faye Keesic [EMAIL PROTECTED] Subject: Re: [PHP-DB] Problem with mail function How's it going? Haven't heard from you, so I assume that you've solved the problem. Ted -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: [PHP] mysql_insert_id?
Hi Wee, Is it possible that I would get the wrong ID (Not the ID I just inserted in Auto_Increment field) by using mysql_insert_id function if someone is also inserting record at the same time? How does mysql_insert_id work accurately? =A couple of things here: 1 if the field is defined as Auto_Increment then YOU will not insert an ID. Leave the field out of the INSERT statement or transfer NULL, and MySQL will insert the correct ID value according to the 'increment' policy. The construction of the mysql_insert_id() looks like this: $AutoIncrementId = mysql_insert_id( $MySQLConnection ); Note that the function argument is the connection to MySQL (not the db/tbl !). Thus the ID is a by-product of the connection (and the most recent INSERT it handled) - re-read the appropriate page in the manual for more information, if required. 2 because the (function argument) controlling feature is the connection, it is not possible for another concurrent user to 'steal' your ID or influence the ID returned to you - it's all yours! The only way to get the wrong ID is to perform two IDs and then (vainly) try to get hold of the previous ID - only the latest ID is available. Clear now? =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: [PHP] mysql_insert_id?
Hi Wee, Is it possible that I would get the wrong ID (Not the ID I just inserted in Auto_Increment field) by using mysql_insert_id function if someone is also inserting record at the same time? How does mysql_insert_id work accurately? =A couple of things here: 1 if the field is defined as Auto_Increment then YOU will not insert an ID. Leave the field out of the INSERT statement or transfer NULL, and MySQL will insert the correct ID value according to the 'increment' policy. The construction of the mysql_insert_id() looks like this: $AutoIncrementId = mysql_insert_id( $MySQLConnection ); Note that the function argument is the connection to MySQL (not the db/tbl !). Thus the ID is a by-product of the connection (and the most recent INSERT it handled) - re-read the appropriate page in the manual for more information, if required. 2 because the (function argument) controlling feature is the connection, it is not possible for another concurrent user to 'steal' your ID or influence the ID returned to you - it's all yours! The only way to get the wrong ID is to perform two IDs and then (vainly) try to get hold of the previous ID - only the latest ID is available. Clear now? =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] How can recommend a book for SQL and DB design
I found Sams teach yourself MySQL in 21 days to be very helpful. It provides some general db practices such as structure and normalization. And it covers MySQL pretty well, with examples for mutiple languages. -Original Message- From: Andy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 15, 2002 4:11 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] How can recommend a book for SQL and DB design Hi, I am searching for a good book on how to design a db for web apps. Normalisation rools, performancejust describing how to do it on a proffesional way. The second one, I am searching for is a book about SQL for MySQL. Any good books on the market? Thanx for the recommendation Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How can recommend a book for SQL and DB design
On Tue, Jan 15, 2002 at 11:11:25PM +0100, Andy wrote: Hi, I am searching for a good book on how to design a db for web apps. Normalisation rools, performancejust describing how to do it on a proffesional way. The second one, I am searching for is a book about SQL for MySQL. Any good books on the market? Thanx for the recommendation I've got about four books on MySQL, including one on using MySQL for web development, but the book I would recommend for both your needs is 'MySQL' by Paul DuBois. The book is a little out of date and you will need to check the on line manual to see what has changed, especially for SQL. But it covers the basics of SQL and performance better than anything else. Almost all your beginning questions will be answered there. For a more advanced treatment of performance, Jeremy's book sounds like the best bet, when it comes out. Bob Hall -- Know thyself? Absurd direction! Bubbles bear no introspection.-Khushhal Khan Khatak -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Automatic Listboxes
Hi there everyone, Hope you are all having a good new year :-) I have a problem, I am working on a search engine for a Travel Agents and before you get to the actual type-in search field, you have to select from 3 pulldowns. The first pulldown is country, then the second should popuplate from whichever country is selected and so on. My question is this: How can I populate a pulldown box in a form from a DB automatically? In other words, what I need is once they have selected the first listbox, instead of having to click GO to populate the second one it does it automatically after selecting the entry in the first box and so on. Can anyone help? Thank you all so much :-) Regards Chris Payne www.planetoxygene.com
Re: [PHP-DB] Re: permissions for writing file
James, Who are you logging in as and do you have write privileges in that directory? Who owns it: user and group? (Don't have to answer, that's just what you have to know. Alternately, is there a mysql user in /etc/passwd? What group? The answer probably lies in there somewhere. Is there any possibility you can use a Secure Shell (SSH) on that machine? It's much safer than telnet. If you're reaching it from a windows box you can use putty.exe or terraterm ssh for access. Both are secure clients. Regards - Miles Thompson At 09:42 AM 1/14/2002 -0500, James Kupernik wrote: My problem is that I'm trying to run the query via a telnet sessions before I code through PHP. Is there a solution that anyone knows for this? James Kupernik [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'm trying to use PHP and MySQL to query a table and write the contents to a new file. When run the command to outfile it tells me I don't have permissions. This is on a Unix machine. mysql select * into outfile /home/u1/funfun/www.somewebsite.com/catalogreq/ catalog.txt mysql fields terminated by ',' optionally enclosed by '' mysql fields terminated by ',' optionally enclosed by '' mysql fields terminated by ',' optionally enclosed by '' -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Automatic Listboxes
You'll have to submit the data. Just that instead of pushing go, you can get JavaScript to do that. For instance, form name=myForm1 action=? echo $PHP_SELF? select name=country onChange=document.myForm1.submit() option value=Albania option value=Andorra /select /form form name=myForm2 action=? echo $PHP_SELF? select name=country onChange=document.myForm2.submit() option value=Albania option value=Andorra /select /form form name=FinalForm action=final_URL select name=country option value=Albania option value=Andorra /select input type=submit /form You'll then have to check whether you have any field empty and, if so, echo the same form again, with the empty element populated. The final form actually contains the button which gets to the final page. Alternatively you could use a single form, but then you'll have both pieces of code (echoing the form and echoing the final page) in the same PHP - easily solvable with include() for clean coding. HTH Bogdan Chris Payne wrote: Hi there everyone, Hope you are all having a good new year :-) I have a problem, I am working on a search engine for a Travel Agents and before you get to the actual type-in search field, you have to select from 3 pulldowns. The first pulldown is country, then the second should popuplate from whichever country is selected and so on. My question is this: How can I populate a pulldown box in a form from a DB automatically? In other words, what I need is once they have selected the first listbox, instead of having to click GO to populate the second one it does it automatically after selecting the entry in the first box and so on. Can anyone help? Thank you all so much :-) Regards Chris Payne www.planetoxygene.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Why the following error, yet it works anyway
Chip, You're not going to like this .. on the delete you aren't fetching any rows. Miles At 09:18 AM 1/14/2002 -0800, [EMAIL PROTECTED] wrote: I have the following short web page to delete dealer bulletins from a database. My page lists all the bulletins in the database - id and subject. There is a text input field to enter the bulletin id number and hit the delete button, and the bulletin is deleted. It works except after the submit delete I get an error - - Warning: Supplied argument is not a valid MySQL result resource in /usr/local/apache/htdocs/bulletin_delete.php on line 35 - line 35 is the while statement. Here is the complete page - - Simrad Dealer Bulletins - Delete Screen NOTE: This is a permanent and irreversible delete! No second chances here! Enter the bulleting ID Number: ? $db = mysql_connect(localhost, root) or die (Can't get the database server); mysql_select_db(bulletins, $db) or die (Can't get the database); if (isset($submit)): $sql = delete from dbulletins where news_id = '$newsid'; else: $sql = select news_id, bulletin_subject from dbulletins; endif; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { print \nDelete entry .$row[news_id].? .$row[bulletin_subject].\n \n; } ? bulletin_admin.htmBack -- Chip Wiegand Computer Services Simrad, Inc www.simrad.com [EMAIL PROTECTED] There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corporation, 1977 (They why do I have 7? Somebody help me!) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] REQ code help for case statement
George, Maritime Tel Tel, or Aliant as they like to be known as now, has had its email servers screwed up all day. So if this has already been answered, just let me know. I also just had a look at the example in the MySQL manual and it's not a model of clarity. Well, maybe it is, but certainly not practical. Could you be a bit more specific about what you are trying to do? The difficult thing to get one's head around is that the CASE statement operates in the fields you are selecting, rather than in the WHERE condition. Miles At 08:17 AM 1/15/2002 +, George Pitcher wrote: Hi all, Trying to move code into MySQL rather than php, but can't find any examples of what I want to do. I have a number of fields and want to be able to check a number of fields (most containing workflow dates or text) and return a 'message' for web display. The message will take the form of 'Status of record' followed by a date taken from the appropriate field (not always the same one). The example in the manual doesn't refer to field data at all but to numbers. How do I write the code to do this? I need to do this on two web pages, one for a single record and one which shows a list of records (each will display the 'message'. MTIA George, Edinburgh --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] index page
so what's the problem? : ) you should have a link like this: a href=results.php?criteria=?php echo $critera ?max_results=?php echo $max_results ? the link /a now you'll be able to do your query at the results.php script using those variables. andy - Original Message - From: Barry Rumsey [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 15, 2002 1:36 PM Subject: [PHP-DB] index page I'm trying to create a page like the following: A B C D ... a1b1c1d1 a2b2c2c3 You know the kind of pages I'm talking about. I need to grab the first letter of each entry and then limit them to the last 5 entry's by date( I know how to do the limit ), but then the first letter has to be a hyper link to a page that list all of that letter. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] sorting on the first 8 digits....
Ok, I did something stupid and now I am paying the price... In an internal database that tracks the time and date something happens on our site, I mistakenly forgot to use leading zeros in the 24 hour column(s). So, anything that happens between 1-9 am are all short by one digit. Now, I need to create a report that shows these transactions in the order that they happened. The answer to this problem should be as simple as adding a zero to the end of all records that are short one digit. But, for reasons that I won't explain here, that isn't possible. So, my question is this, is there a way to do a database call that would select all the records but allow me to order them based on the first 8 digits only? If you would like an example, I need the following two numbers to come up in the order listed. 20011012182929 200411322 Thanks for your time. John __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Automatic Listboxes
Javascript is your way to do this, but there are obviously a few ways you can do that aswell. You don't want to have to submit a form and reload images/pages etc, so javascript is the only way to go (or dhtml or other stuff) One way to do this is either with layers (hide/unhide depending on what need) and all the information is already printed to the page, but shows only the needed information. Another way is to create javascript arrays and let javascript do the selections and stuff... I've seen a few tutorials around that do that... Here are some links that might help you: This is for dreamweaver and ASP but same principal (and explains how it works aswell) http://www.macromedia.com/support/ultradev/ts/documents/client_dynamic_listb ox.htm This is something similar, and also cool... http://javascript.internet.com/forms/auto-drop-down.html This is a basically what you want... but you might have to modify it a little bit... http://javascript.internet.com/forms/category-selection.html So you get PHP to fill the javascript array by something like this, knowing that I am no genius in javascript (as long as you have values in $array): head script langauage=Javascript !-- function start(){ var something = new Array(); ?php for ($i=0;$icount($array);$i++){ echo javascript array stuff -- $array[$i]; } ? // now the other javascript code (additional lists etc) } and then thats it! (well, sorta, but you get the jist) Adam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] PHP Build/Compile Problem
I have configured apache according to the readme included in the apache source: ./configure --prefix=/usr/local/apache And then configure php: ./configure --with-apache=../apache_1.3.22 make make install After that configure apache again while activating the php module: ./configure --prefix=/usr/local/apache --activate-module=src/modules/php3/libphp3.a make I haven't even make install and this was what I got. Undefined first referenced symbol in file ldap_parse_referencemodules/php4/libphp4.a(ldap.lo) uncompress /usr/local/mysql/lib/libmysqlclient.a(my_compress.o) compress /usr/local/mysql/lib/libmysqlclient.a(my_compress.o) ld: fatal: Symbol referencing errors. No output written to httpd collect2: ld returned 1 exit status make[2]: *** [target_static] Error 1 make[2]: Leaving directory `/export/home/shahmatd/apache_1.3.22/src' make[1]: *** [build-std] Error 2 make[1]: Leaving directory `/export/home/shahmatd/apache_1.3.22' make: *** [build] Error 2 Would really really appreciate it if some one could help me out, if tried a couple of approaches, still to no avail. Shahmat -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Logicproblem in WHERE statement
On Wednesday 16 January 2002 06:05, Andy wrote: Hi there, I am building a user search engine. Now I do not know how to gett following: a mandatory field and a voluntary field For example I would like to get all female users and those who are from canada. The results should show all users who are female regardless of nationality But it should also show all users from canada. How would this look like? SELECT * FROM table WHERE sex=1 AND country='CA' This is wrong I know. But how does it work??? SELECT * FROM TABLE WHERE sex = 1 OR country = 'CA'; Will select all users who are female as well as all users from Canada. You may get duplicate records (for people who are female and from Canada) so you may want to use DISTINCT as well. hth -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Yeah, there are more important things in life than money, but they won't go out with you if you don't have any. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] A weird images database/web page problem
I have a database set up with tables of images. I have pages set up to display the images 12 per page in a table of 2 rows/6 cols. There is a next link that loads the next 12 images from the database. All works just fine except for one little problem - the first time the page is loaded the first image is not number 1, but rather number 13. It is skipping the first 12 images. 1) What do I need to do to fix this? Must be something in the code below? 2) When I get to the last page of images, the next button is still active and will, when clicked on, load an empty page, because there are no more images to display. How do I prevent this (make the last page definately the last page)? (new images are often being added, so hard coding a last image number won't work) ? $new_pic=$pic+12; $conn=mysql_connect(localhost, chip,carvin) or die (Could not get the databse); mysql_select_db(images, $conn) or die (Could not select the database); $sql=select * from ab limit $new_pic,12; $result=mysql_query($sql); while ($row=mysql_fetch_array($result)) { printf(td align=\center\a href=\%s\img src=\../thumbs/%s\/a/td\n, $row[name], $row[name]); $i++; if($i %6==0) { echo /tr\n; } } echo tr\ntd colspan=\6\ align=\center\\na href=\../index.html\Home/anbsp;\na href=\index.php?pic=$new_pic\Next/a\n/td\n/tr\n; ? -- Chip W www.wiegand.org Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] A weird images database/web page problem
On 2002.01.15 23:30:25 -0600 chip wrote: I have a database set up with tables of images. I have pages set up to display the images 12 per page in a table of 2 rows/6 cols. There is a next link that loads the next 12 images from the database. All works just fine except for one little problem - the first time the page is loaded the first image is not number 1, but rather number 13. It is skipping the first 12 images. 1) What do I need to do to fix this? Must be something in the code below? 2) When I get to the last page of images, the next button is still active and will, when clicked on, load an empty page, because there are no more images to display. How do I prevent this (make the last page definately the last page)? (new images are often being added, so hard coding a last image number won't work) ? $new_pic=$pic+12; Is $pic already set by the HTTP_GET_VARS here? $conn=mysql_connect(localhost, chip,carvin) or die (Could not get the databse); mysql_select_db(images, $conn) or die (Could not select the database); $sql=select * from ab limit $new_pic,12; Assuming that $pic is 0, then $new_pic is 12, so you're selecting with LIMIT 12, 12. You probably want to use $pic here, right? $result=mysql_query($sql); while ($row=mysql_fetch_array($result)) { printf(td align=\center\a href=\%s\img src=\../thumbs/%s\/a/td\n, $row[name], $row[name]); $i++; if($i %6==0) { echo /tr\n; } Note that if the select statement gives you other than 6 or 12 images (which it probably will on the last page), that /tr will never get echoed. } echo tr\ntd colspan=\6\ align=\center\\na href=\../index.html\Home/anbsp;\na href=\index.php?pic=$new_pic\Next/a\n/td\n/tr\n; ? To find out if $new_pic pointed to a valid image you would probably need to do a select count(*) from ab to get the total number of records. If $new_pic is less than the count, then show the link. -- Chip W www.wiegand.org Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Session and authentication questions in frames
I have a successful website with authenticatin and logons. There are sections that I allow anyone to get to, but the others have to be authenticated. This site is not using frames at all. its a page by page, with the unit that does the authentication and sessions being included in each page. I've taken these same units to another site. I altered the pieces neccesary to hit the new sites database and users. This site is using frames. the outer frames are not using the authentication or sessions. However, internal pages do. As I enter a section that needs a logon, it prompts me. Then it goes to the correct page. But the next page it goes too, it wants to get a logon again. These pages are in a row, and they all use the same sessions stuff that the other site uses. I know that they all have to include the same units, so once it needs to logon, it'll prompt that, but it should pass this session info from here to there, and not have to logon again. Its driving me nuts. The only thing I can think of thats different is the frames. I even took the same code from the other site ( the one that does work without frames), and plugged it in. So the session logon was for the other site and other db. It'd prompt me each time too. I am not sure what to do now... help please. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]