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; ?> Quote Link to comment 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()); Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.