asmina22 Posted September 5, 2008 Share Posted September 5, 2008 hello i have a mysql database that contains one table called configuration it contains some values, for example Adsense, that i wanna get from the database and make a new variable $adsense that will take the value of Adsense from the databse, then i will use $adsense on my site. i tried this but didnt work : <?php $cnx=mysql_connect($server, $username , $password); mysql_select_db($base) or die("Database not found."); $sqlRequete = "select * from configuration"; $qryRequete = mysql_query($sqlRequete,$cnx); $foRequete = mysql_fetch_object($qryRequete); while($qryRequete) { print($foRequete->Adsense); $adsense=($foRequete->Adsense); $foRequete = mysql_fetch_object($qryRequete); } mysql_close(); ?> <script type="text/javascript"><!-- google_ad_client = "$adsense"; google_ad_width = 250; google_ad_height = 250; google_ad_format = "250x250_as"; google_ad_type = "text_image"; google_ad_channel = ""; google_color_border = "20395B"; google_color_bg = "FFFFFF"; google_color_link = "20395B"; google_color_text = "FFFFFF"; google_color_url = "FFFFFF"; google_ui_features = "rc:10"; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> Link to comment https://forums.phpfreaks.com/topic/122948-get-values-from-database-and-assign-them-to-variables/ Share on other sites More sharing options...
fenway Posted September 6, 2008 Share Posted September 6, 2008 What's not working about it? Link to comment https://forums.phpfreaks.com/topic/122948-get-values-from-database-and-assign-them-to-variables/#findComment-635389 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.