if (isset($edit)){
echo "<script>alert(' รอบ edit ');</script>";
$_SESSION['edit']=$edit;
//unset($edit);
$result=mysql_query("SELECT * FROM urllink WHERE idurl='$idurl'");
$rollnameurl=mysql_result($result,0,"nameurl");
$rollurl=mysql_result($result,0,"url");
}
Code (PHP)
<?
if(isset($submiturl)){// INSERT data to DB
if(isset($_SESSION['edit'])){
mysql_query("UPDATE urllink SET nameurl='$namelink',url='$urllink' WHERE idurl='$idurl'");
echo "<script>alert('แก้ไขข้อมูลเรียบร้อย');</script>";
unset($idurl,$submiturl);
unset($edit);
@session_unregister('edit');
}else{
mysql_query("INSERT INTO urllink(nameurl,url,idschool) VALUES('".$namelink."','".$urllink."','".$_SESSION['idschool']."')");
echo "<script>alert('บันทึกข้อมูลเรียบร้อย');</script>";
}
}
?>