Re: [PHP-DB] Page refresh and database updation
On Tuesday 26 September 2006 15:31, Tamkhane, Pravin wrote: > Hi All, > I am a PHP newbie. I am using HTTP POST request to send some data to Apache > and then using MySql to store that information. Once information is stored > in MySql DB successfully, I display a result page. But the problem I am > facing is that, if I refresh the result page displayed after database > updation, the information is stored again in database which I don't want > to. Please guide me on how I can avoid duplication of information in > database on refreshing the page. Thanks in advance! > > Regards, > Pravin Hi, Store last postted data into some where in $_SESSION (for example $_SESSION['last']) then, when user posts a data. check the last posted data if there are same data reject to record db if not record data to db. for example (I assume your form field names uses name='postf[fieldName]) Your Php code ... $process = 'pass'; if(is_array($_SESSION['last']) { if($_SESSION['last']['fieldName'] == $_REQUEST['postf']['fieldName']) { $strProcess = 'stop'; } ... put there other fields } if($process == 'pass') { do your sql statement $_SESSION['last'] = $_REQUEST['postf']; } Regards Sancar -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Page refresh and database updation
Hi All, I am a PHP newbie. I am using HTTP POST request to send some data to Apache and then using MySql to store that information. Once information is stored in MySql DB successfully, I display a result page. But the problem I am facing is that, if I refresh the result page displayed after database updation, the information is stored again in database which I don't want to. Please guide me on how I can avoid duplication of information in database on refreshing the page. Thanks in advance! Regards, Pravin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Page refresh and database updation
Tamkhane, Pravin wrote: Hi All, I am a PHP newbie. I am using HTTP POST request to send some data to Apache and then using MySql to store that information. Once information is stored in MySql DB successfully, I display a result page. But the problem I am facing is that, if I refresh the result page displayed after database updation, the information is stored again in database which I don't want to. Please guide me on how I can avoid duplication of information in database on refreshing the page. Thanks in advance! Regards, Pravin You probly want to use a seperate script to build the results, or even a PEAR template mechanism. /cs -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Page refresh and database updation
I'm sure there are many ways... a few off the top of my head. a). if there is some field or combination of fields that guarantee uniqueness then you can test for their existence before you insert. b). When you insert the first time set some session variable to something, and then don't insert if that session variable exists. c). have some middle page that does your insertion and then immediately redirects to another page which displays results, but has not more POST data associated with it, so refreshing that page will not cause a re-post of your data. HTH -B Tamkhane, Pravin wrote: Hi All, I am a PHP newbie. I am using HTTP POST request to send some data to Apache and then using MySql to store that information. Once information is stored in MySql DB successfully, I display a result page. But the problem I am facing is that, if I refresh the result page displayed after database updation, the information is stored again in database which I don't want to. Please guide me on how I can avoid duplication of information in database on refreshing the page. Thanks in advance! Regards, Pravin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Page refresh and database updation
Hi, one thing u can do is u can have a primary key the table you are inserting so that duplication wont be done. If thats not possible redirect the page to the results page after updating the post data than showing him the results in the action page ( action i mean where the form action has been written ) raj On Tue, 26 Sep 2006, Tamkhane, Pravin wrote: Hi All, I am a PHP newbie. I am using HTTP POST request to send some data to Apache and then using MySql to store that information. Once information is stored in MySql DB successfully, I display a result page. But the problem I am facing is that, if I refresh the result page displayed after database updation, the information is stored again in database which I don't want to. Please guide me on how I can avoid duplication of information in database on refreshing the page. Thanks in advance! Regards, Pravin -- The secret to creativity is knowing how to hide your sources. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Page refresh and database updation
You can redirect the page to the result page after the data is saved, using header("Location: successpage.php"). I've used this on several sites. It's a little extra work but does prevent the reposting of data. Another option is to use AJAX to send the data to the webserver and then have the javascript open the result page after the update is complete. I do this on several of my webpages and it works great. >Tamkhane, Pravin wrote: >> Hi All, >> I am a PHP newbie. I am using HTTP POST request to send some data to >> Apache and then using MySql to store that information. Once information >> is stored in MySql DB successfully, I display a result page. But the >> problem I am facing is that, if I refresh the result page displayed >> after database updation, the information is stored again in database >> which I don't want to. Please guide me on how I can avoid duplication of >> information in database on refreshing the page. Thanks in advance! >> >> Regards, >> Pravin >You probly want to use a seperate script to build the results, or even a >PEAR template mechanism. > >/cs > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Unicode error with PostgreSQL
I'm getting the following error when PHP tries to insert a Unicode character (the problem word is resume with the accents) into a PostgreSQL database: pg_exec(): Query failed: ERROR: Invalid UNICODE character sequence found (0xe97375) I can't figure out why I'm getting the error. The HTML form is utf-8 and the database is UNICODE, but I'm still getting the error. Is there some problem with the PHP library? Is there a PHP setting that controls character encoding within scripts? Any help would be appreciated. Thanks in advance, Tony
[PHP-DB] Error when trying to connecting to an Oracle database
I am trying to use a program written in PHP but connect to an Oracle database. We have a function as follows: function dbconnect($db, $username, $password) { global $siteadmin; global $db; // $bob = @mysql_connect($db, $username, $password); //$bob= oci_connect($username, $password, $db); // mysql_select_db($db, $bob); $bob = oci_connect("", "", "devl"); echo $bob; return $bob; } where is replaced with a username and is replaced with a password. We get the following error: Fatal error: Call to undefined function: oci_connect() in /www/WEBUSERS/ics2004/public_html/PHP/Project Manager/dba_copy(1).php on line 52 Line 52 is $bob = oci_connect("", "", "devl"); Can anyone tell me why I am getting this error? Thanks Jan Smith Programmer Analyst Indiana State University Terre Haute, Indiana Phone: (812) 237-8593 Email: [EMAIL PROTECTED] *** This email, and any attachments, thereto, is intended only for use by the addressee(s) named herein and may contain privileged and/or confidential information. If you are not the intended recipient of this email, you are hereby notified that any dissemination, distribution or copying of this email, and any attachments thereto, is strictly prohibited. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Error when trying to connecting to an Oracle database
Hi Janet, This is a PHP 5 only function. Are you running PHP 5? If not, try using ocilogon() instead. If you are running 5, then maybe the Oracle library wasn't included when PHP was compiled. HTH, Tony On 9/26/06 2:13 PM, "Janet Smith" <[EMAIL PROTECTED]> wrote: > I am trying to use a program written in PHP but connect to an Oracle > database. > > We have a function as follows: > > function dbconnect($db, $username, $password) > { >global $siteadmin; >global $db; > >// $bob = @mysql_connect($db, $username, $password); >//$bob= oci_connect($username, $password, $db); >// mysql_select_db($db, $bob); >$bob = oci_connect("", "", "devl"); > echo $bob; > return $bob; > } > > where is replaced with a username and is replaced with a > password. We get the following error: > > Fatal error: Call to undefined function: oci_connect() in > /www/WEBUSERS/ics2004/public_html/PHP/Project Manager/dba_copy(1).php on > line 52 > > Line 52 is $bob = oci_connect("", "", "devl"); > > Can anyone tell me why I am getting this error? > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Unicode error with PostgreSQL
So does that mean I will always get that error? There's got to be a way around that. Is there at least a way to detect invalid characters before I try to insert? Tony On 9/26/06 1:17 PM, "Niel Archer" <[EMAIL PROTECTED]> wrote: > PHP isn't multibyte aware by default. > > Niel > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Unicode error with PostgreSQL
Hi Tony You can use the multibyte aware string functions for processing. There is also a way to make it use UTF-8 encoding, but I forget how just now. I had the same problem with a MySQL db a while back. Niel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Error when trying to connecting to an Oracle database
Hi Janet, This is a PHP 5 only function. Are you running PHP 5? If not, try using ocilogon() instead. If you are running 5, then maybe the Oracle library wasn't included when PHP was compiled. HTH, Tony On 9/26/06 2:13 PM, "Janet Smith" <[EMAIL PROTECTED]> wrote: > I am trying to use a program written in PHP but connect to an Oracle > database. > > We have a function as follows: > > function dbconnect($db, $username, $password) > { >global $siteadmin; >global $db; > >// $bob = @mysql_connect($db, $username, $password); >//$bob= oci_connect($username, $password, $db); >// mysql_select_db($db, $bob); >$bob = oci_connect("", "", "devl"); > echo $bob; > return $bob; > } > > where is replaced with a username and is replaced with a > password. We get the following error: > > Fatal error: Call to undefined function: oci_connect() in > /www/WEBUSERS/ics2004/public_html/PHP/Project Manager/dba_copy(1).php on > line 52 > > Line 52 is $bob = oci_connect("", "", "devl"); > > Can anyone tell me why I am getting this error? > > Thanks > > > Jan Smith > Programmer Analyst > Indiana State University > Terre Haute, Indiana > Phone: (812) 237-8593 > Email: [EMAIL PROTECTED] > > ** > * > This email, and any attachments, thereto, is intended only for use by > the addressee(s) named herein and may contain privileged and/or > confidential information. If you are not the intended recipient of this > email, you are hereby notified that any dissemination, distribution or > copying of this email, and any attachments thereto, is strictly > prohibited. > ** > * -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Unicode error with PostgreSQL
So does that mean I will always get that error? There's got to be a way around that. Is there at least a way to detect invalid characters before I try to insert? Tony On 9/26/06 1:17 PM, "Niel Archer" <[EMAIL PROTECTED]> wrote: > PHP isn't multibyte aware by default. > > Niel > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] list field from .dbf
Dear All, i need convert my data from .dbf ( visual foxpro ) to mysql database first at all i open .dbf and list the field some error with function dbase_get_record it's not support list field ( memo type ) my list data have lost where field type is memo may help me to get field (memo) regards, Rafael Ramdhani The information transmitted is intended only for the person or the entity to which it is addressed and may contain confidential and/or privileged material. If you have received it by mistake please notify the sender by return e-mail and delete this message including any of its attachments from your system. Any use, review, reliance or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change. The views expressed herein do not necessarily represent those of PT Astra International Tbk and should not be construed as the views, offers or acceptances of PT Astra International Tbk.
[PHP-DB] list field from .dbf
Dear All, i need convert my data from .dbf ( visual foxpro ) to mysql database first at all i open .dbf and list the field some error with function dbase_get_record it's not support list field ( memo type ) my list data have lost where field type is memo may help me to get field (memo) regards, Rafael Ramdhani The information transmitted is intended only for the person or the entity to which it is addressed and may contain confidential and/or privileged material. If you have received it by mistake please notify the sender by return e-mail and delete this message including any of its attachments from your system. Any use, review, reliance or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change. The views expressed herein do not necessarily represent those of PT Astra International Tbk and should not be construed as the views, offers or acceptances of PT Astra International Tbk.
[PHP-DB] $_SERVER
Is there a predefined variable that will tell me the resolution of the browser that is looking at my site? EXAMPLE 1024 X 768 OR 800 X 600 Ron
Re: [PHP-DB] $_SERVER
Ron Piggott (PHP) wrote: Is there a predefined variable that will tell me the resolution of the browser that is looking at my site? You have to do this through javascript, php can't capture that information. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php