cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gembalaya
New

Unable to INSERT code into database with PHP/MySQLi

Hi everyone! 

 

I'm having an issue with inserting with PHP/MySQLi and in the hope that I'm just doing something stupid I'm here to ask for help.

 

  • I'm using a premade code, that several other individuals are using with no problems, and have made no modifications to it
  • I've granted full user privileges to a new user when creating the database
  • I'm able to delete, modify and create but not able to insert
  • I can insert with no problems in PHPMyAdmin when in this database

This is a a snippet of the code. I can share the full code if needed, but as other people are using this same code without an issue I'm not sure if this is the problem. 

 

$result = $database->query("INSERT INTO `tcgs` (`name`,`url`,`cardsurl`,`cardspath`,`defaultauto`,`autoupload`,`lastupdated`,`status`,`format`) VALUE ('$name','$url','$cardsurl','$cardspath','$defaultauto','$autoupload','$today','$status','$format')");

if ( !$result ) { $error[] = "Error inserting row. ".mysqli_error().""; }

 

Thanks in advance for any help!

1 REPLY 1
PL281
Super User 2020

@gembalaya 

 

Without seeing the rest of your code it's hard to say - but I would ask

1) are you able to open the connection to the database without error

2) do you have the tcgs table in your database

3) are you passing all of those variables to the function / script you are trying to run

I am a GoDaddy End User - Just Like You
Check out my site! | I currently manage over 300 WordPress Websites
* Please note that I offer free advice on this forum. Thank You Info If you would like personalized help, please contact me. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

Once your issue is resolved,
please be sure to come back and click accept for the solution

Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community