RE: [PHP-DB] Corrupted query results in memory.
This morning I figured out how to replicate the issue. Issue a double request for the mysql result set. Due to the Ajaxy nature of my web app it isn't the same as a double HTTPRequest of POST, as it is requesting a result set back from the database twice in a row before the response is collected. I think we'd have to see how you are doing your Ajaxy implementation. This is the lowest level of Ajax I use now http://www.xajaxproject.org/docs/xajax-in-10-minutes.php If it's asynchronous, how can a second request wonk it up? Did you roll your own using XMLHttpRequest directly? We run Apache 2.2 on FreeBSD 6.1.x, I am currently running MySQL 5.0.xgiven the fact that I can repeat and reproduce the problem by either hitting my refresh button twice, or by hitting my javascript/Ajax button twice before I get my first responsecan anyone point me in a direction to narrow down why my code might be doing this? I am using PDO with prepared statements and MySQL stored procedures to produce my result sets... if you asked me yesterday, I'd have said I wasn't doing any thing that MySQL couldn't handle...but apparently that isn't the case... I'm still rooting for MySQL could handle it. I wouldn't think it necessary, but maybe you need to obtain table locks for your needs. --MAE Alumnus rocking the high compensation to effort ratio in this CS world of no-accountability-maybe-we'll-fix-it-in-the-next-release-but-pay-to-find-out-beotch. Thank you Billy boy. _ Climb to the top of the charts! Play Star Shuffle: the word scramble challenge with star power. http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_oct -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] mysql data truncation does not cause an error to be thrown
I agree. And maybe there is an error reporting level that can be set in mysql. But you should also start sanitizing user input. And do it on the server side (even if you do some on the client side). Maybe your form's action script could be sent to directly and your javascript validation sidestepped. Date: Thu, 8 Nov 2007 15:50:38 + From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: php-db@lists.php.net Subject: Re: [PHP-DB] mysql data truncation does not cause an error to be thrown Hiya I could check the length of the field against the entry data and javascript myself out of trouble but i was more worried that there is no error or message when mysql clearly returns one saying i've truncated this yet php ignores it completely. It should fail or know about the truncation at least ! Cheers for your reply though :-) Andy Instruct ICC wrote: Using mysql_query if i try to force more data than a field can have the data is truncated yet no error is throw at all. Is there a way round this ? Cheers Andy This isn't exactly what you want to hear, but how about validating your input before submitting a query? _ Boo! Scare away worms, viruses and so much more! Try Windows Live OneCare! http://onecare.live.com/standard/en-us/purchase/trial.aspx?s_cid=wl_hotmailnews -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Help yourself to FREE treats served up daily at the Messenger Café. Stop by today. http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid=TXT_TAGLM_OctWLtagline
RE: [PHP-DB] mysql data truncation does not cause an error to be thrown
Using mysql_query if i try to force more data than a field can have the data is truncated yet no error is throw at all. Is there a way round this ? Cheers Andy This isn't exactly what you want to hear, but how about validating your input before submitting a query? _ Boo! Scare away worms, viruses and so much more! Try Windows Live OneCare! http://onecare.live.com/standard/en-us/purchase/trial.aspx?s_cid=wl_hotmailnews
RE: [PHP-DB] mysql data truncation does not cause an error to be thrown
Maybe tell the list the exact solution? File/variable/setting? Cheers. I figured it out it was the mysql install not php :-) cheers for your help though :-) Vandegrift, Ken wrote: You may want to check the my.ini setting for the table type you are using and see if there is a setting in there that needs to be enabled. I thought I read once that truncation may happen silently depending on the my.ini setting. _ Peek-a-boo FREE Tricks Treats for You! http://www.reallivemoms.com?ocid=TXT_TAGHMloc=us
RE: [PHP-DB] Phpmailer sending duplicate messages...
while($row = mysqli_fetch_assoc($result)) { extract($row); $mail-IsSMTP(); $mail-Host = host.com; $mail-From = [EMAIL PROTECTED]; $mail-From = [EMAIL PROTECTED]; $mail-FromName = Company; $mail-AddAddress($email, $Contact); $mail-IsHTML(True); $mail-Subject = $Subject; $mail-Body = $PR; $mail-WordWrap = 50; if(!$mail-Send()) { echo 'Message was not sent.'; echo 'Mailer error: ' . $mail-ErrorInfo; } else { echo 'Message has been sent.'; } } I bet your while loop over the extract is causing you to have: user1 user1, user2 user1, user2, user3,... Instead of polluting your symbol table, can't you just use the email field? $email = $row['theEmailField']; I've used code like this back in the day (Notice how the array $arr was unset): $recipients = [EMAIL PROTECTED][EMAIL PROTECTED][EMAIL PROTECTED]; parse_str($recipients); for($i=0; $icount($arr); $i++){ mail($arr[$i], $subject, $message, From: $sender\n. Reply-To: $sender\n); } unset($arr); _ Boo! Scare away worms, viruses and so much more! Try Windows Live OneCare! http://onecare.live.com/standard/en-us/purchase/trial.aspx?s_cid=wl_hotmailnews
RE: [PHP-DB] Phpmailer sending duplicate messages...
You're re-using the same message each time around the loop. Each time you call AddAddress you're, erm, adding another address. You either need to reset the recipients or reset the message each time round the loop (I'm not familiar with Phpmailer so I have no idea how to do this). -Stut Stut is right. If you put $mail = new PHPMailer(); within the while loop, you should be okay. _ Climb to the top of the charts! Play Star Shuffle: the word scramble challenge with star power. http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_oct
RE: [PHP-DB] Phpmailer sending duplicate messages...
Stut and Instruct Just found this which clears the email after each loop. $mail-ClearAddresses(); Thanks for you input. Good find. Now the list can benefit. _ Climb to the top of the charts! Play Star Shuffle: the word scramble challenge with star power. http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_oct
[PHP-DB] Cumulative DATEDIFFs and JOINs
I have a table to track when a project has reached a certain state, structured like so: id projectId timeStamp state Say: Project1 on 2007-09-01 is at state started Project2 on 2007-10-01 is at state started Project3 on 2007-10-15 is at state started Project1 on 2007-10-20 is at state completed Project2 on 2007-10-25 is at state completed Is there a single query to find the duration of the completed projects when the started date and the completed date are between a specific date range? For starters, I was thinking of LEFT JOINing on the projectId (since I need dates from the same project), to get the start project date and the end project date. But how do I link them? Do I also need sub queries? SELECT DATEDIFF(end.timeStamp, start.timeStamp) AS Duration FROM MyTable AS `start` LEFT JOIN MyTable AS `end` ON start.projectId = end.projectId {AND start.state = 'started' AND end.state = 'completed' ??? This may actually work LOL -- I don't have data yet and it started making sense when I began to compose this question.} WHERE start.timeStamp BETWEEN '2007-01' AND '2007-10' AND end.timeStamp BETWEEN '2007-01' AND '2007-10' ORDER BY start.timeStamp ASC And what if there are entries where the project is temporarily stopped? Project2 on 2007-10-05 is at state stopped Project2 on 2007-10-07 is at state started (resumed) Project3 on 2007-10-18 is at state stopped (and never resumed) I'm using MySQL 4.1. _ Boo! Scare away worms, viruses and so much more! Try Windows Live OneCare! http://onecare.live.com/standard/en-us/purchase/trial.aspx?s_cid=wl_hotmailnews -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] ER Diagramming tool for MySQL
Maybe we should keep top posting for consistency in this particular thread? Case Studio 2 does not appear to be free. Toad seems to be Windows only and no ER Diagramming? I use dbdesigner, but manually draw the relations (I believe this is since MySQL = 3.23.58; MySQL = 4.0.17 did not have referential integrity?) I'll have to see how to setup 4.1 for this. Hi Costa, Thanks for ur comment. I also found 2 tools for this regard, 01) Case Studio 2 (http://www.newfreedownloads.com/Software-Developer/Miscellaneous/CASE-Studio-2.html ) 02) Toad (http://www.quest.com/toad-for-mysql/ ) Thanks, Lasitha. From: Rafael Costa Pimenta [mailto:[EMAIL PROTECTED] Sent: Sunday, October 21, 2007 1:50 AM To: Lasitha Alawatta Subject: Re: [PHP-DB] ER Diagramming tool for MySQL you could use dbdesign, download in http://superdownloads.uol.com.br/download/140/dbdesigner/ 2007/10/20, Lasitha Alawatta [EMAIL PROTECTED]: Hi All, Does anyone know of a GOOD ER Diagramming tool for MySQL? I would preferably a free/open source one. Regards, Lasitha DOTW DISCLAIMER: This e-mail and any attachments are strictly confidential and intended for the addressee only. If you are not the named addressee you must not disclose, copy or take any action in reliance of this transmission and you should notify us as soon as possible. If you have received it in error, please contact the message sender immediately. This e-mail and any attachments are believed to be free from viruses but it is your responsibility to carry out all necessary virus checks and DOTW accepts no liability in connection therewith. This e-mail and all other electronic (including voice) communications from the sender's company are for informational purposes only. No such communication is intended by the sender to constitute either an electronic record or an electronic signature or to constitute any agreement by the sender to conduct a transaction by electronic means. _ Help yourself to FREE treats served up daily at the Messenger Café. Stop by today. http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid=TXT_TAGLM_OctWLtagline
RE: [PHP-DB] mssql_connect not working from command line [RESOLVED]
Thanks for informing me that CGI and CLI may use a different php.ini and that they may be compiled differently. The admin finally admitted that he ran a yum update which overwrote the manually compiled CLI version. The reason I missed it was that the build date of the latest CLI version was earlier than when the scripts broke. _ Climb to the top of the charts! Play Star Shuffle: the word scramble challenge with star power. http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_oct
RE: [PHP-DB] Special chars UTF-8: sometimes ok, sometimes wrong
Hi. Working with PHP 4.4 and mySQL 4.1, I've got some texts stored in a UTF-8 table with special chars. I serve a UTF-8 header within my HTML, Apache is configured to serve UTF-8 and PHP scripts are saved in UTF-8 charset. However, sometimes I get 'España' and other times 'Espa�a'. The difference? I press F5 (Refresh) bottom on my web browser (I use Firefox and Internet Explorer). This is the first time I experience this issue. When I have suffered problems with special chars I use utf8_decode or utf8_encode, but I always try to store text data in UTF-8 charset and serve them always with UTF-8 PHP scripts. However, this is a very odd issue, since it happens only with text taken from DataBase, but not from texts written in scripts :( Any similar experience? Yes. MySQL 4.1.20-log with columns in utf8_unicode_ci Collation. PHP 4.3.10 serving web pages with charset=UTF-8 read from the MySQL column above. In the html page: If I echo utf8_encode($fieldFromDB) it looks good. If I remove utf8_encode, it looks bad. After submitting the html form, if I send an html email (setting charset=UTF-8) or store it back into the utf8_unicode_ci Collation column, it looks bad. HOWEVER, I am using characters from the extended ascii table http://asciitable.com/ We have people from different countries using the same scripts and database. I thought utf8_unicode_ci should handle all or most. What should I be using? Also, in the html form, I have method=post enctype=multipart/form-data. Is there a form property needed as well? _ Boo! Scare away worms, viruses and so much more! Try Windows Live OneCare! http://onecare.live.com/standard/en-us/purchase/trial.aspx?s_cid=wl_hotmailnews
RE: [PHP-DB] php maximum characters in text field
Does anyone know how to look for a Curly quote or typographer's quotation mark. They are being submitted on our form under customer description. I have created a function that replaces a regular straight quotation mark ($title = str_replace(', , $title);), but do not know what to put in as the look for for the curly mark! How do you know they are submitting ? Can you copy from that source, then paste it into your str_replace function? Or since it seems to be a two-byte character (I didn't see it at asciitable.com): Maybe you need http://php.he.net/manual/en/ref.mbstring.php mb_ereg_replace _ Peek-a-boo FREE Tricks Treats for You! http://www.reallivemoms.com?ocid=TXT_TAGHMloc=us -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] php maximum characters in text field
varchar maxs out at 255 characters just for clarification, mysql varchar easily can hold more than 255 characters (I remember it was the case in ancient 3.x times) only if one wants to store newlines he must use type text just my 2 cent News to me, so I check the docs. http://dev.mysql.com/doc/refman/5.0/en/char.html Apparently varchar can easily hold more than 255 chars IF YOU USE VERSION 5.0.3 OR LATER. Values in VARCHAR columns are variable-length strings. The length can be specified as a value from 0 to 255 before MySQL 5.0.3, and 0 to 65,535 in 5.0.3 and later versions. We assume the OP is using form method=post if he is checking the $_POST variable. Good catch (OKi98) if he is not. _ Windows Live Hotmail and Microsoft Office Outlook – together at last. Get it now. http://office.microsoft.com/en-us/outlook/HA102225181033.aspx?pid=CL100626971033
RE: [PHP-DB] php maximum characters in text field
I am starting to believe it is NOT the character length that is causing the problem. We have received other orders with more in it than that, and they came in ok. I think there may be something in the input that php does not like. I've been searching for code that will clean up input, possibly preg_replace? Was the order received, but the text was shorter than expected? Or was the order not received at all? Check your mysql query log. It may show failed queries where bad characters made the query fail, perhaps using ' or ? Use mysql_real_escape_string. _ Climb to the top of the charts! Play Star Shuffle: the word scramble challenge with star power. http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_oct -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] php maximum characters in text field
Do you see those apostrophes in that text? They need to be properly escaped. Date: Mon, 15 Oct 2007 15:09:52 -0400 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; php-db@lists.php.net Subject: RE: [PHP-DB] php maximum characters in text field Here is the exact text he submitted: Please initiate phone lines in the following locations in the Leon County Civic Center to support our home Men's and Women's Basketball games. Meeting room B: activate 4 lines on the North Wall and 4 lines on the South Wall - all lines should have long distance with credit card only. Courtside: 1 - Please re-activate saved phone number 224-8790 along the West side press row. Please include long distance on the phone. 2 - Please activate the ISDN line on the East side scorer's table. 3 - Please re-activate the saved phone number 224-1155 on the East side scorer's table. Work room: Please activate 2 lines in the work room, one for telephone and one for fax. - Both with long distance capability Please call, e-mail or fax the telephone numbers associated with each location to Stuart Pearce at 644-4694 (office), 645-3278 (fax), [EMAIL PROTECTED] Thank you, Stuart Pearce _ Help yourself to FREE treats served up daily at the Messenger Café. Stop by today. http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid=TXT_TAGLM_OctWLtagline
RE: [PHP-DB] FW: Kesalahan posting: Don Komo
Date: Fri, 12 Oct 2007 11:29:27 -0400 From: [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] FW: Kesalahan posting: Don Komo Why do I get this everytime I post? I think Don Komo registered to this PHP list with the private email address [EMAIL PROTECTED] So since we are not a member of the googlegroup, we get these notices. The same kind of notice that anyone would get if they posted to a list for which they had not yet registered. I think he should be forced to unregister this email address. And/or be advised that it has been dropped for this reason. _ Peek-a-boo FREE Tricks Treats for You! http://www.reallivemoms.com?ocid=TXT_TAGHMloc=us
RE: [PHP-DB] Remote DB Connection: Pros and Cons?
Have any of you tried running a PHP website using a remote database connection? Yes. If you mean the web server is on 1 box and the database server is on a 2nd box. We currently have an in-house PHP website driven by a PostgreSQL database that is HEAVILY administered within the office with an administration sister site (also PHP). We have our database servers within our medium sized company and internal web servers as well as a hosting company hosting external web servers. All access at least 1 of our internal database servers. We wouldn't want the 3rd party host to actually have our database {although remote replication is (re)considered once in a while}. Problem: the office connection is having trouble keeping up with the website traffic. Our IT guys want to outsource the whole server to a co-location facility, but the administrators don't want the extra lag on the admin site. Is it feasible to host the database and admin site in the office, but outsource the website and connect to the office database remotely? Is there any other way to do this? Tony Missed that before I hit reply. This _IS_ what we do. Cons: Some stranger at the 3rd party hosting site (or someone hacked into your remote web server) could see the passwords used to connect to your internal database. The connection between the remote web server and local database is still a performance/connectivity issue. Fun with firewall rules. _ Climb to the top of the charts! Play Star Shuffle: the word scramble challenge with star power. http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_oct
RE: [PHP-DB] Data not fetching in the textfield.
Date: Wed, 26 Sep 2007 09:33:40 -0700 From: [EMAIL PROTECTED] echo(input name=\input1\ type=\text\ value=$rows[0]); If what you want rendered in html should have quotes like so: input name=input1 type=text value=some value Double quote the value like so: echo(input name=\input1\ type=\text\ value=\ . $rows[0] . \); and escape $rows[0] in case it contains any double quotes thusly (or with some other escape function): echo(input name=\input1\ type=\text\ value=\ . addcslashes($rows[0], '') . \); _ News, entertainment and everything you care about at Live.com. Get it now! http://www.live.com/getstarted.aspx
RE: [PHP-DB] Pages not fully loading
Date: Fri, 21 Sep 2007 23:42:40 +0100 From: [EMAIL PROTECTED] I have tried putting print (test line x) throughout the script, which just showed me it was failing sometimes before the mail function, but not always, sometimes in the middle of a loop to create a select box it just stopped rendering. john How did it fail before the mail function? Can you verify that the loop to create the select box always creates valid html? _ Can you find the hidden words? Take a break and play Seekadoo! http://club.live.com/seekadoo.aspx?icid=seek_wlmailtextlink
RE: [PHP-DB] Pages not fully loading
This new hotmail has really screwed up the formatting, sorry. I have seen where errors were not displayed on a PHP production server, so I would get a blank screen. Check the web server error logs as was suggested. Also try to display all errors just for testing: http://php.net/error_reporting // Report all PHP errors (bitwise 63 may be used in PHP 3) error_reporting(E_ALL); // Same as error_reporting(E_ALL); ini_set('error_reporting', E_ALL); If you are using functions that buffer the output, maybe you need to properly flush it? I haven't run into this in PHP, but I have in C/C++, and PHP _does_ have output buffering. _ Kick back and relax with hot games and cool activities at the Messenger Café. http://www.cafemessenger.com?ocid=TXT_TAGLM_SeptWLtagline -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mssql_connect not working from command line
From: Chris [EMAIL PROTECTED] Instruct ICC wrote: You said something about 2 different configuration files. I'm just making up this name, but do you have something like: CLI_Configuration File (php.ini) Path = /etc/cli_php.ini as well as: Configuration File (php.ini) Path = /etc/php.ini I use debian and it places them in different folders: /etc/php5/apache2/php.ini and /etc/php5/cli/php.ini cat /etc/redhat-release Fedora Core release 6 (Zod) dmesg | head Linux version 2.6.20-1.2962.fc6 ([EMAIL PROTECTED]) (gcc version 4.1.1 20070105 (Red Hat 4.1.1-51)) #1 SMP Tue Jun 19 19:27:14 EDT 2007 php -version PHP 5.1.6 (cli) (built: May 9 2007 11:47:50) The strange thing is that it used to work up until apparently Jul 31. And the /etc/php.ini had been changed well before that (and had been working on both web and cli). 1) A web page referencing mssql_connect works in a browser. 2) A cronjob (CLI) referencing mssql_connect which had been working now does not work. New Info: 3) Attempting to run the web page from the command line fails on at mssql_connect. 4) A CLI script using file(The web page) actually works?!?!?!?! _ Gear up for Halo® 3 with free downloads and an exclusive offer. http://gethalo3gear.com?ocid=SeptemberWLHalo3_MSNHMTxt_1 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Executing a query in the future
From: Mark Bomgardner [EMAIL PROTECTED] Is there something that can run in the background that can run a page at varying intervals? markb Unix/Mac/Linux: cron Windows: task scheduler _ Kick back and relax with hot games and cool activities at the Messenger Café. http://www.cafemessenger.com?ocid=TXT_TAGHM_SeptHMtagline1 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mssql_connect not working from command line
From: Chris [EMAIL PROTECTED] Instruct ICC wrote: Both your command php -i | grep 'php.ini' and find / -name php.ini 2/dev/null report the single /etc/php.ini Hmm. do a php -i and look for: Configuration File (php.ini) Path = That will tell you where it's looking for the file. Maybe you need to create that file (or just symlink it to the other one). I get Configuration File (php.ini) Path = /etc/php.ini You said something about 2 different configuration files. I'm just making up this name, but do you have something like: CLI_Configuration File (php.ini) Path = /etc/cli_php.ini as well as: Configuration File (php.ini) Path = /etc/php.ini Then I could see having CLI_Configuration File exist and reference _some_ file. _ Get a FREE small business Web site and more from Microsoft® Office Live! http://clk.atdmt.com/MRT/go/aub0930003811mrt/direct/01/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mssql_connect not working from command line
However, a web page that includes the same file with the mssql_connect call still works fine, and now it makes sense that I see mssql is still enabled in phpinfo. The apache version of the php.ini file is different to the cli version. Make sure you are looking at the right one. On debian I have two separate directories for each config - /etc/php5/apache2/ and /etc/php5/cli/ Try this: php -i | grep 'php.ini' from the command line to work out which php.ini to look at. Both your command php -i | grep 'php.ini' and find / -name php.ini 2/dev/null report the single /etc/php.ini Is there something in php.ini that would: 1) Allow web pages to work with mssql_connect 2) Allow the command line to use other PHP functions 3) Disallow mssql_connect from a script run from the command line _ Can you find the hidden words? Take a break and play Seekadoo! http://club.live.com/seekadoo.aspx?icid=seek_hotmailtextlink1 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mssql_connect not working from command line
I had cronjobs running fine on Linux which included a file which called mssql_connect. Today when I run the cronjob script directly from the command line, I get: PHP Fatal error: Call to undefined function mssql_connect() in /the/included/file.php on line # Fatal error: Call to undefined function mssql_connect() in /the/included/file.php on line # I also notice that the cronjob started failing 1 month ago. The file is owned by the command line user and apache is in its group and vice versa. However, a web page that includes the same file with the mssql_connect call still works fine, and now it makes sense that I see mssql is still enabled in phpinfo. The admin says nothing changed. Is there a setting that must have been changed to disallow this function from working on the command line? I'm using PHP Version 5.1.6 and /etc/php.ini has changed 2 months ago and the cronjob worked since then. _ Gear up for Halo® 3 with free downloads and an exclusive offer. http://gethalo3gear.com?ocid=SeptemberWLHalo3_MSNHMTxt_1 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] date problems
From: rDubya [EMAIL PROTECTED] Thanks for the help so far guys!! Not helping though. I have the date contained in the database as timestamp (-MM-DD HH:MM:SS). Do you really need to pull events from the database which are not in your range of interest? This will only slow down your processing time. Instead, you could be looping over valid events and not using your incorrect check_date function. If you insist upon using a check_date function on the PHP side (which you claimed to have worked in the past), on the format -MM-DD HH:MM:SS where the first Y is at index 0, then substr($mysql_timestamp, 4, 2) is not the month MM, it is -M. You need 5,2. Your other offsets are also wrong. Rather than debugging your check_date function, you should just pull the info you actually need from the database (even to the point of not selecting *, and instead naming specific fields if you really don't need all fields), and remove your check_date function. Then your while loop will loop over only valid events. Also, although this doesn't affect the running of your code, your variable names show a misunderstanding of what parameters you are passing and receiving. $sql = SELECT...; $resultResource = mysql_query($sql);// or just $result = mysql_query($sql); if($result != false){ while($event_data = mysql_fetch_assoc($result)) { //Do something with a valid event instead of checking if it is valid now on the PHP side. } } Too bad you are not on MySQL 5, because the SQL query could have been even closer to the phrasing you posted to the list it is between now and three weeks from now, similar to Mike's reply as: $sql = SELECT * FROM `EVENTS` WHERE `event_city` = ' . $city . ' AND `theEventDate` BETWEEN NOW() AND DATE_ADD( NOW(), INTERVAL 3 WEEK) ORDER BY `theEventDate` ASC; But for your MySQL version, WEEK is unavailable and you need INTERVAL 21 DAY (watch the unit versus the expr; DAY not DAYS -- WEEK not WEEKS) http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html#function_date-add http://dev.mysql.com/doc/refman/4.1/en/comparison-operators.html But if you are not familiar with BETWEEN or DATE_ADD, then the way I posted is another way to skin this cat. $sql = SELECT * FROM `EVENTS` WHERE `event_city` = ' . $city . ' AND TO_DAYS( `theEventDate` ) = TO_DAYS( NOW() ) AND TO_DAYS( `theEventDate` ) = TO_DAYS( NOW() ) + 21 ORDER BY `theEventDate` ASC; http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html#function_to-days And while not trusting your indexing, rewrite short_date as: function short_date ($mysql_timestamp) { return date(D M j, $mysql_timestamp); } or this is probably a 1-liner in the while loop: while...//I'm already using valid events due to my query ... date(D M j, $event_data['theEventDate']) ... _ Test your celebrity IQ. Play Red Carpet Reveal and earn great prizes! http://club.live.com/red_carpet_reveal.aspx?icid=redcarpet_hotmailtextlink2 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] date problems
From: Instruct ICC [EMAIL PROTECTED] And while not trusting your indexing, rewrite short_date as: My short_date rewrite was also wrong. So it looks like you will have to learn those offsets for this function if you do it on the PHP side. But you could also do it on the MySQL side. _ Get a FREE small business Web site and more from Microsoft® Office Live! http://clk.atdmt.com/MRT/go/aub0930003811mrt/direct/01/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] date problems
From: rDubya [EMAIL PROTECTED] My problem is that I have events dated for Sep 2007 and on, and yet they all come up as being on Dec 7 to 9, 2006.. any ideas? rDubya How about having MySQL only return the events you are interested in? SELECT yourEventFields FROM theTable WHERE TO_DAYS( theEventDate ) = TO_DAYS( NOW() ) AND TO_DAYS( theEventDate ) = TO_DAYS( NOW() ) + 21 I like theEventDate to be in the format -MM-DD http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_to-days _ A place for moms to take a break! http://www.reallivemoms.com?ocid=TXT_TAGHMloc=us -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] $db=new mysqli fails while $db=mysqli_connect succeeds in PHP/MySQL
From a php-general thread earlier: ?php $db=new mysqli('localhost','whil','secret','test'); ? generates: Fatal error: Call to undefined function new mysqli() in index.php on line 24 while ?php $conn = mysqli_connect(localhost,whil,secret,test); echo 'conn good: '.$conn.' :very good indeedbr'; ? generates success: conn good: Object id #1 :very good indeed The book I'm working with (PHP MySQL Web Dev, Welling/Thompson) specifically defines the 'new mysqli' syntax. So I'm guessing I don't have something configured right? Whil I don't see a constructor for mysqli at http://php.net/mysqli Your book is probably defining a class that you didn't include/require. For example, search for the following at the php page above: require_once('safe_mysqli.php'); try { $mysql = new safe_mysqli You will need to have the class your book is defining before you can instantiate such an object. _ Find a local pizza place, movie theater, and more .then map the best route! http://maps.live.com/default.aspx?v=2ss=yp.bars~yp.pizza~yp.movie%20theatercp=42.358996~-71.056691style=rlvl=13tilt=-90dir=0alt=-1000scene=950607encType=1FORM=MGAC01 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] $db=new mysqli fails while $db=mysqli_connect succeeds in PHP/MySQL
I don't see a constructor for mysqli at http://php.net/mysqli; My bad. It's right there at the top. Must be a case of the Mooondayz. _ Now you can see trouble before he arrives http://newlivehotmail.com/?ocid=TXT_TAGHM_migration_HM_viral_protection_0507 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Spam Post Defense / ID spam form posts
Can server1 receive a web page form post from remoteAttacker, identify it as spam (or a DoS or DDoS attack), hand off the socket to multiple threads on multiple servers owned by server1's owner, return multiple responses to remoteAttacker which normally would have been a single response returned by server1, so that server1 is not busy responding to remoteAttacker and is able to handle legitimate requests? Technically? Legally? The boss doesn't want to use a CAPTCHA on the form but wants us to identify it without additional user input. Also, can a form post be run through an email spam filter to identify it as spam? Do you have any ideas to detect spam form posts? I'm tracking the spam posts in an attempt to find a pattern I can use to detect them. _ Find a local pizza place, movie theater, and more .then map the best route! http://maps.live.com/default.aspx?v=2ss=yp.bars~yp.pizza~yp.movie%20theatercp=42.358996~-71.056691style=rlvl=13tilt=-90dir=0alt=-1000scene=950607encType=1FORM=MGAC01 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Spam Post Defense / ID spam form posts
Sorry, wrong list (although I'm tracking them in a DB). Advice appreciated... _ Learn.Laugh.Share. Reallivemoms is right place! http://www.reallivemoms.com?ocid=TXT_TAGHMloc=us -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Friday losing it: JOINS
I have a 1 table query which returns less rows than when I have a 2 table query using an implicit inner join or an explicit left join. Select some, fields From table1 Where part like '123%' /* returns 2225 rows */ Select activePart, some, fields From table1, table2 Where part like '123%' and part = activePart /* implicit inner join returns 2270 rows */ Select activePart, some, fields From table1 left join table2 On part = activePart Where part like '123%' /* explicit left join also returns 2270 rows */ Fields part and activePart are not in table2 and table1 respectively. I assume I am forgetting something basic this friday. Why would I get more rows from the above? I might expect more rows from an outer join. Am I writing an outer join? After a quick break in the john, I'm thinking perhaps table2 is not holding unique parts as I was told it would. But I'll post this for your thoughts before I check on that, in case you have other insights. _ http://imagine-windowslive.com/hotmail/?locale=en-usocid=TXT_TAGHM_migration_HM_mini_2G_0507 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: Best Practices? [PHP-DB] Queries from two databases
From: Joaquín [EMAIL PROTECTED] I need query tables that are in two different databases mysql_select_db(DB1, $conn_1); mysql_select_db(DB2, $conn_2); $result_t1 = mysql_query(SELECT * FROM `Table1inDB1`,$conn_1); $row_t1 = mysql_fetch_assoc($result_t1); $result_t2 = mysql_query(SELECT * FROM `Table2inDB2`,$conn_2); $row_t2 = mysql_fetch_assoc($result_t2); Although Joaquín said his issue is [Fixed], I write these queries as: SELECT * FROM DB1.TableInDB1 SELECT * FROM DB2.TableInDB2 (with and without link_identifiers I believe), so I was wondering about best practices. I can see if you already have code written without the DB in the FROM clause, it could be easier to have multiple links. I haven't really used multiple links, but I ran into issues with multiple databases and consistently setting the correct DB, so now if I know I'll be using multiple DB's, I just write the query with the DB in the FROM clause. (A prior fix was to select the DB before each query. But if it was already selected, it seemed like a waste {according to my by inspection profiler}. So I started using the DB in the FROM clause.) Are there any recommendations regarding best practices between: 1) using multiple links and table.field (or table) notation versus 2) database.table.field (or database.table) notation? _ Local listings, incredible imagery, and driving directions - all in one place! http://maps.live.com/?wip=69FORM=MGAC01 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DBF + PHP
From: Luke [EMAIL PROTECTED] echo getcwd() . \n; chdir('c:\\temp'); echo getcwd() . \n; chdir('c:\\Przewozy\\BAZY'); echo getcwd() . \n; $db = dbase_open(c:\\Przewozy\\BAZY\\Ceny.dbf, 0); Just a quick guess/suggestion: Single tick quotes ' are taken literally and double tick quotes allow expansion. $aVariable = 0; echo '$aVariable';//$aVariable echo $aVariable;//0 Maybe change the chdir to use double quotes or remove the double backslash? Especially if your dbase_open works with double quotes and the double backslash. _ http://im.live.com/messenger/im/home/?source=hmtextlinkjuly07 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DBF + PHP
Becouse I wont read files, exactly *.dbf, from local machine, not from server. I have no problem with read or changing directory, if database is located on server. Thanks for any suggestion. So you are running PHP on your local machine localhost which happens to be a Windows machine, and also was compiled with the --enable-dbase option? Are you only dealing with 1 machine and it is not a UNIX flavor? If you had a web page served from a UNIX box with an html file field (like Upload this file) that you view from a browser on a Windows box, which browses the local machine, the different file path styles could make sense. Or if dbase_open could connect to a remote server like fopen. If you are trying to use dbase_open on your local machine to connect to a remote machine's test.dbf, it looks like this function does not work across servers. Maybe use fopen and friends to get the remote file? _ http://imagine-windowslive.com/hotmail/?locale=en-usocid=TXT_TAGHM_migration_HM_mini_2G_0507 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DBF + PHP
$db = dbase_open(c:\\Przewozy\\BAZY\\Ceny.dbf, 0); Or if you can map the drive, then you should be able to use a path like above using the mapped drive or \\server\volume\path\test.dbf Can you call up the file in Windows Explorer? _ http://imagine-windowslive.com/hotmail/?locale=en-usocid=TXT_TAGHM_migration_HM_mini_pcmag_0507 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL user anHTACCESSusername not found?
From: Instruct ICC [EMAIL PROTECTED] Why is this second log entry present? I don't see any place where I ask MySQL to authenticate an HTACCESS username. It came to me. The very fact that we are using mod_auth_mysql in the Apache web server means that Apache is trying to authenticate anHTACCESSusername in the MySQL database. I suppose since the web server could not connect to the database, anHTACCESSusername was not found after some timeout. _ http://imagine-windowslive.com/hotmail/?locale=en-usocid=TXT_TAGHM_migration_HM_mini_2G_0507 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL user anHTACCESSusername not found?
In my apache web server error log, I see the following: [Fri Jul 13 11:19:55 2007] [error] [client an.ip.addr.ess] MySQL ERROR: Can't connect to MySQL server on 'mysql.server.ip.address' (110) [Fri Jul 13 11:19:55 2007] [error] [client an.ip.addr.ess] MySQL user anHTACCESSusername not found: /path/to/webpage I can understand the first log entry; the client machine cannot contact the server machine at the moment. (It cleared up without any changes as far as I can tell. Perhaps a slow network?). What I don't understand is why MySQL appears to be trying to authenticate the HTACCESS username. Once the user logs in to the webpage with his HTACCESS username, the script connects to the MySQL server with the same MySQL login credentials for everyone. Even with register_globals on (which I can't turn off), I am explicitly setting the $username variable in mysql_connect() which I call as mysql_connect($server, $username, $password) to use to connect to MySQL. I'm on PHP 4.3.10, MySQL 4.1.20, sql.safe_mode is Off, mysql.default_user had no value. Doesn't the web server own the process anyway? From the docs: mysql_connect username The username. Default value is defined by mysql.default_user. In SQL safe mode, this parameter is ignored and the name of the user that owns the server process is used. mysql.default_user string The default user name to use when connecting to the database server if no other name is specified. Doesn't apply in SQL safe mode. Why is this second log entry present? I don't see any place where I ask MySQL to authenticate an HTACCESS username. Perhaps there is a default setting I can turn off? Thanks. _ http://imagine-windowslive.com/hotmail/?locale=en-usocid=TXT_TAGHM_migration_HM_mini_2G_0507 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php