php-general Digest 31 Aug 2007 16:34:36 -0000 Issue 4992
php-general Digest 31 Aug 2007 16:34:36 - Issue 4992 Topics (messages 261558 through 261563): PHP/MySQL not playing nicely. Server drops connection. . . 261558 by: Michael Williams 261562 by: brian Re: How to show proper time to users from around the world 261559 by: Per Jessen Chisimba Framework Release 261560 by: Paul Scott PHP Developer Required 261561 by: Greg Gay Re: Reload page after form submit 261563 by: brian Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Hi All, I recently installed PHP, APACHE, MYSQL per the method at the following site: http://switch.richard5.net/isp-in-a-box-v2/installing-mysql-on-mac-os-x/ . . .I then attempted to connect to a database (but without executing any commands on it), and I keep receiving the following error: Safari can’t open the page “http://localhost/~michwill/folder/ validate_event.php” because the server unexpectedly dropped the connection, which sometimes occurs when the server is busy. You might be able to open the page later. I'm really not sure what the problem is or what to do about it. Can anyone help? I've ensured that all passwords and ports are correct. I've also tried using MAMP, but it keeps telling me that I can't access the database with the connect commands I'm using (although I've adjusted them. Anyway, any help would be much appreciated. Regards, Michael---End Message--- ---BeginMessage--- Michael Williams wrote: Hi All, I recently installed PHP, APACHE, MYSQL per the method at the following site: http://switch.richard5.net/isp-in-a-box-v2/installing-mysql-on-mac-os-x/ . . .I then attempted to connect to a database (but without executing any commands on it), and I keep receiving the following error: Safari can’t open the page “http://localhost/~michwill/folder/ validate_event.php” because the server unexpectedly dropped the connection, which sometimes occurs when the server is busy. You might be able to open the page later. I'm really not sure what the problem is or what to do about it. Can anyone help? I've ensured that all passwords and ports are correct. I've also tried using MAMP, but it keeps telling me that I can't access the database with the connect commands I'm using (although I've adjusted them. Anyway, any help would be much appreciated. Are you sure that Apache is running and accepting connections to /~michwill? Does a regular HTML page show up ok? Have you checked the server error log? What does your script look like where it connects? Does it simply die() without a message? Try creating a test script with header('Content-type: text/plain') at the top. Then print out messages after each step. (beginning of script, opening a DB connection, etc.) How are you accessing the database? Whichever method, test for errors after each step and echo out any info there. eg. with MDB2: $mdb2 = MDB2::connect($dsn, $options); if (PEAR::isError($mdb2)) { die ('Failed to connect: ' . $mdb2-getMessage()); } If the MDB2 object is kosher but you have an SQL error: $result = $stmnt-execute($data); if (PEAR::isError($result)) { die('bad query: ' . $result-getUserInfo()); } Of course, you shouldn't blindly echo out this sort of thing on a production server. brian ---End Message--- ---BeginMessage--- Hemanth wrote: Hi friends, Is there a solution to showing the proper time and date at user browsers and also recording proper USER times in the database operations in mysql I think it's better to record UTC times only, but display them according to the users timezone. You can do that by telling mysql which timezone you want per session. http://dev.mysql.com/doc/refman/5.0/en/time-zone-support.html /Per Jessen, Zürich ---End Message--- ---BeginMessage--- The next release of the Chisimba PHP5 framework is now available. Major enhancements included in this release are: - Memcache support - Better caching of language items - Improved database performance - Bug fixes - Better code documentation - API docs - First draft of the Chisimba Book for Developers - XML-RPC API for the Blog module - Context improvements - Code cleanup and, of course, new modules to add onto your installation! Please take a look, download it and give it a test drive! Chisimba, for those that don't know it already, is a PHP5 framework made in Africa, for Africa. It is a collaboration between around 16 African Universities, as well as around 35 active developers from around the continent. It can be downloaded from AVOIR at: http://cvs2.uwc.ac.za/chisimba_releases/chisimba_framework_1-0-4.tgz
php-general Digest 1 Sep 2007 05:05:25 -0000 Issue 4993
php-general Digest 1 Sep 2007 05:05:25 - Issue 4993 Topics (messages 261564 through 261581): Re: Reload page after form submit 261564 by: Afan Pasalic 261577 by: brian regular expression question 261565 by: Matthew Lasar 261566 by: Per Jessen 261567 by: Matthew Lasar 261569 by: Per Jessen PHP + PDO + MySQL + Stored Procedure + PREPARE = Problem 261568 by: Uzed Is a small memory footprint better for a php script? 261570 by: Mark 261571 by: Robert Cummings Re: About Session And Cookies 261572 by: Dan Re: text to HTML 261573 by: Dan 261578 by: M. Sokolewicz Re: help with session 261574 by: Dan Re: Which CAPTCHA is the besta? 261575 by: Dan Re: for loop inside a switch 261576 by: Dan 261579 by: Robert Cummings 261581 by: jekillen How to implement Open-ID on my web server? 261580 by: Ronald Wiplinger Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- brian wrote: Instruct ICC wrote: From your rough code, I'd say the OP always needs the select block (just remove the else keyword and keep the block) for the current info at the present page refresh/load. But I'd like clarification on how the OP thinks about it. That's close, i think. But the select isn't necessary if the user has submitted a post because, either way, $first $last will be set to the latest values. The problem that i see is here: if (isset($_POST)) This will always return TRUE. It should rather be: if (isset($_POST['name_of_your_submit_btn'])) or some other form element, at least. I don't know if this was simply because it was a rough draft of the code or even if it's the cause of the problem (which i still don't quite understand) but, anyway ... brian nope. ONLY when form with method POST is submitted. if you open the page first time else block will be executed. though, I agree it's much better to have if(isset($_POST['SubmitForm']) and $_POST['SubmitForm'] == 'Submit') where input type=Submit name=SubmitForm value=Submit but, as I said earlier, it's not the code, just an idea. -afan ---End Message--- ---BeginMessage--- Afan Pasalic wrote: brian wrote: The problem that i see is here: if (isset($_POST)) This will always return TRUE. It should rather be: if (isset($_POST['name_of_your_submit_btn'])) or some other form element, at least. I don't know if this was simply because it was a rough draft of the code or even if it's the cause of the problem (which i still don't quite understand) but, anyway ... brian nope. ONLY when form with method POST is submitted. if you open the page first time else block will be executed. though, I agree it's much better to have if(isset($_POST['SubmitForm']) and $_POST['SubmitForm'] == 'Submit') where input type=Submit name=SubmitForm value=Submit but, as I said earlier, it's not the code, just an idea. ?php if (isset($_POST)) { print('What did i tell you?'); } ? ---End Message--- ---BeginMessage--- Hello: I've adapted this regular expression script from a book, but I'm not clear why it works. $email = [EMAIL PROTECTED]; $pattern = /[EMAIL PROTECTED]@([-a-z0-9]+\.)+[a-z]{2,}/; ___ if ( preg_match($pattern,$email) ) { print yes! . $email . matches!; } else { print no match; } ___ When I run this script, I get the yes! [EMAIL PROTECTED] matches! statement. But I don't understand why the second half of the regular expression works. I'm talking about this part: @([-a-z0-9]+\.)+[a-z]{2,}/; why is it able to detect repeated sections of the email address after @ that are separated by periods? like @email.alaska.com . It looks to me like it's only looking for one example of that pattern. Does the () allow an unlimited number of patterns to pass? thanks for any and all guidance Matthew Matthew Lasar || llfcc.net ---End Message--- ---BeginMessage--- Matthew Lasar wrote: But I don't understand why the second half of the regular expression works. I'm talking about this part: @([-a-z0-9]+\.)+[a-z]{2,}/; why is it able to detect repeated sections of the email address after @ that are separated by periods? like @email.alaska.com . It looks to me like it's only looking for one example of that pattern. Does the () allow an unlimited number of patterns to pass? No, but the following '+' does. /Per Jessen, Zürich ---End Message--- ---BeginMessage--- At 11:32 AM 8/31/2007, Per Jessen wrote: Matthew Lasar wrote: But I don't understand why the second half of the regular expression works. I'm talking about this part: @([-a-z0-9]+\.)+[a-z]{2,}/; why is it able to detect repeated sections of the email address after @ that are