FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


MySQL problem - Can't insert stuff in to database





limpands
Hey, i got a problem; when i try to insert data in to a table it dosen't work.

Example:
Code:

$this->mysqli->query("INSERT INTO numbers(id, number) VALUES('$var', '$var')");


When i run this code, nothing is added into the table.

Does anyone know how to solve this problem?
Peterssidan
Check if the query fails by printing the error message.
Code:
if (!$this->mysqli->query("INSERT INTO numbers(id, number) VALUES('$var', '$var')"))
{
   printf("Error: %s\n", $this->mysqli->error);
}
limpands
Peterssidan wrote:
Check if the query fails by printing the error message.
Code:
if (!$this->mysqli->query("INSERT INTO numbers(id, number) VALUES('$var', '$var')"))
{
   printf("Error: %s\n", $this->mysqli->error);
}

Thanks! It's fixed now Smile

The problem was not in my code. I forgot to set AUTO_INCREMENT.
Related topics
Critical Database Error (Or something else)
mysql problem
Whats the problem?
ALTER TABLE mySQL problem.
What is useful way in this php+mysql problem?
MySQL problem...
A very good PHP MySQL Tutorial
MySQL HELP!!
MySql Databases
AJAX tutorial [2nd part now updated]
MySQL Problem
mysql problem
mySQL problem
PHP/MySQL Dropdown value, and insert into database
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.