I need to fetch result from mySQL table and insert them in php file.
I have list of URL's in my mySQL table
Here is my file which should insert data in to key.php":
<?php
mysql_connect("localhost", "helpdemo_helpdem", "2ert45gy") or
die("Could not connect: " . mysql_error());
mysql_select_db("helpdemo_xcart");
$result = mysql_query("SELECT url FROM xcart_customers");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo"{$row['url']},";
}
//Open a file in write mode
$fp = fopen("key.php", "w");
if(fwrite($fp, $row)) echo "writing=Ok";
else echo "writing=Error";
fclose($fp);
mysql_free_result($result);
?>
My "key.php" file:
<?php
echo "doman=www.v6e.cz,www.domain.com,www.rosu.com,www.url_from_mysql_here.com";
?>
So basically data should be inserted in format as it is in key.php file.
I need insert many url's from mySQL table to key.php, it should be inserted as it is in file above.
And I can not add anything else to "key.php" file, just url's in format as it is in file above.
any advices are welcome
Thanks a lot!