Im new to php and mysql, and been tearing my head out over this for the past few hours…
/* This is the code I am using… for a test database I created…
[php] <?php
if($_GET) {
$gender = $_GET[‘gender’];
$connect = mysql_connect(“localhost”,“root”,"");
if ($connect){
mysql_select_db(“RandomData”,$connect);
$query = “SELECT * FROM RandomTable WHERE Gender=’” . $gender . “’”;
$results = mysql_query($query);
while($row = mysql_fetch_array($result)){
echo $row[‘Name’] . “
” . $row[‘Surname’] . “
” . $row[‘Email’];
}
} else {
die (mysql_error());
}
}
?>
*/
[/php]
But when I call PHP… this is all I get “Access denied for user ‘root’@‘localhost’ (using password: NO)”
Is there a problem in the code? Or is it a configuration problem… I’m using MAMP on a MAC…
Someone please help…