Jump to content

mysql error insert


shrive22

Recommended Posts

I get the following error: Warning: mysqli_query() expects parameter 1 to be mysqli, string given in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\docdue\create_group.php on line 50

 

Anyone have any ideas of what could be wrong?

 

Thanks

 

<?php 


$groupid = $_POST['groupid'];
$groupdescription = $_POST['description'];
//$groupid = mysql_prep($_POST['groupid']);
//$groupdescription = mysql_prep($_POST['description']);


$query = "INSERT INTO groups (";
$query .= "groupid, description";
$query .= ") VALUES (";
$query .= "'{$groupid}', '{$groupdescription}')";

echo $query."<br /><br />\n";



// 3. perform the database query
[i][b]$result = mysqli_query($query, $connection);  //line 50[/b][/i]
if ($result) { 
	//the insert succeded
	redirect_to("manage_groups.php");
} else {
	// Display Error Message
	echo"<p>Add Group Failed.</p>";
	echo"<p>" . mysql_error() . "</p>";
}



?>

Link to comment
https://forums.phpfreaks.com/topic/163294-mysql-error-insert/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.