database connected but while executing the query getting some warning message plz check and give replay sir
Title
Question
<span style="color: rgb(0, 0, 0); font-family: "Times New Roman"; font-size: medium;">connected!</span>
Warning<span style="color: rgb(0, 0, 0); font-family: "Times New Roman"; font-size: medium;">: mysqli_query() expects at least 2 parameters, 1 given in </span>C:\xampp\htdocs\ANUPHP\mysql\mysql.php<span style="color: rgb(0, 0, 0); font-family: "Times New Roman"; font-size: medium;"> on line </span>4
Warning<span style="color: rgb(0, 0, 0); font-family: "Times New Roman"; font-size: medium;">: mysqli_query() expects at least 2 parameters, 1 given in </span>C:\xampp\htdocs\ANUPHP\mysql\mysql.php<span style="color: rgb(0, 0, 0); font-family: "Times New Roman"; font-size: medium;"> on line </span>4
<font color="#000000" face="Times New Roman" size="3">code here
</font>
</font>
<font color="#000000" face="Times New Roman" size="3">
</font>
<?php
require ("connect.php");
$date =("Y-M-D");
$write = mysqli_query("INSERT INTO mydata VALUES(' ','anusha','merugu','$date','female')");
?>
PHP-and-MySQL MySQL-Part-3 03-04 min 20-30 sec
Answers:
Dear User,
The mysqli_query function excepts 2 parameters , first variable is mysqli_connect equivalent variable (in our case $connect), second one is the query you have provided.
Try altering your code to following:
<?php
require("connect.php");
$date = date("Y-m-d");
$write = mysqli_query($connect,"INSERT INTO people VALUES('','Alex','Garrett','$date','M')") or die(mysqli_error($connect));
?>
Login to add comment