Jump to content

MYQLI ERROR


afaaro

Recommended Posts

Hello everyone

 

about 4 days am experiencing this problem if you can help me out this is the code; it's not updating at all it's just redirecting me to the page

 

$db = new mysqli($dbHost, $dbUser, $dbPass, $dbName) or die (mysql_error());

function editcat($cid,$name,$desc,$ok=false) {
global $db;

$cid = intval($cid);

if (!$ok) {
	$result = $db->query("SELECT * FROM category WHERE cid='$cid'");
	$row = $result->fetch_object();
        $cid = $row->cid;
	$name = $row->name;
	$desc = $row->desc;

	echo "<table width='100%' align='center' cellspacing='0' cellpadding='1'>\n";
	echo "<form name='form_editcat' method='post' action='index.php?page=articles&op=editCategory&cid=$cid&ok=true'>";

		echo "<tr><td><b>Name</b><td><input type='text' name='name' size='40' maxlength='255' value=\"$name\">\n";
		echo "<tr><td><b>Description</b><td><input type='text' name='desc' size='40' maxlength='255' value=\"$desc\">\n";
		echo "<tr><td colspan='2'><input type='submit' name='Submit' value='Modify'>\n";

	echo "</form>\n";
	echo "</table>\n";
} else {	
	$save = true;

       if ($name=="") { $save = false; $msg = "Name field is empty!";}
       if ($desc=="") { $save = false; $msg = "Description field is empty!";}

	if ($save) {
		$db->query("UPDATE category SET name='$name',desc='$desc' WHERE cid='$cid'");
		echo "<meta http-equiv='refresh' content='0;URL=index.php?page=articles'>";
	} else {
		echo "<div align='center' id='errorText'><b>$msg</b></div>";
	}
}
}



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...