Jump to content

MYSQL inser into


Fanta

Recommended Posts

mysqli version 5

 

$link =mysqli_connect('localhost','root','','asadb'); 

$sql ="insert into tbproduct (prod_id, prod_name, prod_desc, prod_rate, prod_img, prod_prc, prod_qty, prod_stat, prod_cratedt, prod_moddt) values ('$prodid', '$prodname', '$proddesc', '$prodrate', '$prodimg', '$prodprc', '$prodqty', '$prodstat', (now()), (now()))";

 

 

$mysqli->query($link,$sql);

 

Doesn't insert data in table and no error is returned

 

Link to comment
https://forums.phpfreaks.com/topic/168300-mysql-inser-into/
Share on other sites

Hi

 

Think you are mixing up mysqli object orientation and procedural call syntax.

 

Try this

 

$link = new mysqli('localhost','root','','asadb'); 

$sql ="insert into tbproduct (prod_id, prod_name, prod_desc, prod_rate, prod_img, prod_prc, prod_qty, prod_stat, prod_cratedt, prod_moddt) values ('$prodid', '$prodname', '$proddesc', '$prodrate', '$prodimg', '$prodprc', '$prodqty', '$prodstat', (now()), (now()))";

$link->query($sql);

 

All the best

 

Keith

Link to comment
https://forums.phpfreaks.com/topic/168300-mysql-inser-into/#findComment-887704
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.