paddyhaig Posted May 22, 2010 Share Posted May 22, 2010 I don't know why I am getting these errors. Notice: Use of undefined constant localhost - assumed 'localhost' in C:\wamp\www\ edit.php on line 3 Notice: Use of undefined constant dbusername - assumed 'dbusername' in C:\wamp\www\ edit.php on line 3 Notice: Use of undefined constant dbpassword - assumed 'dbpassword' in C:\wamp\www\ edit.php on line 3 <?php mysql_connect(localhost,example,example) or die ("Problem connecting to DataBase"); $query = "select * from auth"; $result = mysql_db_query("example", $query); if ($result) { echo "<table width=100% align=center border=1 bordercolor=#808080 cellspacing=0 cellpadding=0 bordercolorlight=#808080 bordercolordark=#283A86><tr> <td align=center bgcolor=#283A86><font color=#FFFFFF><b>Edit:</b></td> <td align=center bgcolor=#283A86><font color=#FFFFFF><b>Name:</b></td> <td align=center bgcolor=#283A86><font color=#FFFFFF><b>Login:</b></td> <td align=center bgcolor=#283A86><font color=#FFFFFF><b>Privilage:</b></td> </tr>"; while ($r = mysql_fetch_array($result)) { $id = $r["id"]; $first_name = $r["first_name"]; $last_name = $r["last_name"]; $login = $r["login"]; $password = $r["password"]; $privilage = $r["privilage"]; echo "<tr> <td align=center> <a href=\"editing.php?id=$id&first_name=$first_name&last_name=$last_name&login=$login&password=$password&privilage=$privilage\">$id</a></td> <td>$first_name $last_name</td> <td>$login</td> <td>$privilage</td> </tr>"; } echo "</table>"; } else { echo "No data."; } mysql_free_result($result); ?> Quote Link to comment https://forums.phpfreaks.com/topic/202553-php-db-info-appearing-in-browser/ Share on other sites More sharing options...
trq Posted May 22, 2010 Share Posted May 22, 2010 Strings need to be surrounded by quotes. eg; mysql_connect('localhost','example','example') Quote Link to comment https://forums.phpfreaks.com/topic/202553-php-db-info-appearing-in-browser/#findComment-1061842 Share on other sites More sharing options...
paddyhaig Posted May 22, 2010 Author Share Posted May 22, 2010 thorpe, thank you most kindly. As simple as that! Funny thing was, it worked 7 years ago. Quote Link to comment https://forums.phpfreaks.com/topic/202553-php-db-info-appearing-in-browser/#findComment-1061854 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.