Hi there,
I have a problem inserting into all of my databases. Think there must be a problem with permissions on my suse 9, mysql 4 apache2 and php 4 server. I've tried to figure out for the last couple of days, but......
Even the simplest of SQL won't work and i don't get an error:
$query = "INSERT INTO tbl_table(naam) VALUES('KAREL')";
$result = mysql_query ($query);
Any ideas anyone?
Cannot insert into database, sql OK!
Moderator: General Moderators
i don't think you should use the $result. You don't need to assign it, just execute it like this. Only SELECT,SHOW,EXPLAIN or DESCRIBE statements return a resource identifier.
Mark
Code: Select all
$query = "INSERT INTO tbl_table(naam) VALUES('KAREL')";
mysql_query ($query);
Last edited by JayBird on Thu Apr 08, 2004 9:20 am, edited 1 time in total.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Also add error handling to the query call, just in case MySQL's not happy:
Mac
Code: Select all
mysql_query($query) or die(mysql_error().'<p>'.$query.'</p>');