I am having a problem with some PHP code that accesses a database. When I attempt to preview the page with the scripts, I am getting the error "Unable to select database". The purpose of this code is to access a prayer database that (with this portion of the code) enables you to edit prayer requests as they are sent in. The code is in two different CGI files. They can be found below.
First CGI File: ApproveDenyPrayerRequest
<table cellpadding="10">
<tr>
<td>First Name</td>
<td>Last Name</td>
<td>Prayer Request</td>
</tr>
<?php
$username="fbc";
$password="xxxxxxxx";
$database="prayer";
mysql_connect('fbcaltusprayerorg'.ipagemysql.com,$username,$password.prayer);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM Request";
$result=mysql_query($query);
mysql_close();
while ($row=mysql_fetch_array($result)){
echo ("<tr><td>$row[Reg_F_Name]</td>");
echo ("<td>$row[Reg_L_Name]</td>");
echo ("<td>$row[Reg_Request]</td>");
echo ("<td><a href=\"cgi-bin/PrayerRequest.php?id=$row[id]\">Edit</a></td></tr>");
}
echo "</table>";
?>
Second CGI File: PrayerRequest
<?php
$username="fbc";
$password="xxxxxxxx";
$database="prayer";
mysql_connect('fbcaltusprayerorg.ipagemysql.com',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT * FROM Request";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
?>
<form method="post" action="cgi-bin/ApproveDenyPrayerRequest.php" />
<table>
<tr>
<td>First Name:</td>
<td><input type="text" name="first" value="<? echo "$row[Reg_F_Name]" ?>"></td>
</tr>
<tr>
<td>Last Name:</td>
<td><input type="text" name="last" value="<? echo "$row[Reg_L_Name]" ?>"></td>
</tr>
<tr>
<td>Prayer Request</td>
<td><input type="text" name="request" value="<? echo "$row[Reg_Request]" ?>"></td>
</tr>
</table>
</form>
Thanks all for your responses.