Page 1 of 1

i need help with mysql

PostPosted: 04. October 2009 08:00
by rashawn1312
i keep getting this error code
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in C:\xampp\htdocs\xbox_mods_repairs\includes\php\mysql.php on line 6
Could not connect: Access denied for user 'root'@'localhost' (using password: YES)
Code: Select all
<?php
$servername = "127.0.0.1";
$username = "root";
$password = "cDjrXGtXGUmVSe8t";
$db = "socialnetworkin";
$con = mysql_connect($servername,$username,$password);
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }



mysql_close($con);
?>

Re: i need help with mysql

PostPosted: 04. October 2009 10:11
by aj123cd
4 a root user try with out password.
$password="";

Re: i need help with mysql

PostPosted: 04. October 2009 20:11
by rashawn1312
thanks it worked perfectly

hey another mysql problem

PostPosted: 04. October 2009 20:31
by rashawn1312
wut does this mean
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\xbox_mods_repairs\includes\php\categories.php on line 7
heres the source code
Code: Select all
<?php
include("includes/php/mysql.php");
$html_query = "select * from categoreis";

$query = mysql_query($html_query);

 while($data=mysql_fetch_array($query)){
    echo"<tr><td>
    <li> {$data['name']} </li>
    </td></tr>";
 }
?>

Re: hey another mysql problem

PostPosted: 04. October 2009 20:41
by Nobbie
I think it probably means, that you either urgently should read MySQL Documentation, learn how to evaluate return values, learn how to use mysql_error() function and last not least have to know, that "categoreis" is a typo and should be "categories" instead.

And please, really learn about MySQL return codes and error handling.