Tag Archives: sql

How to connect to MySQL using php [closed]

Questions: I have been working on a form that uses PHP to send e-mails to my account. To save room and de-clutter my mailbox account I am now trying to now use the same PHP to send the info to a MySQL server to log the data. The code I have been trying to make… Read More »

Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\xyz\userpanel.php on line 71

Questions: I have got some error when i want to show my user panel data. How can i fix the problem? Specially below this line: while( $row = mysqli_fetch_assoc( $result ) ){ My database are connected but it can not fetch the results. My full user panel code shown below: <!DOCTYPE html> <html> <head> <link… Read More »

How to extract only columns which has non zero values in mysql and php?

Questions: I am trying to extract and display on web page, only non zero columns from mysql database. which ever column’s date is 0000-00-00,i dont want to dispaly those columns on web page. Below is the HTML code and php script respectively <form action=”search.php” method=”post”> <p> <lable>ENTER SO NUMBER</lable> <input type=”text” name=”soid” id=”soid” > </p>… Read More »

mysql_query() expects parameter 2 to be resource, string given in [duplicate]

Questions: Possible Duplicate: mysql_fetch_array() expects parameter 1 to be resource, boolean given in select what’s wrong with this line? 23. $result = mysql_query(“INSERT INTO $tbl_name(‘city_id’, ‘city’, ‘state_id’) VALUES(‘NULL, ‘.$city.”,”‘, ‘4421”) or die(mysql_error())”); I get this error message each time : Warning: mysql_query() expects parameter 2 to be resource, string given in line 23 This my… Read More »

Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in [closed]

Questions: <?php if(isset($_POST[‘submit’])){ $data_missing = array(); if(empty($_POST[‘first_name’])){ // Adds name to array $data_missing[] = ‘First Name’; } else { // Trim white space from the name and store the name $f_name = trim($_POST[‘first_name’]); } if(empty($_POST[‘last_name’])){ // Adds name to array $data_missing[] = ‘Last Name’; } else{ // Trim white space from the name and store… Read More »

Create mysql table with php variable not working

Questions: I’m pretty new to php.. and this is probably a stupid mistake… but I have no idea what is going on. I’m trying to create a table in my database using php. I want to name the table after the username. I’m using the variable $tableusername. Here’s my code $sql=”SELECT * FROM userdata WHERE… Read More »