Go to Ryanreese.us/blog.php
Fill out some random nonsense and then click submit. It gives me this error
dbselectAccess denied for user 'ryanree1_reese'@'localhost' to database 'blog'
Ignoring that "dbselect" for now, this is my code.
config.php
PHP Code:
<?php$host="localhost";
$username="ryanree1_reese";
$password="*************";
$tableName="userSubmitted";
$DbName="blog";
?>
checkInfo.php
PHP Code:
<?phpsession_start();
include ("config.php");
?>
<!doctype html>
<html>
<head>
<title>check</title>
</head>
<body>
<?php
$contentOfPost=$_POST['contentOfPost'];
$submit=$_POST['submit'];
$date = date("Y/m/d");
$time = time();
$link = mysql_connect($host, $username, $password);
if(!$link){echo "link";die(mysql_error());}
$db_selected = mysql_select_db($DbName, $link);
if(!$db_selected){echo "dbselect";die(mysql_error());}
$insertionToDatabase="INSERT INTO $tableName ('PostNumber', 'Date', 'Time', 'Content') VALUES (NULL, '$date', '$time', '$contentOfPost')";
$result = mysql_query($insertionToDatabase);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
echo $result;
mysql_close($link);
?>
</body>
</html>
Ignore any security for now. I have no need for it until I get this sorted out. I've deduced I can logon to the database, but my line in CheckInfo.php of mysql_select_db() is wrong. What's the issue?
For reference, my DB name is ryanree1_blog and my table name is ryanree1_userSubmitted
Edit-Changed DB name to ryanree1_blog in the config.php file but no go. It's back to just "blog" now.
Bookmarks