nelquintin Posted January 14, 2008 Share Posted January 14, 2008 why wont this update the database? <? include("include/session.php"); ?> <? $propertyid=$_GET['propertyid']; $query=" SELECT * FROM propertys WHERE propertyid='$propertyid'"; $result=mysql_query($query); $num=mysql_num_rows($result); $i=0; while ($i < $num) { $picture=mysql_result($result,$i,"picture"); $price=mysql_result($result,$i,"price"); .... $username=mysql_result($result,$i,"username"); ?> <form action="propertys_change_record.php" method="post"> <input type="hidden" name="ud_propertyid" value="<? echo "$propertyid" ?>"><br> Image:<br> <input type="File" name="ud_picture" size="<? print "$picture"?>"><br> Price:<br> <input type="text" name="ud_price" value="<? print "$price"?>"><br> ....... Username:<br> <input type="text" name="ud_username" value="<? print "$username"?>"></br> <br><input type="Submit" value="Update"> </form> <? ++$i; } ?> and... <? include("include/session.php"); ?> <?php $ud_propertyid=$_POST['ud_propertyid']; $ud_picture=$_POST['ud_picture']; ... $ud_username=$_POST['ud_username']; mysql_query(" UPDATE propertys SET picture='$ud_picture' ,price='$ud_price' ,ref='$ud_ref' ,type='$ud_type' ,erf='$ud_erf' ,description='$ud_description' ,bed='$ud_bed' ,bath='$ud_bath' ,gar='$ud_gar' ,username='$ud_username' WHERE propertyid='$ud_propertyid'"); echo "Record Updated"; ?> <br> <a href="main.php">Back to main page</a> </body> </html> <? ++$i; ?> Link to comment https://forums.phpfreaks.com/topic/85943-solved-why-wont-this-update-the-database-no-error-message/ Share on other sites More sharing options...
tinker Posted January 14, 2008 Share Posted January 14, 2008 In case's like this add a 'or die()' statement to your query: $res = mysql_query($s, $conn) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/85943-solved-why-wont-this-update-the-database-no-error-message/#findComment-438781 Share on other sites More sharing options...
adam291086 Posted January 14, 2008 Share Posted January 14, 2008 also add error_reporting(E_ALL); to the top of the php scripts. Also echo out all the $_POST variable to ensure information is being submitted to your php page Link to comment https://forums.phpfreaks.com/topic/85943-solved-why-wont-this-update-the-database-no-error-message/#findComment-438784 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.