Jump to content

PHP db info appearing in browser.


paddyhaig

Recommended Posts

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);
?>

Link to comment
https://forums.phpfreaks.com/topic/202553-php-db-info-appearing-in-browser/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.