Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with inserting record into MySQL database

Status
Not open for further replies.

gizmicek

Programmer
Jun 25, 2003
107
CZ
Hello,
I'm newbie in using MySQL and I have problem with inserting record into the database. Structure of database forum_db:
id int auto_increment
user varchar
time varchar
date varchar
text longtext

see my code:
Code:
  $query="INSERT INTO forum_db VALUES('','$nickname','$time','$date','$textfield')";
//  die($query);
  $result=mysql_query($query,$connection) or die("Record inserting error");

Everytime I get "Record inserting error" and when I uncomment the die($query) statement, I get "INSERT INTO forum_db VALUES('','name','09:58:23','1. July 2003','some text')" which should be OK. Please help, I'm desperate after 2 hours of trying to solve this.
 
sorry, db_forum is table, not database... The strange thing is that I can receive the table content using the SELECT query, but cannot insert other records. Maybe the syntax of my INSERT query is wrong, any help appreciated
 
Solved! It was my mistake in function
Code:
 mysql_select_db()
So it took me 'only' 2,5 hours to solve this little mistake :D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top