im having a hard time coding my php script. it always says "no database selected" but i dont think there is something wrong with my code. here it is:
<?php $con = mysql_connect("localhost","",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db('try',$con); $result = mysql_query("SELECT * FROM emptbl") or die(mysql_error()); echo "<table border='1'>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['fname'] . "</td>"; echo "<td>" . $row['lname'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?>
What was your solution?
You really didn't provide the error in which line in the first place.