Joe2kiss has been helping me out with DB's and below are some quotes of his code that I have questions about.
First of all, I'm using WampServer (PHP5, mySQL5) on my computer for testing purposes.
For the password, I have set it to nothing for now, but will set it once I upload it to the net.
CODE
$dbHost = 'localhost';
$dbUser = 'root';
$dbPass = '';
$dbName = 'sermons';
$db = mysql_connect("$dbHost","$dbUser","$dbPass");
if (!$db) { die('Error : ' . mysql_error()); }
$select_db = mysql_select_db($dbName,$db);
if (!$select_db) { die('Error : ' . mysql_error()); }
And here is the query code that I've *sort of* edited for my needs.
CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Query test page</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="content-language" content="en-us" />
<meta http-equiv="Imagetoolbar" content="no" />
<link rel="stylesheet" href="sah-css.css" type="text/css" />
</head>
<body>
<?php include_once ("global_config.php"); ?>
// All HTML code here, until you want to run your query
<?php
$sql = "SELECT UserID, Username, EmailAddr, EncPass, EmailSent, Joined FROM User WHERE Verified = '0'";
$result = mysql_query($sql, $db);
$count = mysql_num_rows($result);
if($count == 0)
{
echo '<p>No unvalidated members.</p>';
}
while($row = mysql_fetch_assoc($result))
{
$UserID = $row['UserID'];
$Username = stripslashes($row['Username']);
$EmailAddr = stripslashes($row['EmailAddr']);
$EncPass = stripslashes($row['EncPass']);
$EmailSent = stripslashes($row['EmailSent']);
$Joined = date("d.m.y",$row['Joined']);
echo '<div class="Member">'."\n";
echo ' <h4>'.$UserID.' - <a href="mailto:'.$EmailAddr.'" title="Send mail to '.$Username.'">'.$Username.'</a> <span class="Validation"><a href="http://www.joe2torials.com/reg/check.php?U='.$Username.'&E='.$EmailAddr.'&S='.$EmailSent.'&EP='.$EncPass.'" title="User Validation Link">(click to validate)</a></span></h4>'."\n";
echo ' <p><em>Registered: not yet registered</em></p>'."\n";
echo '</div>'."\n\n";
}
?>
</body>
</html>
I said all of that to ask this: I don't understand the first line of variable values (is that the correct term??).
QUOTE
$sql = "SELECT UserID, Username, EmailAddr, EncPass, EmailSent, Joined FROM User WHERE Verified = '0'";
Can I simply use: SELECT * FROM sermonaudio ? (Side question: CAPS isn't an issue in mySQL is it?)
Basically what I am trying to do here is this:
I have a table called sermonaudio that has multiple fields (AudioDate, AudioTitle, AudioSpeaker). From a particular <td></td> tag set, I want to call the AudioDate, and from another <td>, AudioTitle. [I'm getting ahead of myself aren't I?]
Can you give some direction to this newbie please?
Thanks,
Just another artist