tags:

views:

107

answers:

2
$con = mysql_connect("localhost","music123_sri","password");
 if (!$con) 
  { die('Could not connect: ' . mysql_error()); } 
mysql_select_db("music123_telugu", $con);
 $sql="INSERT INTO xml (File) VALUES (" . mysql_escape_string($xmlString) . ")"; 

$data = mysql_query("SELECT File FROM xml")

 $info = mysql_fetch_array( $data );

can u help me in coding for connecting to database and inserting data and retrieving data

A: 

Try adding a semi-colon after $data = mysql_query("SELECT File FROM xml").

Blixt
+2  A: 

As I wrote in some other answer to one of your questions: please read some introduction on how to use PHP with MySQL. A lot of problems will disappear when you get some sort of understanding on how these pieces fit together.

In your concrete example you have three problems:

  1. Your INSERT-query is never executed as it's never send to the database server
  2. You only retrieve the first row from the result set of your query using mysql_fetch_array()
  3. There is a ; missing - so your code is not even valid PHP

I won't give you a finished code snippet but some advice: carefully read the PHP manual for mysql_query() and mysql_fetch_array() and try to understand how they fit into your code.

Stefan Gehrig
ok..........................................
musicking123