Updating mysql database with php using variables -


i having problems updating mysql php using varables.

    mysqli_query($connection,  "update passwords set used=1, time_used='{$time}'                                 password='{$key}'                                "); 

i given error:

warning: mysqli_query() expects parameter 1 mysqli, resource given in c:\wamp\www\key_check.php on line 47 

any ideas why?

thanks!

edit: whole code: http://pastebin.com/raw.php?i=w5cx8pbp

the "new mysqli" solution seems giving problems when trying

$result = mysql_query("select * passwords", $connection); 

thanks :)

your connection setting must like

$connection = new mysqli($host,$username,$pass,$db); 

then execute query using way or way also

$query="update passwords set used=1, time_used='{$time}'                             password='{$key}'                            "; $stmt = $connection->query($sql); 

note: using prepared statements mysqli can possible , great. somehow needed bind parameters in there..


Comments