d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Help With Php Code
Add Reply New Topic New Poll
Member
Posts: 10,865
Joined: Aug 15 2009
Gold: Locked
Trader: Scammer
Warn: 10%
Dec 9 2012 12:59pm
im doing a project for my class and im getting this error

so im suppose to be able to type in a phone number and a message. Its suppose to be taken from the forum and be put into the database into a table with columns/message/phone number

here is the forum

<?php
//Add message and phone number to the "messages" table ...
$con = mysql_connect("localhost","rrwolff0_dennis","pres2028"); //Connection string //drmerry_Project6 is the user then project6 is the password
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("rrwolff0_wolffman", $con); //drmerry_php is the database
$sql="INSERT INTO Project6 VALUES ('".$_POST[textmessage]."','".$_POST[phonenumber]."');" ;
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Record Added";


//line 3 and line 8 have to be customized to your settings
//
?>

//******************************************************************************************
//This section will send an the text message to everyone in the Members table
$fromemail = "rrwolff0316@email.campbell.edu" ;
$message = $_POST[textmessage] ;
$sql="SELECT Email FROM members";
mysql_query($sql,$con);
$result = mysql_query($sql);
//echo "Message Sent To:<br/>";
while ($row = mysql_fetch_assoc($result))
{ // while will look through all members of the database
//echo $row['Email']."<br/>";
//echo "From Email:".$fromemail."<br/>";
mail($row['Email'], "New Text Message", $message, "From: ". $fromemail );
}
//******************************************************************************************
//This section will add an entry to an RSS feed
$rss = simplexml_load_file('text.xml');
$item= $rss->channel->addChild('item');
$item->addChild('title', date("m/d/Y")."-".date("g:i a") );
$item->addChild('description', $_POST[textmessage]."-".$_POST[phonenumber]);
file_put_contents('text.xml', $rss->asXML());



Im getting the error message when i type in my number and message

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'rrwolff0_dennis'@'localhost' (using password: YES) in /home/rrwolff0/public_html/Campbell/ITS200/Projects/Project6/Project6.php on line 3
Could not connect: Access denied for user 'rrwolff0_dennis'@'localhost' (using password: YES)


can any1 help me please?

This post was edited by El_Mariaci on Dec 9 2012 01:00pm
Member
Posts: 37,178
Joined: Jul 18 2010
Gold: 10.00
Dec 9 2012 01:04pm
Help him! :3
Member
Posts: 10,865
Joined: Aug 15 2009
Gold: Locked
Trader: Scammer
Warn: 10%
Dec 9 2012 01:24pm
Quote (Furies @ Dec 9 2012 09:04pm)
Help him! :3


;)
Member
Posts: 48,669
Joined: Jul 10 2008
Gold: 179.69
Dec 9 2012 01:25pm
system restore. it's the only way.
Member
Posts: 129
Joined: Dec 7 2012
Gold: 0.00
Dec 9 2012 02:10pm
dude use the code tags.. I can't read shit
Member
Posts: 10,865
Joined: Aug 15 2009
Gold: Locked
Trader: Scammer
Warn: 10%
Dec 9 2012 02:25pm
what do you mean by system restore?
Member
Posts: 658
Joined: Jul 14 2012
Gold: 0.01
Dec 14 2012 07:18pm
Check

$con = mysql_connect("localhost","rrwolff0_dennis","pres2028");

To make sure you entered all the right info. (pw, user, etc...).

If that is all fine and dandy. You need to make sure you have the right privileges to the database in question. If you're using a shared hosting account, I would definitely check this.

Member
Posts: 37
Joined: Jun 23 2012
Gold: 0.00
Dec 22 2012 01:33am
php is usually really good at letting you know what the problem is. in this case

Could not connect: Access denied for user 'rrwolff0_dennis'@'localhost' (using password: YES)

Seems like you need proper access.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll