Jump to content

insert data into database probelm


xbl1

Recommended Posts

Hi:i am trying to insert data into database, but it give me the following massage:Error: No database selectedCould you help me, please.i created a table

create table test(content varchar(1000), id smallint auto_increment, primary key(id))
and i have inserted 1 row data into the table by hand without problem. but i got prolem with inserting by the following code.my code:
<?php $con=mysql_connect("localhost", "xxx", "xxxx") or die(mysql_error()); mysql_select_db("xxx", $con); $mysql="INSERT INTO test (content) VALUES (\"hkhk\")"; $result=mysql_query($mysql, $con); if(!$result) die('Error: ' . mysql_error()); else echo "data inserted";?>
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...