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 what is wrong?

Thanks

<?php session_name("duedate_session"); session_start(); ?>
<?php require_once("includes/db_connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php include("javascripts/validation.js"); ?>
<?php include("includes/header.php"); ?>

<?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
	[B][I]$result = mysqli_query($query, $connection);[/I][/B] //line 50
	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>";
	}
	
	
	
?>
<?php require("includes/footer.php"); ?>

When using mysqli procedurally the database link comes first, then the query. Please read the documentation when you get errors like this

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.