mysqli - Problem querying MySQL DB with PHP using MAMP (on Mac) -


i'm having problem querying mysql db php

i'm using mamp 1.9.4 on mac os 10.6.6

the connections seems work

$dbc  =  mysqli_connect('localhost', 'root', 'password', 'dbname') or   die('error connecting mysql server.'); 

but whenever run query die error...

$query = "insert table_name (first_name, last_name) values ('john', 'doe')";  $result  = mysqli_query($dbc,  $query) or die('error querying database.'); 

any ideas?? mamp?

don't die fixed error message are. that's useless, equivalent of saying "something happened!"

instead, try:

$result = mysqli_query(...) or die("mysql error: " . mysqli_error()); 

which spit out exact reason there problem.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -