Hi Ian,
Thanks for help! The columns and variables are exactly matched so it
shouldn't be the problem. Actually the original html and php files are
pretty long. But I
guess a more detailed script should help you diagnose the problem. The
error message to the below script is:
---------------------------------
call someoneDB Error:
Warning: mssql_num_rows(): supplied argument is not a valid Sybase
result resource ... line 88
----------------------------------
//... is the folder this file is in//
Here is the (almost) full script:
<?php
// some MS SQL server connection thing that I can't show here :-) //
// below is the original script.//
if (!(isset($_POST['NetID']))) {
$NetID = "" ;
} else {
$NetID = $_POST['NetID'] ;
}
if (!(isset($_POST['FirstName']))) {
$FirstName = "" ;
} else {
$FirstName = $_POST['FirstName'] ;
}
if (!(isset($_POST['LastName']))) {
$LastName = "" ;
} else {
$LastName = $_POST['LastName'] ;
}
if (!(isset($_POST['Email']))) {
$Email = "" ;
} else {
$Email = $_POST['Email'] ;
}
if (!(isset($_POST['Major']))) {
$Major = "" ;
} else {
$Major = $_POST['Major'] ;
}
if (!(isset($_POST['Classification']))) {
$Classification = "" ;
} else {
$Classification = $_POST['Classification'] ;
}
if (!(isset($_POST['How']))) {
$How = "" ;
} else {
$How = $_POST['How'] ;
}
if (!(isset($_POST['Description']))) {
$Description = "" ;
} else {
$Description = $_POST['Description'] ;
}
if(empty($NetID) OR empty($FirstName) OR empty($LastName) OR
empty($Email) OR empty($Major) OR empty($Classification) OR
empty($How) OR
empty($Description))
{
echo "Oops, you must complete the form to register. Please use the
browser back button to go back and complete the form.";
echo "</body></html>";
exit;
}
$qry = "insert into reg values (";
$qry = $qry."'$NetID'";
$qry = $qry.",'$FirstName'";
$qry = $qry.",'$LastName'";
$qry = $qry.",'$Email'";
$qry = $qry.",'$Major'";
$qry = $qry.",'$Classification'";
$qry = $qry.",'$How'";
$qry = $qry.",'$Description'";
$qry = $qry.")";
$rs=$db->query ($qry);
if (DB::iserror($rs)){print"call someone"; print $rs->getMessage();}
$result = mssql_query("SELECT * FROM reg");
$num_rows = mssql_num_rows($result) ;
if ($num_rows > 10)
{
echo "Sorry, our registration is full. Please stay tuned till the
next one.";
}
else
{
echo "Congratulations, $FirstName! Your have registered for --- ";
echo "<p>";
}
?>
Hope it is clearer now. What's most frustrating is that it worked for
a while, but then when I expanded the columns from 3 to 8 and it just
messed up. So what
went wrong?
Newbie