Jump to content
The Uniform Server Community

Access Denied


Heinz Stapff
 Share

Recommended Posts

Getting Access denied with this code

$link=mysql_connect("localhost","root","root")or die(mysql_error( ));

mysql_select_db("bwi",$link) or die(mysql_error( ));

$result=msql_query("SELECT Code,Item,Description,Href,Src FROM silver")or die(mysql_error( ));

What password and ussername do I have to use with mysql_connect???????????????????????????????????

I haven't changed them and Uniserver is running on thumb drive. :rolleyes:

Link to comment
Share on other sites

$result=msql_query("SELECT Code,Item,Description,Href,Src FROM silver")or die(mysql_error( ));

Is that call supposed to be mysql_query() instead? This might be your problem.

 

You can use root/root if that's what you still have configured, but that also means you're wide open to attack, because it's NOT secure. You should set up a restricted user (through phpMyAdmin), and assign that user to the specific database. The user should have select, insert, update, and delete at a minimum.

 

Regards,

BobS

Link to comment
Share on other sites

BobS

You could be right, I'll check it out, should be mysql_query() first, then $result but acctualy the whole script runs like this and draws the error in the div designated for the http response :rolleyes:

<?php

$link=mysql_connect("localhost","root","root")or die(mysql_error( ));

mysql_select_db("bwi",$link) or die(mysql_error( ));

$query=mysql_query("SELECT Code,Item,Description,Href,Src FROM silver")or die(mysql_error( ));

echo "<table border='1'>
<tr>
<th>Code</th>
<th>Item</th>
<th>Description</th>
<th>Href</th>
<th>Src</th>
</tr>";

while($row = mysql_fetch_array($query))// could be msql_fetch_row($query) ???
{
echo "<tr>\n";
echo "<td>" . $row['Code'] . "</td>\n";// don't know if new line is required?
echo "<td>" . $row['Item'] . "</td>\n";
echo "<td>" . $row['Description'] . "</td>\n";
echo "<td>" . $row['Href'] . "</td>\n";
echo "<td>" . $row['Src'] . "</td>\n"; // don't know if it should be $row[5] ref?
echo "</tr>";
}

echo "</table>";

mysql_close($link);
?>

 

Sorry BobS I think your right that this is not the place for tutorials but I need to know UniServer is working properly before I proceed.

Link to comment
Share on other sites

:) Hay Coral, BobS was right and it worked, the div innerHTML gets the output from query the only thing is that the getSilver.php returns the #comment at the top of the php page along with the table. Is there a way to write the SELECT that dosen't return the #Comment in the php page? :rolleyes:
Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
 Share

×
×
  • Create New...