I cannot figure out why the mysql_query is not working.  Everything id done
according to Julie's book and I end up with the "Couldn't execute query"
error

Here is the script:

<?

if ((!$FirstName) || (!$LastName)) {
 header("Location: http://localhost/show_addcontact.php";);
 exit;

} else {

 session_start();

}

if ($valid != "yes") {
 header("Location: http://localhost/contact_menu.php";);
 exit;

} else {

 session_register('valid');

}


$db_name = "feminineforum";
$table_name = "tblmembers";

$connection = @mysql_connect("localhost", "feminine", "krmc33") or
die("Couldn't connect.");

$db = @mysql_select_db($db_name, $connection) or die("Couldn't select
database.");

$sql = "INSERT INTO tblmembers
ID, FirstName, Initial,  LastName,  Address1,  Address2,  City,  State,
Zip,  HomePhone,  WorkPhone,  Fax,  Email,  UserId,  Password)
VALUES
('$FirstName', '$Initial', '$LastName', '$Address1', '$Address2', '$City',
'$State', '$Zip', '$HomePhone', '$WorkPhone', '$Fax', '$email',

'$UserId', '$Password')";

$result = @mysql_query ($sql, $connection) or die ("couldn't execute
query.");
?>


<HTML>
<HEAD>
<TITLE>Feminine Forum Contact Management System</TITLE>
</HEAD>
<BODY>

<h1>Feminine Forum Contact Management System</h1>
<h2><em>Add a Contact - Contact Added</em></h2>
<P>The following information was successfully added to <? echo
"$table_name"; ?></p>
<table cellspacing=3 cellpadding=5>

<tr>
<th>NAME & ADDRESS INFORMATION</th>
<th>OTHER CONTACT/PERSONAL INFORMATION</th>
</tr>

<tr>
<td valign=top>
<P><STRONG>First Name:</STRONG><BR>
<? echo "$FirstName"; ?></P>

<P><STRONG>Last Name:</STRONG><BR>
<? echo "$LastName"; ?></P>

<P><STRONG>Address Line 1:</STRONG><BR>
<? echo "$Address1"; ?></P>

<P><STRONG>Address Line 2:</STRONG><BR>
<? echo "$Address2"; ?></P>

<P><STRONG>City:</STRONG><BR>
<? echo "$City"; ?></P>

<P><STRONG>Zip/Postal Code:</STRONG><BR>
<? echo "$Zip";
 ?>
</P>

</td>

<td valign=top>
<P><STRONG>Home Telephone Number:</STRONG><BR>
<? echo "$prim_tel"; ?></P>

<P><STRONG>Work Telephone Number:</STRONG><BR>
<? echo "$sec_tel"; ?></P>

<P><STRONG>E-mail Address:</STRONG><BR>
<? echo "$email"; ?></P>

<P><STRONG>UserId</STRONG><BR>
<? echo "$UserId"; ?></P>

<P><STRONG>Password</STRONG><BR>
<? echo "$Password"; ?></P>
</td>
</tr>

<tr>
<td align=center colspan=2><br>
<p><a href="contact_menu.php">Return to Main Menu</a></p>

</TD>
</TR>
</TABLE>


</BODY>
</HTML>



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to