| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Member Join Date: Jan 2007
Posts: 98
![]() | Where is the mistake in here? Hello all, I could not solve this problem. There is a mistake in here but i do not know where. Please help PHP Code: |
| |
| | THREAD STARTER #3 (permalink) |
| NamePros Member Join Date: Jan 2007
Posts: 98
![]() | There is no error. it is just not recording to the database. If I do like this it works PHP Code: |
| |
| | #4 (permalink) |
| NamePros Member Join Date: Feb 2007 Location: Surabaya - Indonesia
Posts: 27
![]() | Did you use auto-increment and primary key or unique on `id` field? if yes, that would be the problem. Try using these : PHP Code: |
| |
| | #6 (permalink) |
| Senior Member Join Date: Nov 2005 Location: on a oil rig just off Ireland
Posts: 1,408
![]() ![]() ![]() ![]() ![]() | change PHP Code: PHP Code:
__________________ You design in photoshop, I code into valid XHTML/CSS. Professional PSD, PNG or HTML to tableless XHTML/CSS designs. For more info, send me a PM. |
| |
| | #8 (permalink) | ||||
| Domains my Dominion Join Date: Aug 2005 Location: Web 1.0
Posts: 9,552
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Also the INTO keyword is not needed here, remove it: Code: $query = "insert articles (`id`, `type`, `title`, `description`, `links`) values('0', '".$_REQUEST['type']."','".$_REQUEST['title']."','".$desc."','".$link."')"; Is ID an auto-incremented field or primary key ? If it's an auto-incremented value remove it from your insert statement. Finally you are performing inserts based on $_REQUEST variables which is dangerous. 1. You need to check the input values, otherwise people can manipulate them and enter anything, including values that will crash your script. 2. You need to check if there are any single quotes (') that need escaping. Have a look at mysql_real_escape_string: http://php.net/mysql_real_escape_string. Again your script could crash if special characters are not properly handled. ????: NamePros.com http://www.namepros.com/showthread.php?t=295130 My advice would be: at the beginning of your script check the $_REQUEST values and assign them to variables. Then check if they are not empty, have the expected format etc (regular expressions are very helpful for this).
__________________ NameNewsletter.com - free lists of available domain names ZoneFiles.net (beta) - ccTLD and gTLD droplists | ||||
| |
| | #9 (permalink) | ||||
| Senior Member Join Date: Aug 2005 Location: East Yorkshire, England
Posts: 2,689
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Yes, do as tm said and get the error with mysql_error(); and tell us what it is. | ||||
| |
| | #10 (permalink) | ||||
| Buy my domains. Join Date: Feb 2006
Posts: 2,796
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| ||||
| |
| | THREAD STARTER #12 (permalink) |
| NamePros Member Join Date: Jan 2007
Posts: 98
![]() | Thanks for help. But the problem is in here. If i do not write this, it works fine but if i write this it does not work. I do not have a chance to check what is wrong. It is not possible. This page is getting called by a windows application. If the code is wrong , I do not get any error message. If the code is right, it is recording to the database. Thanks all PHP Code: |
| |
| | #13 (permalink) |
| NamePros Regular Join Date: May 2004 Location: NYC
Posts: 236
![]() ![]() ![]() | try changing this PHP Code: PHP Code: |
| |
| | THREAD STARTER #14 (permalink) | ||||
| NamePros Member Join Date: Jan 2007
Posts: 98
![]() |
Wawwwwww. Thank you very much man. It worked. I was trying to sort this out for 3 days. Thanks again. | ||||
| |