All Questions

67
votes
5answers
7580 views

Can I mix MySQL APIs in PHP?

I have searched the net and so far what I have seen is that you can use mysql_ and mysqli_ together meaning: <?php $con=mysqli_connect("localhost", "root" ,"" ,"mysql"); if( mysqli_connect_errno(...
39
votes
1answers
5180 views

How to get mysqli error in different environments?

In my LOCAL/DEV environment, the mysqli query is performing OK. However, when I upload it on my WEBHOST environment, I got this error; Fatal error: Call to a member function bind_param() on a non-...
342
votes
13answers
122138 views

mysqli or PDO - what are the pros and cons?

In our place we're split between using mysqli and PDO for stuff like prepared statements and transaction support. Some projects use one, some the other. There is little realistic likelihood of us ever...
89
votes
7answers
96257 views

Call to undefined method mysqli_stmt::get_result

Here's my code: include 'conn.php'; $conn = new Connection(); $query = 'SELECT EmailVerified, Blocked FROM users WHERE Email = ? AND SLA = ? AND `Password` = ?'; $stmt = $conn->mysqli->prepare...
8
votes
4answers
61590 views

mysqli_query expects at least 2 parameters

This mysqli_query command results in the error below mysqli_query("INSERT INTO `counter`.`hits` (`page_hits`) VALUES ('".$hits."')"); "Warning: mysqli_query() expects at least 2 parameters, 1 ...
76
votes
11answers
131632 views

Commands out of sync; you can't run this command now

I am trying to execute my PHP code, which calls two MySQL queries via mysqli, and get the error "Commands out of sync; you can't run this command now". Here is the code I am using <?php $con = my...
31
votes
7answers
80472 views

How to change mysql to mysqli?

Based on this code below I use for regular mysql, how could I convert it to use mysqli? Is it as simple as changing **mysql _query($sql); to mysqli _query($sql); ?** <?PHP //in my header file th...
19
votes
3answers
11346 views

Turning query errors to Exceptions in MySQLi

I'm trying to turn MySQLi query errors to Exceptions, but couldn't - mysqli_sql_exception is thrown only if it failed to connect the DB. I used mysqli_report(MYSQLI_REPORT_STRICT) and procedural MySQ...
23
votes
6answers
81686 views

Call to a member function bind_param() on a non-object

I am trying to bind a variable in this prepared statement, but i keep receiving the error: Call to a member function bind_param() on a non-object The function is called, and variables are passed to...
11
votes
4answers
83627 views

Warning: mysqli_query() expects parameter 1 to be mysqli, null given in

I am trying to build a simple custom CMS, but I'm getting an error: Warning: mysqli_query() expects parameter 1 to be MySQLi, null given in Why am I getting this error? All my code is already My...

Previous Next