kikilahooch Posted August 23, 2006 Share Posted August 23, 2006 I'm trying to update records that are stored in my db on products. what I am doing is I am clicking on an image of a product to update. When I click on a product it brings me to my admin_update2.php page and passes in the value of shopName and prodId. I can see from the url that these values are being passed through ok. However I am getting an error sayingParse error: parse error, unexpected $ in /home/c/ciaracousins/public_html/admin_update2.php on line 143line 143 is just a blank line at the very bottom of my page. Any idea what is wrong with this??[code]<?php include("db.php"); $prodId = $_GET['prodId']; $sql = "select * from product where prodId = '$prodId'";//db //$result = mysql_query($sql,$conn) or die(mysql_error()); if (isset($_POST['submittedUpdate'])) { $prodId = mysql_real_escape_string(trim($_POST['prodId'])); $sName = mysql_real_escape_string(trim($_POST['shopName'])); $dept = mysql_real_escape_string(trim($_POST['dept'])); $brand = mysql_real_escape_string(trim($_POST['brand'])); $type = mysql_real_escape_string(trim($_POST['type'])); $image = mysql_real_escape_string(trim($_POST['image'])); $price = mysql_real_escape_string(trim($_POST['price'])); $query2 = "UPDATE product SET prodName='$prodName', dept='$dept', brand='$brand', type='$type', image='$image', price='$price' WHERE prodId ='$prodId' and shopName='$shopName'";$query = "SELECT * FROM product WHERE prodId = '$prodId'";if ($result = mysql_query($query)) { $row = mysql_fetch_array($result, MYSQL_ASSOC) ?> <form action="admin_update2.php" method="post"> <center> <table align="center" cellspacing="0" cellpadding="5" bgcolor="#ffffff" border=1 bordercolor="#2696b8"> <TR><TD align="left" bgcolor="#2696b8" width="30%"><FONT color="white"><B>Product Id: </B></FONT></TD> <TD width="70%"><?php echo $row['prodId'] ?></TD></TR> <TR><TD align="right" bgcolor="#2696b8"><FONT color="white"><B>Shop Name:</B></FONT></TD> <TD width="70%"><?php echo $row['shopName'] ?>"></TD></TR> <TR><TD align="right" bgcolor="#2696b8"><FONT color="white"><B>Product Name:</B></FONT></TD> <TD><INPUT type="text" maxLength=45 size=45 name=name value="<?php echo $row['prodName'] ?>"></TD></TR> <TR><TD align="right" bgcolor="#2696b8"><FONT color="white"><B>Department:</B></FONT></TD> <TD><INPUT type="text" maxLength=45 size=45 name="surname" value="<?php echo $row['dept'] ?>"></TD></TR> <TR><TD align="right" bgcolor="#2696b8"><FONT color="white"><B>Brand:</B></FONT></TD> <TD><INPUT type="text" maxLength=45 size=45 name="address" value="<?php echo $row['brand'] ?>"></TD></TR> <TR><TD align="right" bgcolor="#2696b8"><FONT color="white"><B>Type:</B></FONT></TD> <TD><INPUT type="text" maxLength=45 size=45 name="address2" value="<?php echo $row['type'] ?>"></TD></TR> <TR><TD align="right" bgcolor="#2696b8"><FONT color="white"><B>Image:</B></FONT></TD> <TD><INPUT type="text" maxLength=45 size=45 name="county" value="<?php echo $row['image'] ?>"></TD></TR> <TR><TD align="right" bgcolor="#2696b8"><FONT color="white"><B>Price:</B></FONT></TD> <TD><INPUT type="text" maxLength=45 size=45 name="county" value="<?php echo $row['price'] ?>"></TD></TR> <TR><TD></td> <TD><CENTER><input name=submit type=submit value="UPDATE"> <FONT color=navy></FONT></P></TD></TR> </TBODY> <input type="hidden" name="prodId" value='.$prodId.'> <input type="hidden" name="submittedUpdate" value="TRUE"/></td></tr> </TABLE> </FORM> <?php } ?> </body></html>//line 143[/code] Link to comment https://forums.phpfreaks.com/topic/18449-error-in-code-for-updating-records/ Share on other sites More sharing options...
craygo Posted August 23, 2006 Share Posted August 23, 2006 You didn't close both of your if statementsyou need another } at the end of your scriptRay Link to comment https://forums.phpfreaks.com/topic/18449-error-in-code-for-updating-records/#findComment-79352 Share on other sites More sharing options...
kikilahooch Posted August 23, 2006 Author Share Posted August 23, 2006 Thanks Ray,I am passing the values through into the admin_update2.php page from my admin_delete.php page using:[code]<td align="center"><a href="admin_update2.php?login=true&shopName='.$row['shopName'].'&prodId='.$row['prodId'].'"><img src="http://snet.wit.ie/~ciaracousins/clothes/' . $row['image'] . '"></a>[/code]The user clicks on an image and it passes the values through to the next page, but when I do this it does not display the table to update the records. Any reason why its not displaying?? The values are being passed through ok Link to comment https://forums.phpfreaks.com/topic/18449-error-in-code-for-updating-records/#findComment-79405 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.