Re: [PHP-DB] Need help with duplicate entries
Use a Select Distinct. query. See www.mysql.com/doc for more info -- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 Mob 07763 620378 PGP Key available, send blank email to [EMAIL PROTECTED] - Original Message - From: Chris Payne To: [EMAIL PROTECTED] Sent: Monday, October 15, 2001 9:59 PM Subject: [PHP-DB] Need help with duplicate entries Hi there everyone, I'm working on a project for a friend who owns a travel agent, he has a MySQL database which works very fast, but the problem is that there are alot of duplicate entries. When I am retrieving the results from the DB and getting it ready to display on the page, how do I eliminate duplicates via a query? What I mean is (See below) I have backpackeurope.com many times but for different countries, when you search for backpacking it brings all the countries up under one another - how do I make it only bring 1 entry up of each entry rather than all of them? Confused? That's how I feel :-) Thank you all so much. Chris Payne www.backpackeurope.com Backpackers/Hostels in Austria Backpacking and hostelling tips and links for student and budget travellers planning a trip to europe. [EMAIL PROTECTED] - rating: . Category: Accommodation www.backpackeurope.com Backpackers/Hostels in England Backpacking and hostelling tips and links for student and budget travellers planning a trip to europe. [EMAIL PROTECTED] - rating: . Category: Accommodation
[PHP-DB] select take (too) much time
hello, i have got a table table1: CREATE TABLE table1 ( id bigint(20) unsigned DEFAULT '0' NOT NULL auto_increment, refer varchar(255) NOT NULL, aantal int(9) DEFAULT '1' NOT NULL, time int(10) DEFAULT '0' NOT NULL, PRIMARY KEY (id), UNIQUE id (id) ); now i insert about 200 rows in it. After that i do i select (using phpMyAdmin): SELECT table1 FROM table1 it seems this never stops sending data: SHOW processlist: Id User Host db Command Time State Info 171807 __ Query 300 Sending data SELECT * FROM table1 also a delete like DELETE FROM table1 WHERE time. will take (too) much time. All this give problems cause the table is locked when 'Sending data' and the row of new inserts is growing. Is there something wrong with my table-design? Thanks for reading. Bas -- 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] Variables in a loop
try form... input name=a[] value=.. input name=a[] value=.. input name=a[] value=.. input name=a[] value=.. and for ($i=1; $i=10; $i++) { $tab[$i]=$a[$i] ;} This way $a will be a array. Hope it helps Bruno Gimenes Pereti. - Original Message - From: LeTortorec, Jean-Louis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, October 29, 2001 7:03 PM Subject: [PHP-DB] Variables in a loop I'm trying to write a loop to read variables I receive from a form: form ... input name=a1 value=.. input name=a2 value=.. input name=a3 value=.. input name=a4 value=.. I'd like to get something like: for ($i=1; $i=10; $i++) { $tab[$i]=a.$i ;} The expression a.$i is actually a string, not a variable. Any idea how to read the value of that string? Thanks for your help. Jean-Louis -- 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] Greetings from Online Email Telphone Psychics at absolutelypsychic.com
Hi Greetings from http://www.absolutelypsychic.com I hope you are doing well. Our site has Professional, Ethical, and Accurate Psychics, Astrologers and Tarot Card readers that have been tested by management to assure authenticity. Our readers do not promise any false prophesies nor do they tell you what you want to hear - they have counseling skills, and professionals. In fact, one of our readers' has a TV Show called Chartalk - those clips are on our website. This gives you the opportunity to check his work out for free to observe. Including the predicting the WTC explosion - check it out - you can see the clip is old and its verifiable through MNN in NYC. Our prices are also very modest, we do not charge a fortune, nor are we anywhere near a 900 line - we have experience in working on those and on other sites and tailored to make this a good experience for everyone. We hold chat parties where you can get mini readings as well. Feel free to surf our site at any time there's plenty of information on there to show you what we are about. If you have any questions, please feel free to write back to assist you any way possible. We do say please become more aware of our field, if anyone ever says to you that they can cleanse you of problems, the thing they are going to cleanse is your wallet !Don't fall for it! Thanks Love Light Jackie http://www.absolutelypsychic.com To remove please email back to [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] automated processes in mysql
Hello, Can i use mysql for automated processes? do $query every hour. Tnx, Bas -- 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] automated processes in mysql
in Unix, set-up a cron job. In Windows, set-up an AT job. -Original Message- From: Bas Jobsen [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 30, 2001 9:36 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] automated processes in mysql Hello, Can i use mysql for automated processes? do $query every hour. Tnx, Bas -- 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] Advantage database
Hello there, I hope I am not disturbing anyone. I have a question. I am using Advantage Database, I would like to know If PHP supports this database format. My email address is [EMAIL PROTECTED] Thank you for your help Regards Luis -- 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] automated processes in mysql
mySQL does not include native support to launch queries at a specific interval. In the mySQL manual, I found the following application: mysqltop.tar.gz: Sends a query in a fixed time interval to the server and shows the resulting table. By Thomas Wana. -Original Message- From: Bas Jobsen [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 30, 2001 9:55 AM To: DL Neil; [EMAIL PROTECTED] Subject: Re: [PHP-DB] automated processes in mysql Hello, Thank for all your soon responses. Well, oke, I know about corntab. But someone told me myslq can do the job itself. Tnx again, Bas -- 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] www.Aerotaxi.net
www.Aerotaxi.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: RE: that book:
Don't quote me on this but the ./configure command when compiling/re-compiling php should be run one level up from the dir you wish to make the action occur in. (One above /path/to/php4.0.6/bin so: ./bin/configure with --this with --that I have cc'd this to the php-db list to make sure this is right (and I'm not even convinced myselfanyone??) Cheers Russ On Mon, 29 Oct 2001 15:26:58 - [EMAIL PROTECTED] wrote: Russ: see below for the question I posted and the reply I got. I hope it makes some sense. My Question was: I have a RedHat 7.2 server which I configured using the automatic configuration GUI. It is running apache 1.3.20, mysql 3.23.41,and php 4.0.6. Apache and php are working fine but I created the phpinof.php page and it is missing any reference to mysql. I am real new to linux but someone I know who is helping me suggested I need to recompile php to integrate mysql and apxs. I searched the forum and a while back found this but I need to know is this right and if could some one interpret it for me! ./configure --with-axps --with-mysql make make install The response was: I don't think you're going to need to recompile. For one, Redhat's automatic configuaration GUI doesn't use source files uses RPM's (basically pre-compiled binaries). Thus, you probably don't have the source readily available and would need to download it. That's not a big problem though:) More to the point, AFAIK, the RPM's are compiled using apxs and the --with-mysql option is default (you have to manually specify that you *don't* want MySQL support). Your best and easiest bet is to add one or more RPM ftp servers into the sources list of the PRM Manager (don't ask me how I don't use Redhat) and run a search for php-mysql. It'll turn up a bunch of hits (probably on the installation cd's as well) for the php-mysql rpm, just select it and install it. In answer to your other question, the make options you've given in your post are valid and won't cause the make to barf and die (assuming you've got MySQL and APXS installed on your box). Personally I find it's useful to place the make clean command before the ./configure options. It ensures you're running a fresh install and not using an old cached config script. --- Just one more question. Do you understand the './configure' command? does it have to be run from a particular directory to be affective? If so how might you find out? Thanks very much for your help today. It is much appreciated - I'm off to amazon now to get the book! James. -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: 29 October 2001 15:00 To: [EMAIL PROTECTED] Subject: that book: James: The book is called: * Fast and Easy Web Development using PHP * By Julie C Meloni Paste this URL into your browser: http://www.amazon.com/exec/obidos/ASIN/076153055X/qid=1004367638/sr=1-6/ref= sr_1_15_6/104-6954028-5527930 and check out also: www.thickbook.com (support website for the book) Good luck! Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.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] PHP query on date field
Here is my problem once again... =P I am wondering if I should change the date table to something other than date... maybe something like date_1? Would doing that resolve my issue, because of the fact that the date variable in php is function? Thanks in advance... Jason /* Form to supply variables */ form name=auth method=post action=http://path/to/search.php; pSearch for Ads/p First name: input type=text name=fname br Last name: input type=text name=lname br Area Code:nbsp; input type=text name=phonea size=3 maxlength=3 Phone: input type=text name=phone size=8 maxlength=8 br Date: input type=text name=date br p input type=submit name=login value=Submit input type=reset name=reset value=Reset /p /form Once user clicks submit button it links to this php script to connect, query and display results... eveything works fine except for the date variables. If anyone with a little more know how can point me out the error I would greatly appriciate it. /* php script to connect, query and display results */ ?php mysql_connect (db_host, db_username, db_password) or die(Couldn't connect!); mysql_select_db (db_name) or die(Couldn't select database); if ($fname == ) {$fname = '%';} if ($lname == ) {$lname = '%';} if (phonea == ) {$phonea = '%';} if ($phone == ) {$phone = '%';} if ($date == ) {$date = '%';} $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date LIKE '%$date%'); if ($row = mysql_fetch_array($result)) { do { PRINT Your search results: brbr; PRINT bFirst Name: /b ; print $row[fname]; print (br); PRINT bLast Name: /b ; print $row[lname]; print (br); PRINT bAddress: /b ; print $row[address]; print (br); PRINT bCity: /b ; print $row[city]; print (br); PRINT bState: /b ; print $row[state]; print (br); PRINT bZip: /b ; print $row[zip]; print (br); PRINT bArea Code: /b ; print $row[phonea]; print (br); PRINT bPhone: /b ; print $row[phone]; print (br); PRINT bEmail: /b ; print $row[email]; print (br); PRINT bWeeks: /b ; print $row[weeks]; print (br); PRINT bCity 1: /b ; print $row[cty1]; print (br); PRINT bCity 2: /b ; print $row[cty2]; print (br); PRINT bCity 3: /b ; print $row[cty3]; print (br); PRINT bAd: /b ; print $row[ad]; print (br); PRINT bTotal: /b ; print $row[total]; print (br); PRINT bNumber of weeks: /b ; print $row[num]; print (br); PRINT bDate: /b ; print $row[date]; print (br); PRINT bTime: /b ; print $row[time]; print (br); print (hr); } while($row = mysql_fetch_array($result)); } else {print Sorry, no records were found!;} ? -- 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] Variables in a loop
If you have a string that is the name of an input field, you can do one of 3 things: Ex: $sName = input.$i; //result = input1 $sName = input.$i; //result = input2 etc... 1: Variable Variables $value = $$sName; 2: If you posted the form $value = $HTTP_POST_VARS[$sName]; 3: If you used GET with the form $value = $HTTP_GET_VARS[$sName]; Regards, -Jason Garber IonZoft.com At 09:10 AM 10/30/2001 +0100, * RzE: wrote: Original message From: LeTortorec, Jean-Louis [EMAIL PROTECTED] Date: Mon, Oct 29, 2001 at 04:03:45PM -0500 Message-ID: 615315231286D21182E40008C7B1EED23C6E76@COMPAQ3000 Subject: [PHP-DB] Variables in a loop I'm trying to write a loop to read variables I receive from a form: form ... input name=a1 value=.. input name=a2 value=.. input name=a3 value=.. input name=a4 value=.. I'd like to get something like: for ($i=1; $i=10; $i++) { $tab[$i]=a.$i ;} The expression a.$i is actually a string, not a variable. Any idea how to read the value of that string? Thanks for your help. Jean-Louis /Original message Reply Why don't you just use an array? form ... input name=a[] value=.. input name=a[] value=.. input name=a[] value=.. input name=a[] value=.. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP query on date field
Hi Jason, What is the error message, in what line? I really can't find any error... Just one standarlization point: why do you use ( ) when printing BR and not in every other printing. For me, it's easyer to debug if every thing that do the same thing is writen the same way. Other thing out of the point. You could write all the line in one print command: print bTotal:/b $row['total']br; or print bTotal:/b . $row[total] .br; or (my favorite) ? bTotal/b ? print $row[total]; ?br; ? Please send the error message, O got curios.. (sorry I don't remember how to write it, I think I can understand what I mean :-) Bruno Gimenes Pereti. - Original Message - From: Jason [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 30, 2001 3:31 PM Subject: [PHP-DB] PHP query on date field Here is my problem once again... =P I am wondering if I should change the date table to something other than date... maybe something like date_1? Would doing that resolve my issue, because of the fact that the date variable in php is function? Thanks in advance... Jason [snip] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP query on date field
What I use to do is to print the sql and try it in the command line to know it I'm constructing it correctly. $sql = select foo from bar...; print $sqlbr\n; ## add this line execute your script and copy the line to the mysql command line. If the result is what you expect it should be working. {Hope this helps} else {tell us}. Bruno Gimenes Pereti. - Original Message - From: Big Nickel [EMAIL PROTECTED] To: Bruno Gimenes Pereti [EMAIL PROTECTED] Sent: Tuesday, October 30, 2001 4:02 PM Subject: Re: [PHP-DB] PHP query on date field I apologize... there really isn't any error messages.. it just shows that there are no results to be displayed but when i telnet into the db there are plenty of dates that met my search criteria. I just need to know why it wont display the results... and I am thinking that because in php the date function is the same thing i am using for a variable... not sure if that is the problem but i am open to suggestions on it. Thanks again. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] PHP query on date field
First, I agree with Bruno concerning putting print all on one line, as you and I discussed previously Jason. Second, keep using DATE data type in mySQL. Simply specify to the user how the date is to be entered on the form. DATE is maintained in mySQL as -MM-DD. User that -Original Message- From: Bruno Gimenes Pereti [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 30, 2001 11:42 AM To: PHP-DB Subject: Re: [PHP-DB] PHP query on date field Hi Jason, What is the error message, in what line? I really can't find any error... Just one standarlization point: why do you use ( ) when printing BR and not in every other printing. For me, it's easyer to debug if every thing that do the same thing is writen the same way. Other thing out of the point. You could write all the line in one print command: print bTotal:/b $row['total']br; or print bTotal:/b . $row[total] .br; or (my favorite) ? bTotal/b ? print $row[total]; ?br; ? Please send the error message, O got curios.. (sorry I don't remember how to write it, I think I can understand what I mean :-) Bruno Gimenes Pereti. - Original Message - From: Jason [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 30, 2001 3:31 PM Subject: [PHP-DB] PHP query on date field Here is my problem once again... =P I am wondering if I should change the date table to something other than date... maybe something like date_1? Would doing that resolve my issue, because of the fact that the date variable in php is function? Thanks in advance... Jason [snip] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP query on date field
On Wednesday 31 October 2001 01:31 am, Jason wrote: Here is my problem once again... =P I am wondering if I should change the date table to something other than date... maybe something like date_1? Would doing that resolve my issue, because of the fact that the date variable in php is function? Thanks in advance... What is the format of date as defined in your database? If date is of type DATE or DATETIME then $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date LIKE '%$date%'); should be changed to: $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date = '$date' ); hth -- Jason Wong Gremlins Associates www.gremlins.com.hk -- 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] executing system commands
Get a look at the PHP manual on www.php.net or mirror, annoted version, command : system, there is a good example. regards B. le jeu 25-10-2001 à 12:46, Ric Manalac a écrit : hi, i'm a newbiew php developer. i'm trying to execute a system command in one of my php scripts. what i would like to do is to create a directory. my code goes like this: // chunk of code starts here $directory = generate_sessionid(); $command = mkdir /home/httpd/html/miroku/downloads/$directory; system($command, $dirsuccess); // chunk of code ends here generate_sessionid() is a function that generates a string that contains 16 random integers (0-9). i want to use that random string as the name of the directory that i'm creating. i checked php3.ini if safe mode is on but it is set to Off. thanks in advance! regards, ric -- == Note: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient,or an employee or agent responsible for delivering this to the intended recipient,you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. == -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP query on date field
Isn't date a reserved word that should not be used as a field name? It appeared that what was asked was if he should change the name of his field from date to date_1. It should definitely be changed if it is now called date. Jason Wong [EMAIL PROTECTED] said: On Wednesday 31 October 2001 01:31 am, Jason wrote: Here is my problem once again... =P I am wondering if I should change the date table to something other than date... maybe something like date_1? Would doing that resolve my issue, because of the fact that the date variable in php is function? Thanks in advance... What is the format of date as defined in your database? If date is of type DATE or DATETIME then $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date LIKE '%$date%'); should be changed to: $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date = '$date' ); hth -- Jason Wong Gremlins Associates www.gremlins.com.hk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP query on date field
On Wednesday 31 October 2001 02:57 am, [EMAIL PROTECTED] wrote: Isn't date a reserved word that should not be used as a field name? It appeared that what was asked was if he should change the name of his field from date to date_1. It should definitely be changed if it is now called date. According to the docs, date is *not* a reserved word in MySQL, so he should be OK. -- Jason Wong Gremlins Associates www.gremlins.com.hk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP query on date field
Hi again Jason, I think Jason Wong got the problem I missed, it's the date format. If you tested like I sad in the last mail you already found it. When you query: SELECT * FROM ads WHERE date = '%$date%'; you get an empty result. So, that's the solution... Bruno Gimenes Pereti. What is the format of date as defined in your database? If date is of type DATE or DATETIME then $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date LIKE '%$date%'); should be changed to: $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date = '$date' ); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP query on date field
Ok well I have made the changes and tested it out but using the search string 10/15/2001 still provided no results... here is the script that parses the date for entry into the database... $date = (date(m/d/Y)) ; #this date is used in the online database $A = (date(A)); $Hou = (date(H)); if ($Hou == 00){ $Hou = 10; $format = PM; } if ($Hou == 01){ $Hou = 11; $format = PM; } if ($Hou == 02){ $Hou = 12; $format = AM; } if ($Hou == 03){ $Hou = 01; $format = AM; } if ($Hou == 04){ $Hou = 02; $format = AM; } if ($Hou == 05){ $Hou = 03; $format = AM; } if ($Hou == 06){ $Hou = 04; $format = AM; } if ($Hou == 07){ $Hou = 05; $format = AM; } if ($Hou == 08){ $Hou = 06; $format = AM; } if ($Hou == 09){ $Hou = 07; $format = AM; } if ($Hou == 10){ $Hou = 08; $format = AM; } if ($Hou == 11){ $Hou = 09; $format = AM; } if ($Hou == 12){ $Hou = 10; $format = AM; } if ($Hou == 13){ $Hou = 11; $format = AM; } if ($Hou == 14){ $Hou = 12; $format = PM; } if ($Hou == 15){ $Hou = 01; $format = PM; } if ($Hou == 16){ $Hou = 02; $format = PM; } if ($Hou == 17){ $Hou = 03; $format = PM; } if ($Hou == 18){ $Hou = 04; $format = PM; } if ($Hou == 19){ $Hou = 05; $format = PM; } if ($Hou == 20){ $Hou = 06; $format = PM; } if ($Hou == 21){ $Hou = 07; $format = PM; } if ($Hou == 22){ $Hou = 08; $format = PM; } if ($Hou == 23){ $Hou = 09; $format = PM; } I am wondering if I should let the date be put into the db as 2001-15-10... [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Isn't date a reserved word that should not be used as a field name? It appeared that what was asked was if he should change the name of his field from date to date_1. It should definitely be changed if it is now called date. Jason Wong [EMAIL PROTECTED] said: On Wednesday 31 October 2001 01:31 am, Jason wrote: Here is my problem once again... =P I am wondering if I should change the date table to something other than date... maybe something like date_1? Would doing that resolve my issue, because of the fact that the date variable in php is function? Thanks in advance... What is the format of date as defined in your database? If date is of type DATE or DATETIME then $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date LIKE '%$date%'); should be changed to: $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date = '$date' ); hth -- Jason Wong Gremlins Associates www.gremlins.com.hk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] PHP query on date field
Jason, date(H) converts to a 24-hour clock. That is, 00 is 12 mid-night, 01 is 1 AM, 13 is 1 PM, 14 is 2 PM, 23 is 11 PM, etc. I do not understand the reasons for your computation that, say 00, is 10 PM. -Original Message- From: Jason [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 30, 2001 2:20 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] PHP query on date field Ok well I have made the changes and tested it out but using the search string 10/15/2001 still provided no results... here is the script that parses the date for entry into the database... $date = (date(m/d/Y)) ; #this date is used in the online database $A = (date(A)); $Hou = (date(H)); if ($Hou == 00){ $Hou = 10; $format = PM; } if ($Hou == 01){ $Hou = 11; $format = PM; } if ($Hou == 02){ $Hou = 12; $format = AM; } if ($Hou == 03){ $Hou = 01; $format = AM; } if ($Hou == 04){ $Hou = 02; $format = AM; } if ($Hou == 05){ $Hou = 03; $format = AM; } if ($Hou == 06){ $Hou = 04; $format = AM; } if ($Hou == 07){ $Hou = 05; $format = AM; } if ($Hou == 08){ $Hou = 06; $format = AM; } if ($Hou == 09){ $Hou = 07; $format = AM; } if ($Hou == 10){ $Hou = 08; $format = AM; } if ($Hou == 11){ $Hou = 09; $format = AM; } if ($Hou == 12){ $Hou = 10; $format = AM; } if ($Hou == 13){ $Hou = 11; $format = AM; } if ($Hou == 14){ $Hou = 12; $format = PM; } if ($Hou == 15){ $Hou = 01; $format = PM; } if ($Hou == 16){ $Hou = 02; $format = PM; } if ($Hou == 17){ $Hou = 03; $format = PM; } if ($Hou == 18){ $Hou = 04; $format = PM; } if ($Hou == 19){ $Hou = 05; $format = PM; } if ($Hou == 20){ $Hou = 06; $format = PM; } if ($Hou == 21){ $Hou = 07; $format = PM; } if ($Hou == 22){ $Hou = 08; $format = PM; } if ($Hou == 23){ $Hou = 09; $format = PM; } I am wondering if I should let the date be put into the db as 2001-15-10... [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Isn't date a reserved word that should not be used as a field name? It appeared that what was asked was if he should change the name of his field from date to date_1. It should definitely be changed if it is now called date. Jason Wong [EMAIL PROTECTED] said: On Wednesday 31 October 2001 01:31 am, Jason wrote: Here is my problem once again... =P I am wondering if I should change the date table to something other than date... maybe something like date_1? Would doing that resolve my issue, because of the fact that the date variable in php is function? Thanks in advance... What is the format of date as defined in your database? If date is of type DATE or DATETIME then $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date LIKE '%$date%'); should be changed to: $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date = '$date' ); hth -- Jason Wong Gremlins Associates www.gremlins.com.hk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP query on date field
Rick, This portion of the site was done by a previous employee and well you know the expression.. If its not broke don't fix it. Well now that I cannot query the db by the date it is now broke and I am still figuring out how MySQL is taking entries to the db so I figured this bit of information would maybe sum up the problem in the date field. I have been reading up on the date function in the MySQL book I have but somethings it just doesn't cover. So please excuse my being vague. Thanks, Jason Rick Emery [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Jason, date(H) converts to a 24-hour clock. That is, 00 is 12 mid-night, 01 is 1 AM, 13 is 1 PM, 14 is 2 PM, 23 is 11 PM, etc. I do not understand the reasons for your computation that, say 00, is 10 PM. -Original Message- From: Jason [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 30, 2001 2:20 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] PHP query on date field Ok well I have made the changes and tested it out but using the search string 10/15/2001 still provided no results... here is the script that parses the date for entry into the database... $date = (date(m/d/Y)) ; #this date is used in the online database $A = (date(A)); $Hou = (date(H)); if ($Hou == 00){ $Hou = 10; $format = PM; } if ($Hou == 01){ $Hou = 11; $format = PM; } if ($Hou == 02){ $Hou = 12; $format = AM; } if ($Hou == 03){ $Hou = 01; $format = AM; } if ($Hou == 04){ $Hou = 02; $format = AM; } if ($Hou == 05){ $Hou = 03; $format = AM; } if ($Hou == 06){ $Hou = 04; $format = AM; } if ($Hou == 07){ $Hou = 05; $format = AM; } if ($Hou == 08){ $Hou = 06; $format = AM; } if ($Hou == 09){ $Hou = 07; $format = AM; } if ($Hou == 10){ $Hou = 08; $format = AM; } if ($Hou == 11){ $Hou = 09; $format = AM; } if ($Hou == 12){ $Hou = 10; $format = AM; } if ($Hou == 13){ $Hou = 11; $format = AM; } if ($Hou == 14){ $Hou = 12; $format = PM; } if ($Hou == 15){ $Hou = 01; $format = PM; } if ($Hou == 16){ $Hou = 02; $format = PM; } if ($Hou == 17){ $Hou = 03; $format = PM; } if ($Hou == 18){ $Hou = 04; $format = PM; } if ($Hou == 19){ $Hou = 05; $format = PM; } if ($Hou == 20){ $Hou = 06; $format = PM; } if ($Hou == 21){ $Hou = 07; $format = PM; } if ($Hou == 22){ $Hou = 08; $format = PM; } if ($Hou == 23){ $Hou = 09; $format = PM; } I am wondering if I should let the date be put into the db as 2001-15-10... [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Isn't date a reserved word that should not be used as a field name? It appeared that what was asked was if he should change the name of his field from date to date_1. It should definitely be changed if it is now called date. Jason Wong [EMAIL PROTECTED] said: On Wednesday 31 October 2001 01:31 am, Jason wrote: Here is my problem once again... =P I am wondering if I should change the date table to something other than date... maybe something like date_1? Would doing that resolve my issue, because of the fact that the date variable in php is function? Thanks in advance... What is the format of date as defined in your database? If date is of type DATE or DATETIME then $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date LIKE '%$date%'); should be changed to: $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date = '$date' ); hth -- Jason Wong Gremlins Associates www.gremlins.com.hk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP query on date field
Just to clear some things up... so instead of the long winded bit of code that was previously setup to change the format of the date for the date field in the db, I should use the 2 lines of code? Definately skeptical on this one... but you know more about this than I. Rick Emery [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Assuming you correct the hours calculation per my previous email, then: $format = ($Hou12?) PM : AM ; $Hou -= ($Hou12?) 12 : 0; And you can do away with all the constructs. -Original Message- From: Rick Emery Sent: Tuesday, October 30, 2001 2:09 PM To: 'Jason'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] PHP query on date field Jason, date(H) converts to a 24-hour clock. That is, 00 is 12 mid-night, 01 is 1 AM, 13 is 1 PM, 14 is 2 PM, 23 is 11 PM, etc. I do not understand the reasons for your computation that, say 00, is 10 PM. -Original Message- From: Jason [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 30, 2001 2:20 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] PHP query on date field Ok well I have made the changes and tested it out but using the search string 10/15/2001 still provided no results... here is the script that parses the date for entry into the database... $date = (date(m/d/Y)) ; #this date is used in the online database $A = (date(A)); $Hou = (date(H)); if ($Hou == 00){ $Hou = 10; $format = PM; } if ($Hou == 01){ $Hou = 11; $format = PM; } if ($Hou == 02){ $Hou = 12; $format = AM; } if ($Hou == 03){ $Hou = 01; $format = AM; } if ($Hou == 04){ $Hou = 02; $format = AM; } if ($Hou == 05){ $Hou = 03; $format = AM; } if ($Hou == 06){ $Hou = 04; $format = AM; } if ($Hou == 07){ $Hou = 05; $format = AM; } if ($Hou == 08){ $Hou = 06; $format = AM; } if ($Hou == 09){ $Hou = 07; $format = AM; } if ($Hou == 10){ $Hou = 08; $format = AM; } if ($Hou == 11){ $Hou = 09; $format = AM; } if ($Hou == 12){ $Hou = 10; $format = AM; } if ($Hou == 13){ $Hou = 11; $format = AM; } if ($Hou == 14){ $Hou = 12; $format = PM; } if ($Hou == 15){ $Hou = 01; $format = PM; } if ($Hou == 16){ $Hou = 02; $format = PM; } if ($Hou == 17){ $Hou = 03; $format = PM; } if ($Hou == 18){ $Hou = 04; $format = PM; } if ($Hou == 19){ $Hou = 05; $format = PM; } if ($Hou == 20){ $Hou = 06; $format = PM; } if ($Hou == 21){ $Hou = 07; $format = PM; } if ($Hou == 22){ $Hou = 08; $format = PM; } if ($Hou == 23){ $Hou = 09; $format = PM; } I am wondering if I should let the date be put into the db as 2001-15-10... [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Isn't date a reserved word that should not be used as a field name? It appeared that what was asked was if he should change the name of his field from date to date_1. It should definitely be changed if it is now called date. Jason Wong [EMAIL PROTECTED] said: On Wednesday 31 October 2001 01:31 am, Jason wrote: Here is my problem once again... =P I am wondering if I should change the date table to something other than date... maybe something like date_1? Would doing that resolve my issue, because of the fact that the date variable in php is function? Thanks in advance... What is the format of date as defined in your database? If date is of type DATE or DATETIME then $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date LIKE '%$date%'); should be changed to: $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date = '$date' ); hth -- Jason Wong Gremlins Associates www.gremlins.com.hk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] PHP query on date field
This is what I'm saying... I encourage you to try it and experiment. -Original Message- From: Jason [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 30, 2001 2:51 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] PHP query on date field Just to clear some things up... so instead of the long winded bit of code that was previously setup to change the format of the date for the date field in the db, I should use the 2 lines of code? Definately skeptical on this one... but you know more about this than I. Rick Emery [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Assuming you correct the hours calculation per my previous email, then: $format = ($Hou12?) PM : AM ; $Hou -= ($Hou12?) 12 : 0; And you can do away with all the constructs. -Original Message- From: Rick Emery Sent: Tuesday, October 30, 2001 2:09 PM To: 'Jason'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] PHP query on date field Jason, date(H) converts to a 24-hour clock. That is, 00 is 12 mid-night, 01 is 1 AM, 13 is 1 PM, 14 is 2 PM, 23 is 11 PM, etc. I do not understand the reasons for your computation that, say 00, is 10 PM. -Original Message- From: Jason [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 30, 2001 2:20 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] PHP query on date field Ok well I have made the changes and tested it out but using the search string 10/15/2001 still provided no results... here is the script that parses the date for entry into the database... $date = (date(m/d/Y)) ; #this date is used in the online database $A = (date(A)); $Hou = (date(H)); if ($Hou == 00){ $Hou = 10; $format = PM; } if ($Hou == 01){ $Hou = 11; $format = PM; } if ($Hou == 02){ $Hou = 12; $format = AM; } if ($Hou == 03){ $Hou = 01; $format = AM; } if ($Hou == 04){ $Hou = 02; $format = AM; } if ($Hou == 05){ $Hou = 03; $format = AM; } if ($Hou == 06){ $Hou = 04; $format = AM; } if ($Hou == 07){ $Hou = 05; $format = AM; } if ($Hou == 08){ $Hou = 06; $format = AM; } if ($Hou == 09){ $Hou = 07; $format = AM; } if ($Hou == 10){ $Hou = 08; $format = AM; } if ($Hou == 11){ $Hou = 09; $format = AM; } if ($Hou == 12){ $Hou = 10; $format = AM; } if ($Hou == 13){ $Hou = 11; $format = AM; } if ($Hou == 14){ $Hou = 12; $format = PM; } if ($Hou == 15){ $Hou = 01; $format = PM; } if ($Hou == 16){ $Hou = 02; $format = PM; } if ($Hou == 17){ $Hou = 03; $format = PM; } if ($Hou == 18){ $Hou = 04; $format = PM; } if ($Hou == 19){ $Hou = 05; $format = PM; } if ($Hou == 20){ $Hou = 06; $format = PM; } if ($Hou == 21){ $Hou = 07; $format = PM; } if ($Hou == 22){ $Hou = 08; $format = PM; } if ($Hou == 23){ $Hou = 09; $format = PM; } I am wondering if I should let the date be put into the db as 2001-15-10... [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Isn't date a reserved word that should not be used as a field name? It appeared that what was asked was if he should change the name of his field from date to date_1. It should definitely be changed if it is now called date. Jason Wong [EMAIL PROTECTED] said: On Wednesday 31 October 2001 01:31 am, Jason wrote: Here is my problem once again... =P I am wondering if I should change the date table to something other than date... maybe something like date_1? Would doing that resolve my issue, because of the fact that the date variable in php is function? Thanks in advance... What is the format of date as defined in your database? If date is of type DATE or DATETIME then $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date LIKE '%$date%'); should be changed to: $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date = '$date' ); hth -- Jason Wong Gremlins Associates www.gremlins.com.hk -- 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
Re: [PHP-DB] PHP query on date field
On Wednesday 31 October 2001 04:34 am, Jason wrote: This portion of the site was done by a previous employee and well you know the expression.. If its not broke don't fix it. Well now that I cannot query the db by the date it is now broke and I am still figuring out how MySQL is taking entries to the db so I figured this bit of information would maybe sum up the problem in the date field. I have been reading up on the date function in the MySQL book I have but somethings it just doesn't cover. So please excuse my being vague. Thanks, Jason What data type is your date field -- CHAR? INT? DATE? date(H) converts to a 24-hour clock. That is, 00 is 12 mid-night, 01 is 1 AM, 13 is 1 PM, 14 is 2 PM, 23 is 11 PM, etc. I do not understand the reasons for your computation that, say 00, is 10 A stab in the dark -- could it be some time-zone adjustment? Ok well I have made the changes and tested it out but using the search string 10/15/2001 still provided no results... The changes would only work if your date field is of data type DATE (or DATETIME). here is the script that parses the date for entry into the database... $date = (date(m/d/Y)) ; #this date is used in the online database I am wondering if I should let the date be put into the db as 2001-15-10... Changing the format of your dates to standard DATE or DATETIME *would* be a sensible thing to do :) -- Jason Wong Gremlins Associates www.gremlins.com.hk -- 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] What's wrong with my function? :(
Please could some take a look at this code and tell me why when I take my IF statements out of the function and put in them in the same place where I call the function from they work, but as soon as I replace them with the function name they don't? Appreciate any help. torrent Here's the code... // Define the rating's filter ?php function RatingFilter () { if ($br) {$sql.= and beg_rate = '2';} if ($ir) {$sql.= and int_rate = '2';} if ($ar) {$sql.= and adv_rate = '2';} if ($sr) {$sql.= and sbd_rate = '2';} } ? if ($search) { include ('logon-inc.php'); $sql = SELECT rsrt_name, ctry_name FROM resort_tbl WHERE ctry_name='$country[0]'; RatingFilter(); --- If I put 'if' statement here instead it works for ($n=1; count($country) $n; $n++){ $sql.= or ctry_name='$country[$n]'; RatingFilter(); -- Or here } . . . . } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP query on date field
The date field is varchar. And I believe it is for daylight savings. I am trying out a couple of things on a test date field so I will get back with you guys after I try your suggestions. And by the way I sincerely appriciate all the help you and Rick are giving me. Thanks again, jason Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... On Wednesday 31 October 2001 04:34 am, Jason wrote: This portion of the site was done by a previous employee and well you know the expression.. If its not broke don't fix it. Well now that I cannot query the db by the date it is now broke and I am still figuring out how MySQL is taking entries to the db so I figured this bit of information would maybe sum up the problem in the date field. I have been reading up on the date function in the MySQL book I have but somethings it just doesn't cover. So please excuse my being vague. Thanks, Jason What data type is your date field -- CHAR? INT? DATE? date(H) converts to a 24-hour clock. That is, 00 is 12 mid-night, 01 is 1 AM, 13 is 1 PM, 14 is 2 PM, 23 is 11 PM, etc. I do not understand the reasons for your computation that, say 00, is 10 A stab in the dark -- could it be some time-zone adjustment? Ok well I have made the changes and tested it out but using the search string 10/15/2001 still provided no results... The changes would only work if your date field is of data type DATE (or DATETIME). here is the script that parses the date for entry into the database... $date = (date(m/d/Y)) ; #this date is used in the online database I am wondering if I should let the date be put into the db as 2001-15-10... Changing the format of your dates to standard DATE or DATETIME *would* be a sensible thing to do :) -- Jason Wong Gremlins Associates www.gremlins.com.hk -- 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] What's wrong with my function? :(
On Tue, 30 Oct 2001, TorrentUK wrote: SNIP you either need to pass the variables to the function or use global variables in the function see http://www.php.net/manual/en/language.variables.scope.php Here's the code... // Define the rating's filter ?php function RatingFilter () { if ($br) {$sql.= and beg_rate = '2';} if ($ir) {$sql.= and int_rate = '2';} if ($ar) {$sql.= and adv_rate = '2';} if ($sr) {$sql.= and sbd_rate = '2';} } ? if ($search) { include ('logon-inc.php'); $sql = SELECT rsrt_name, ctry_name FROM resort_tbl WHERE ctry_name='$country[0]'; RatingFilter(); --- If I put 'if' statement here instead it works for ($n=1; count($country) $n; $n++){ $sql.= or ctry_name='$country[$n]'; RatingFilter(); -- Or here } . . . . } -- Charles F. McKnight IRC: sokudo | Doubt is not a pleasant condition, but [EMAIL PROTECTED] ICQ: 2794793 | certainty is absurd. [EMAIL PROTECTED] PGP: 0x20A5BCE5 | - Voltaire [ http://chucksays.mywebsitesucks.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] What's wrong with my function? :(
I'm new to PHP but one thing I think might be happening is that maybe the changes aren't being made to a global (I'm a Java programmer) $sql so they aren't being kept. Does it actually break or is it not appending the additional string? I'd try printing out the $sql and see what you're getting - possibly at different stages of the program - like before and after you call your function. Good luck! -Natalie -Original Message- From: TorrentUK [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, October 30, 2001 3:50 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] What's wrong with my function? :( Please could some take a look at this code and tell me why when I take my IF statements out of the function and put in them in the same place where I call the function from they work, but as soon as I replace them with the function name they don't? Appreciate any help. torrent Here's the code... // Define the rating's filter ?php function RatingFilter () { if ($br) {$sql.= and beg_rate = '2';} if ($ir) {$sql.= and int_rate = '2';} if ($ar) {$sql.= and adv_rate = '2';} if ($sr) {$sql.= and sbd_rate = '2';} } ? if ($search) { include ('logon-inc.php'); $sql = SELECT rsrt_name, ctry_name FROM resort_tbl WHERE ctry_name='$country[0]'; RatingFilter(); --- If I put 'if' statement here instead it works for ($n=1; count($country) $n; $n++){ $sql.= or ctry_name='$country[$n]'; RatingFilter(); -- Or here } . . . . } -- 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] What's wrong with my function? :(
Yep, that'll be it. Thanks for the help. :) torrent Charles F. McKnight [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Tue, 30 Oct 2001, TorrentUK wrote: SNIP you either need to pass the variables to the function or use global variables in the function see http://www.php.net/manual/en/language.variables.scope.php Here's the code... // Define the rating's filter ?php function RatingFilter () { if ($br) {$sql.= and beg_rate = '2';} if ($ir) {$sql.= and int_rate = '2';} if ($ar) {$sql.= and adv_rate = '2';} if ($sr) {$sql.= and sbd_rate = '2';} } ? if ($search) { include ('logon-inc.php'); $sql = SELECT rsrt_name, ctry_name FROM resort_tbl WHERE ctry_name='$country[0]'; RatingFilter(); --- If I put 'if' statement here instead it works for ($n=1; count($country) $n; $n++){ $sql.= or ctry_name='$country[$n]'; RatingFilter(); -- Or here } . . . . } -- Charles F. McKnight IRC: sokudo | Doubt is not a pleasant condition, but [EMAIL PROTECTED] ICQ: 2794793 | certainty is absurd. [EMAIL PROTECTED] PGP: 0x20A5BCE5 | - Voltaire [ http://chucksays.mywebsitesucks.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] Learning PHP Sessions
?php /* Hi, I'm new to PHP and am having trouble understanding how to use PHP sessions. My book tells in near the beginning how to start them and register session variables, but I can't figure out how to destroy a session or later read those session variables. I'm also trying to do this across frames, but can't even get it to work within a single page. Here's what I've learned so far and what my problems are: */ /* To start a session */ session_start(); /* To register a session variable */ session_register(myvar); $myvar = some value; /* PROBLEM #1: From the above commands, I get a $PHPSESSID that seems to be globally available for use, but I cannot seem to read my values back out of the registered session variable from anywhere... I tried: */ print $myvar\n; /* and absolutely nothing is printed */ /* To destroy a session */ session_destroy(); /* PROBLEM #2: This says there is no session to destroy. It's rather strange because I can still print the $PHPSESSID value.. I've attached my code... */ ? ?php /*= Check for New User Session =*/ if(!isset($PHPSESSID)) { session_start(); session_register(UserName); session_register(UserPage); $UserName = guest; $UserPage = Home; }; /*= Main Switchboard for Pages =*/ include includes/bodyhead.html; switch($action) { case Home: ShowHome(); break; case Login: ShowLogin(); break; case AuthUser: AuthUser($UserName, $UserPassword); break; case Logout: ShowLogout(); break; default: ShowMessage(Service Not Yet Implemented); break; } include includes/bodyfoot.html; /*= Function To Show Home Page =*/ function ShowHome() { include includes/home.html; } /*= Function To Show Login Page =*/ function ShowLogin() { print form type=put action=right.php\n; print input type=hidden name=action value=AuthUser\n; print table border=1 width=100%\n; print trtd bgcolor=yellow align=centerUSER AUTHORIZATION/td/tr\n; print /table\n; print table align=center\n; print tr\n; print tdfont color=yellowbUser Name:/b/font/td\n; print td align=centerinput type=text name=UserName length=16 maxlength=16/td\n; print /tr\n; print tr\n; print tdfont color=yellowbPassword:/b/font/td\n; print td align=centerinput type=password name=UserPassword length=16 maxlength=16/td\n; print /tr\n; print tr\n; print td align=center /td\n; print td align=centerinput type=submit name=UserLogin value='USER LOGIN'/td\n; print /tr\n; print /table\n; print table border=1 width=100%\n; print trtd bgcolor=yellow align=centerUNAUTHORIZED ENTRY IS PUNISHABLE BY LAW/td/tr\n; print /table\n; print /form\n; } /*= Function Authenticate User (from Login Page) =*/ function AuthUser($User, $User) { if($User == guest) { ShowMessage(For guest users, authorization is not required. However, priviledges are limited.); } else { ShowMessage(Authorization Feature Not Yet Implemented); } } /*= Function To Logout User =*/ function ShowLogout() { ShowMessage(Your Session Has Been Terminated.\nThank You for Properly Logging Out, $UserName!); session_destroy(); } /*= Function To Show Generic Messages =*/ function ShowMessage($message) { print br\n; print table border=2 align=center\n; print trtd align=centerfont color=yellow$message/font/td/tr\n; print /table\n; } ? -- 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] any extra work need to make php mysql function available?
hi all, i am using redhat. i am able to run php script thro' webpage. but, failed to use mysql functions in php. is there any extra work need to initialize these functions? my code and error are shown as below, code ? echo text generated by php br\n; echo $rmnum; printf( b4 connected br\n); $link=mysql_pconnect(192.168.0.101, chaze, sochausee) or die (failed); mysql_select_db(stjohn); ? result text generated by php b4 connected Fatal error: Call to undefined function: mysql_pconnect() in /home/chaze/public_html/sjc/energy.php on line 7 any comments? thanks, jim -- 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] Learning PHP Sessions
You do not need to destroy session variables. You can session_unregister() them, if you'd like. $session_start(); $foo = Hi; session_register(foo); Next page... if (isset($foo)) { echo $foo; // will print Hi if done correctly session_unregister(foo); } Sessions are automatically destroyed when the client-side browser shuts down and the garbage collector runs. If you want to force a session deletion, use session_destroy(). Use it with caution, though, since it's usually better to let the garbage collector do the work periodically instead of cleaning up each session individually. Check out http://www.php.net/manual/en/ref.session.php 'Luck -Szii - Original Message - From: Matthew Tedder [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 30, 2001 12:30 PM Subject: [PHP-DB] Learning PHP Sessions ?php /* Hi, I'm new to PHP and am having trouble understanding how to use PHP sessions. My book tells in near the beginning how to start them and register session variables, but I can't figure out how to destroy a session or later read those session variables. I'm also trying to do this across frames, but can't even get it to work within a single page. Here's what I've learned so far and what my problems are: */ /* To start a session */ session_start(); /* To register a session variable */ session_register(myvar); $myvar = some value; /* PROBLEM #1: From the above commands, I get a $PHPSESSID that seems to be globally available for use, but I cannot seem to read my values back out of the registered session variable from anywhere... I tried: */ print $myvar\n; /* and absolutely nothing is printed */ /* To destroy a session */ session_destroy(); /* PROBLEM #2: This says there is no session to destroy. It's rather strange because I can still print the $PHPSESSID value.. I've attached my code... */ ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP query on date field
On Wednesday 31 October 2001 05:11 am, Jason wrote: The date field is varchar. And I believe it is for daylight savings. I am trying out a couple of things on a test date field so I will get back with you guys after I try your suggestions. And by the way I sincerely appriciate all the help you and Rick are giving me. Thanks again, In that case your original: date like '%$date%' should work as long as $date is formatted the same as what is stored in the db. Really, you should convert your date field into DATE or DATETIME then you can use all the nifty date/time functions that MySQL provides! regards -- Jason Wong Gremlins Associates www.gremlins.com.hk -- 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] very strange problem for mysql query
hi, i found very strange problem on mysql query. here is my code and result... very strange! pls help ...! thanks, * code *** ? $link=mysql_pconnect(192.168.0.101, chaze, apple) or die (failed); mysql_select_db(stjohn); $query=select * from user a, data b where a.room_num = b.room_num and a.room_num = . $room_num; $result=mysql_query($query); //$row=mysql_num_rows($result); $row=mysql_fetch_object($result); if ($row-id != $id) { printf(wrong id!); header(location:http://www.php.net;); mysql_close($link); exit(); } printf(update: %s, room no.: %sbr, $row-update_time, $row-room_num ); printf(update: %s, room no.: %sbr, $row-update_time, $row-room_num ); printf(%s %s $sbr, $row-name, $row-room_num, $row-update_time); printf(%s %s $sbr, $row-name, $row-update_time, $row-room_num); mysql_close($link); ? * result *** update: 20011029120609, room no.: 9001 update: 20011029120609, room no.: 9001 jim lo 9001 jim lo 20011029120609 -- 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] very strange problem for mysql query
On Wednesday 31 October 2001 14:42 pm, JIM wrote: hi, i found very strange problem on mysql query. here is my code and result... very strange! pls help ...! thanks, [snip] printf(%s %s $sbr, $row-name, $row-room_num, $row-update_time); printf(%s %s $sbr, $row-name, $row-update_time, $row-room_num); These should be: printf(%s, %s, %sbr, .); regards -- Jason Wong Gremlins Associates www.gremlins.com.hk -- 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] FREE MEMBERSHIP (ADULTS) 10113
TO THE 9 BEST PORN SITES ON THE WEB http://www.geocities.com/horstyqse/ JUST CLICK THE ABOVE LINK TO GET YOUR FREE HARDCORE ACCEESS AND I'LL SEE YOU INSIDE WARNING: This site contains explicit sexual material. You must be 18 or older to proceed. To be taken off this list please respond with GET ME OFF in the sub ject HEY SEXY, COME PLAY WITH ME GET YOUR FREE VIP PASS -- 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]