Hi all, basically this is my first time trying to make a PHP site from scratch, and using my own local server (WAMP server) after having a couple of lectures on it in school.
Now I'm trying to recreate the site I have on the schools local server, however I'm falling down at the first hurdle.
I have a table of albums with only one record in it (for now, just until I get this working).
I have set up a connection to the server using a page I've called conninfo.php
<?php
$strServer="localhost";
$strDatabase="albumdrop";
$strUser="root";
$strPwd="mike";
$strDB=mysql_connect($strServer,$strUser,$strPwd)or die("Could not open database");
$database=mysql_select_db("strDatabase",$strDB);
?>
And here is what I'm trying to do:
<?php include("conninfo.php");
$query="SELECT * FROM albums";
$result = mysql_query($query) or die ("didnt work");
while($r=mysql_fetch_array($result))
{
echo $r["artist"];
echo "<br>";
}
?>
But of course I keep getting the or die 'didn't work' message.
So H/A, any ideas? Or should I take this to Moe's technology tavern?
Posts
-
Is your database named "strDatabase" or did you perhaps omit a dollar sign?
Thanks, Circa. I'm sending you as much internet love as I can, right now.
edit: aww I got beat
I guess I need to be more careful with syntax.