Im geting an error message of Parse error: syntax error, unexpected ';' in E:\Websites\xxx.php line 29 Line 29 is
$_REQUEST["id"]);
Here are theadditional codes Thanks in advance
if
(
$mydb->execute("Update Diamond Set name = <name>, weight = <weight>, colour = <color>, cut = <cut>, where ID = <id>",
$_REQUEST["name"],
$_REQUEST["weight"],
$_REQUEST["color"],
$_REQUEST["cut"],
$_REQUEST["id"]);
$onloaddo = "alert('Saved existing diamond ".$_REQUEST["id"]."');";
$diamondid = "";
}
else
($_REQUEST["submitter"] == "Search")
{
if($_REQUEST["searchdiamondid"] != null && $_REQUEST["searchdiamondid"] != "")
{
$queryres = $mydb->query("Select id from diamond where id=%
$_REQUEST["searchdiamondid"]);
if ($queryres->countReturnedRows()==0)
$onloaddo="alert('diamond ID ".$_REQUEST['searchdiamondid']." not found!');";
else
{
$resultrow = $queryres->fetchRow();
$diamondid = $resultrow['diamondid'];
$name = $resultrow['name'];
$weight = $resultrow['weight'];
$colour = $resultrow['color'];
$cut = $resultrow['cut'];
$id = $resultrow['id'];
$formmode = 3;
}
}
}
Remove comma in <cut>,
change
$mydb->execute("Update Diamond Set name = <name>, weight = <weight>, colour = <color>, cut = <cut>, where ID = <id>",
to
$mydb->execute("Update Diamond Set name = <name>, weight = <weight>, colour = <color>, cut = <cut> where ID = <id>",
You are missing the closing parenthesis of your first if statement
$_REQUEST(["id"]);
You were missing the (
Change
$queryres = $mydb->query("Select id from diamond where id=%$_REQUEST["searchdiamondid"]);
to
$queryres = $mydb->query("Select id from diamond where id=". $_REQUEST["searchdiamondid"]);
If your $mydb->query function doesn't handle it:
I recommend, google for MySQL security stuff like http://php.net/manual/en/function.mysql-real-escape-string.php
There are many syntax errors with your code:
1. if has missing closing round bracket
2. SQL query is incorrect
3. else is evaluating a condition like if or else-if
4. $queryres = $mydb->query() has missing double quote
5. And probably few more
I strongly suggest you to: