MySQL Server 5.0
phpMyAdmin 2.10.0.2
IE7
I am a total newbie. I found your Newbies FAQ thread very helpful...
I can create mySQL databases, tables, and records using phpMyAdmin. I seem to be able to connect to the databases, because I don't seem to be getting error messages at that point in my basic php scripts, but I can't seem to see or do anything with the data, or make tables, or anything else. I've been going a little crazy re. this for about a week.
Here's my script (genericized the login information):
<?php
// Initialize Database Variables
$DbHost = 'localhost';
$DbUser = 'myusername;
$DbPassword = 'mypassword';
$DbName = 'mydatabasename';
// Connect to MySQL Server and Verify Connection
$Db = mysql_connect($DbHost, $DbUser, $DbPassword);
if (!$Db)
{
die ('Error: Could not connect to database server.');
}
// Open MySQL Database and Verify Connection
$DbSelect=mysql_select_db($DbName);
if (!$DbSelect)
{
die ('Error: Could not connect to database.');
}
// Query the Database and Verify Query OK
$query = "SELECT * FROM 'judges'";
// Fetch and display the results
echo 'Did we get this far?' . '<br />';
while($row = mysql_fetch_array($query)){
//Create the HTML table
echo "<table><tr><td>JudgeName: ".$row[judgeName]." eMail:".$row[judgeEmail]."</td></tr></table><br />";
}
// Close Database Connection
mysql_close($Db);
?>
Any ideas? I have written this lots of ways, including using a query to connect to the DB. I tried creating tables at first, but then I backed off to just trying to see existing data, and nothing there. I can see the "Did we get this far?" echo, which I move around to find out where the problems seem to be. There are 2 rows of records in this table 'judges'. There are only 2 fields: judgeName and judgeEmail. judgeName is the primary key. Both are CHAR(100). Collation is latin1_swedish_ci. I believe my PhP setup is for local connection only.
p.s. I'm not out to make a table, and realize the TABLE tag should probably be outside the while function, but I thought I should use your FAQ code as closely as possible until I get past this point.