R
Richter B
Guest
Below is my script. Currently, the way its set up works perfectly. I am able to pull records off my sql database and display info only. I need to add the ability to assign values based on the displayed values. For instance, Our students are registered for 3 classes, 1A, 2C, 3D. I need to show the actual name of the classes (vs what’s in the system) so when they log in to view their info, they wont see "You are registered for: 1C" but rather "You are registered for: 1C - Business Development" Below are both my sets of code. I need to join them but am unsure as to how. Any help you can provide would be greatly appreciated. Thank you.
<?
$username="name";
$password="pass";
$database="mydatabase";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM contacts";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$class=mysql_result($result,$i,"class");
echo "<b>$first $last</b><br>
Class: $class";
$i++;
}
?>
I want to add this
$Class = "1A";
if ( $Class == "1A" )
{
echo "Business Development";
}
<?
$username="name";
$password="pass";
$database="mydatabase";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM contacts";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$class=mysql_result($result,$i,"class");
echo "<b>$first $last</b><br>
Class: $class";
$i++;
}
?>
I want to add this
$Class = "1A";
if ( $Class == "1A" )
{
echo "Business Development";
}