Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I'm a beginner learning PHP/mySQL (if there's a better forum for beginner's, please let me know!). All I'm trying to do is connect to a local mySQL database using PHP (so I can really start learning PHP), but I'm having trouble getting that far. It's no problem if I use a db on a web server because I can easily find the database name, user name, and password (usually the hosting providers make that easy to get to). I'd rather do it locally though, but am having trouble.
Where do I need to put the database to be able to access it? How do I reference it using the code below? I'm on a Windows machine and running the files from the htdocs folder in the c:\apache2 directory. The problem is that I don't know where/how to put the database.
This is what I tried that did not work (and for what it's worth, it didn't even show the die message):Code: Select all
$dbHost = "localhost";
$dbUser = "root";
$dbPass = "password";
$dbDatabase = "mobro";
//connet to the database
$db = mysql_connect($dbHost, $dbUser, $dbPass) or die ("Error connecting to database.");Ryan
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]