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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.