473,320 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

HELP: "insert into" problem in PHP (2)

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
Jul 16 '05 #1
0 1879

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: newbie_mw | last post by:
Hi, I need urgent help with a novice problem. I would appreciate any advice, suggestions... Thanks a lot in advance! Here it is: I created a sign-up sheet (reg.html) where people fill in their...
1
by: newbie_mw | last post by:
Seems my post was buried in more cries for help :-) I will try again. It's probably a very novice question so please take a look! Thanks!...
9
by: Luc Dal | last post by:
Hello, I've serious problem using ASP under WindowsXP sp2. I get the following reply (sorry it's in french) Erreur de compilation Microsoft VBScript error '800a0401' Fin d'instruction...
5
by: Chad Richardson | last post by:
Is there a way in SQL Server 2000 to extract data from a table, such that the result is a text file in the format of "Insert Into..." statements, i.e. if the table has 5 rows, the result would be 5...
2
by: CFW | last post by:
I use the following flawlessly to insert a single field: strSQL = "Insert into (Casket) Values " _ & "(" & conQuote & NewCasket & conQuote & ")" Set db = CurrentDb If MsgBox(NewCasket & " is...
3
by: Ed | last post by:
Hi, I want to load data to a table in Sql Server from a dataset table in my vb.net app using a dataAdapter. I know how to do this as follows (my question is to see if I can reduce the amount...
0
by: MarceloLinero | last post by:
Hi, i`m problem whith it !! help me ! No found way for insert in table directy in database sql express and no undertand why ! steps in general: 1. create coneccion ready 2. declarate a...
4
by: Takeadoe | last post by:
Dear NG - I've got a bunch of SQL statements (Insert Into "Access Table Name") generated from another software program. They look like this: Pasting these lines into the SQL view as they are...
13
by: shankindc | last post by:
Hi, I have a data entry form which opens default values each time the form is open. Requirement is that users can edit existing data in the form. When the form is closed, it shouldnt update the...
6
by: ewpatton | last post by:
Good day, I've been trying to work with SQL and an Access database in order to handle custom user profiles. I haven't had any trouble reading from my database, but inserting new entries into...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.