| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| NamePros Member | 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: |
| |
| | #3 (permalink) |
| NamePros Member | 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 | 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 | 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 | Quote:
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. 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).
__________________ Buy now - MassDeveloper.com $500 | |
| |
| | #9 (permalink) | |
| Barru. | Quote:
Yes, do as tm said and get the error with mysql_error(); and tell us what it is.
__________________ | |
| |
| | #10 (permalink) | |
| Buy my domains. | Quote:
| |
| |
| | #12 (permalink) |
| NamePros Member | 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: |
| |
| | #14 (permalink) | |
| NamePros Member | Quote:
Wawwwwww. Thank you very much man. It worked. I was trying to sort this out for 3 days. Thanks again. | |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |