Based on the responses from both Kris and Rob, this is the corrected working code for those that may be seeking to do something similar (since I am not familiar with php nor mysql and this is just a temporary solution, others may look into what Kris and Rob suggested as far as "mysqli" and "PDO"). This for me worked perfectly. Thank you guys!
Kudos to @Kris since he replied with code example that was related to my post. He specifically used variables from my code, making it a lot easier to understand and troubleshoot; thus my point to his answer. ( I appreciate both of your input though)
<?php
$db_name = "dbname";
$dbusername = "dbname";
$dbpassword = "password";
$server = "dbname.blahblahbla.hosted.com";
$connection = mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = mysql_select_db($db_name,$connection)or die(mysql_error());
$htmlquery = "select * from domains ORDER BY domain";
$htmlresult = mysql_query($htmlquery,$connection) or die(mysql_error());
$htmlinfo = mysql_fetch_array($htmlresult);
if ($htmlresult == 0) {
echo "<p>No Recourds Found</p>";
} else {
while($htmlinfo = mysql_fetch_assoc($htmlresult) {
$p = "<?php \n";
$p.= " //LS \n";
$p.= " define('Disable_Ads', 'No'); //Yes or No \n";
$p.= " define('Site_ID', ".$htmlinfo['domainid']."); \n";
$p.= " define('Short_Paragraph_Size',500);\n";
$p.= " define('Long_Paragraph_Size',1000);\n";
$p.= " ?> \n";
$htmlfolder = strtolower($htmlinfo['domaingroup']);
$htmldomain = strtolower($htmlinfo['domain']);
$a = fopen($htmlfolder."/".$htmldomain."/admin_config.php", 'w');
fwrite($a, $p);
echo $htmldomain." Completed <br />"; // TEMP - To try to see the looping of domain names
fclose($a);
}
}
?>