View Single Post
Old 05-15-2008, 09:02 PM   #6 (permalink)
sarmenhb
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default

i've updated the code and found out that it was something to do with the sql i was using at the where clause.
here is the new code


Code:
<?php


require("config.php");
$viewrec = mysql_query("select * from tbl_clone where id = '$id'") or die("query failed");

if(isset($_POST['submit'])) {

#==================
# update record
#==================


if(!$_POST['txt_domain']) { die('the domain name is a required field <br><a href="index.php">go back</a>'); }

$domain = $_POST['txt_domain'];
$client = $_POST['txt_client'];
$dateprom = $_POST['txt_datepromised'];
$status = $_POST['drop_status'];
$devsite = $_POST['txt_devsite'];
$readyclone = $_POST['readyclone'];
$customexist = $_POST['customexist'];
$customaddon = $_POST['customaddons'];
$reporter = $_POST['reporter'];
$comments = $_POST['txt_comments'];
$highlight = $_POST['highlight'];
die

$updatedata = mysql_query("update tbl_clone set 

domain =                   '$domain',
client =                   '$client', 
date_prom =                '$dateprom',
status =                   '$status',
devsite =                  '$devsite',
clone_ready =              '$readyclone', 
exist_customization =      '$customexist', 
new_custom =               '$customaddon',
sugar =                    '$reporter',
comments =                 '$comments',
highlight =                '$highlight',


where id='$record'") or die(mysql_error());




}

?>




<html xmlns="http:www.w3.org1999xhtml">

<head>
<meta http-equiv="Content-Type" content="texthtml; charset=utf-8" >
<title>New Record</title>

<link href="style.css" type="text/css" rel="stylesheet"> 

<style type="text/css">
.style1 {
	color: #FF0000;
}
.style2 {
	text-decoration: none;
}
</style>
</head>

<body>

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<div id="header">Clone/Upgrade Statuses</div>
<p>
<br>
Field Highlight:<br>
<select name="highlight">
<option value="notset">Status Not Set</option>
<option value="qc">Sitecheck/QC</option>
<option value="bug">Bug Fixing</option>
<option value="ready">Ready for delivery</option>
</select>
<br><br>
Domain:<br>
<?php

while($row = mysql_fetch_assoc($viewrec)) {



?>

<input type="text" name="txt_domain" value="<?php echo $row['domain']; ?>"> <span class="style1"><strong>(required)</strong></span><br >
<br >


Client Name:<br>
<input type="text" name="txt_client" value="<?php echo $row['client']; ?>"><br >
<br >
&nbsp;Delivery Date:<br>
<input type="text" name="txt_datepromised" value="<?php echo $row['date_prom']; ?>"> <br >
<br>


Status:<br>
<input type="text" name="drop_status" value="<?php echo $row['status']; ?>" ><br >
<br >


Dev Site<br>
<input type="text" name="txt_devsite" value="<?php echo $row['devsite']; ?>"><br >
<br >

Ready to CloneUpgrade?<br>
<input type="text" name="readyclone" value="<?php echo $row['clone_ready']; ?>">
 <br >
<br >


Customizations Existing<br>
<textarea style="width: 229px; height: 46px" name="customexist"><?php echo $row['exist_customization']; ?></textarea> <br >
<br >


Customizations (add-ons)<br>
<textarea style="width: 229px; height: 50px" name="customaddons"><?php echo $row['new_custom']; ?></textarea><br >
<br >
User:<br>
<input type="text" name="reporter" value="<?php echo $row['sugar']; ?>"> <br >
<br >


Comments<br>
<textarea style="width: 232px; height: 52px" name="txt_comments"><?php echo $row['comments']; ?></textarea> <br >
<br >
<?php } ?>
<input type="submit" name="submit" value="Save Record">











</p>
</form>





<br>
<a href="index.php" class="style2">home</a>





</body>

</html>
here is the error

Code:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'where id=''' at line 16
i'm passing the $id variable like this: editrecord.php?id=25
__________________
no signature set
sarmenhb is offline  
Reply With Quote