You are here: Re: Form Will Not Update MySQL DB « PHP Programming Language « IT news, forums, messages
Re: Form Will Not Update MySQL DB

Posted by Jerry Stuckle on 08/13/07 12:08

FrobinRobin wrote:
> yeah agree with petersprc - seems you have the input name on the form
> as 'fullname' but you are using $_REQUEST['consumer_fullname']??
>
> The best way to solve ur own problem (and I make these silly mistakes
> ALL the time) is to
> a) echo your query to the page and try it directly in your database
> b) use print_r($any_var); (with <pre></pre> tags for formatting) to
> see the contents of arrays (i.e. use print_r($_POST);)
>
> Also I dont see how you are using the "$result_of_updated_file"
> variable as the script doesnt show any conditional for it. Personally
> I use the "mysql_affected_rows" function and a conditional:
>
> if(mysql_affected_rows($result) > 0)
> {
> echo "success";
> }
> else
> {
> echo mysql_error();
> }
>
> Also I've just started using foreach($_POST) loop to validate the
> whole post, as well as unset($_POST['input_name']) to remove unwanted
> posts.. it's a really sweet way of running functions on all form
> variables.
>

This is not necessarily accurate. If you update a row with the same
information that originally was in the row, MySQL will not change the
row (no need to, is there?), and mysql_affected_rows() will return zero.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация