xbl1 Posted August 30, 2008 Share Posted August 30, 2008 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 More sharing options...
Ingolme Posted August 30, 2008 Share Posted August 30, 2008 Most likely you haven't typed the name of the database correctly in the mysql_select_db() function. Link to comment Share on other sites More sharing options...
xbl1 Posted August 30, 2008 Author Share Posted August 30, 2008 Most likely you haven't typed the name of the database correctly in the mysql_select_db() function.i didn't get a permission to edit database yet. Thanks anywhere Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.