shrive22 Posted June 22, 2009 Share Posted June 22, 2009 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 More sharing options...
J.Daniels Posted June 22, 2009 Share Posted June 22, 2009 Since you are not creating a MySQLi object, you will need to use mysql_query() instead of mysqli_query(). Link to comment https://forums.phpfreaks.com/topic/163294-mysql-error-insert/#findComment-861538 Share on other sites More sharing options...
flyhoney Posted June 22, 2009 Share Posted June 22, 2009 mixed mysqli_query ( mysqli $link , string $query [, int $resultmode ] ) You have the parameters for mysqli_query reversed. Link to comment https://forums.phpfreaks.com/topic/163294-mysql-error-insert/#findComment-861542 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.