0

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"); ?>
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by ShawnCplus
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.