Jump to content


Photo

Mysql connection problem


  • Please log in to reply
3 replies to this topic

#1 HaZaRd420

HaZaRd420
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 03 March 2006 - 06:19 PM

Hello, im having this problem with my mysql not connecting to my DB:

Warning: mysql_connect(): Access denied for user: 'MYDB@localhost' (Using password: YES) in /home/gtqsqua/public_html/roster/members.php on line 9
Access denied for user: MYDB@localhost' (Using password: YES)

And heres the members.php

<?php
//PHP NEWS v0.1 BY HaZaRd//
include('config.php');

$connection = mysql_connect( "$host","$user","$pass" ) or die(mysql_error());

$rs = mysql_select_db( "$db" );

$sql=" select * from news order by date $sort ";

$rs = mysql_query($sql) or die(mysql_error());

echo '


';
while ( $row = mysql_fetch_array( $rs) )
{
echo '
<font face="verdana" size=1>
<b>Subject:</b> '.$row["subject"].' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Author:</b><i> '.$row["author"].' </i> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Date:</b> '.$row["date"].'<br><br>
'.$row["content"].'<br>
<hr color="#000000">
';
}
?>

Please Help me on this, I cant figure out what the problem is.

#2 helpmeplease2

helpmeplease2
  • Members
  • PipPipPip
  • Advanced Member
  • 87 posts

Posted 04 March 2006 - 01:22 AM

please include config.php in your post

#3 earl_dc10

earl_dc10
  • Members
  • PipPipPip
  • Advanced Member
  • 71 posts

Posted 04 March 2006 - 03:47 AM

also, please try this:

change
$connection = mysql_connect( "$host","$user","$pass" ) or die(mysql_error());

to
$connection = mysql_connect( $host, $user, $pass ) or die(mysql_error());

got a problem? Google helps many of those in need

#4 HaZaRd420

HaZaRd420
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 05 March 2006 - 01:24 PM

Nevermind, I fixed the problem :)!!!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users