I'm having trouble showing data from my data base in php. i always get the " No database selected " line and also i was wondering why the second echo doesn't show the result is :
No database selected
this is my code
<?php require($_server["DOCUMENT_ROOT"]."/config/db_config.php"); $connection = mysql_connect($db_host, $db_user, $db_password) or die("error connecting"); mysql_select_db($site, $connection) ; $query = "SELECT * FROM `example`"; echo "first echo <br>"; $result = mysql_query($query) or die(mysql_error()); echo "second echo<br>"; $row = mysql_fetch_array($result) or die(mysql_error()); echo $row[name]. " - ". $row[age]; ?>
I checked the database name and the field names.
also checked the mysql user account and even made a new one but still nothing
I guess there are other people who banged their heads against that wall at some point with this problem :icon_wink: