473,325 Members | 2,712 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,325 software developers and data experts.

multiple blank record entries?

Hey everyone,

I keep getting multiple blank records entered along with my data everytime
I submit my form.

On the first page is the form itself without any code. On the 2nd page that
it goes to after I hit submit is this:

<?

$select = "SELECT * FROM company,contact WHERE
contact.company_id=company.company_id ORDER BY contact.company_id DESC
LIMIT 10;";

$result = mysql_query($select)or die("Invalid query: " . mysql_error());

while ($row = mysql_fetch_assoc($result)) {

print '<b>'.$row['Subject'].'</b>'.'<br>';
print $row['category'].'<br><br>';
print $row['name'].' - ';
print $row['email'].'<br><br>';
print $row['location'].'<br><br>';
}
?>
Now everytime I hit submit on that page I get three other entries entered
in at the same time. Also when I go to this page straight the data is
displayed in an order I can't figure out.

Any help is appreciated, thanks!
Jul 17 '05 #1
5 1860
John wrote:
Hey everyone,

I keep getting multiple blank records entered along with my data everytime
I submit my form.

On the first page is the form itself without any code. On the 2nd page that
it goes to after I hit submit is this:

<?

$select = "SELECT * FROM company,contact WHERE
contact.company_id=company.company_id ORDER BY contact.company_id DESC
LIMIT 10;";

$result = mysql_query($select)or die("Invalid query: " . mysql_error());

while ($row = mysql_fetch_assoc($result)) {

print '<b>'.$row['Subject'].'</b>'.'<br>';
print $row['category'].'<br><br>';
print $row['name'].' - ';
print $row['email'].'<br><br>';
print $row['location'].'<br><br>';
}
?>
Now everytime I hit submit on that page I get three other entries entered
in at the same time. Also when I go to this page straight the data is
displayed in an order I can't figure out.

Any help is appreciated, thanks!


I might be missing something here, but I'm not seeing an INSERT or
UPDATE command anywhere here.

-Jay

Jul 17 '05 #2
Jay Moore <ad*****@isp.tld> wrote in
news:NX*************@twister.rdc-kc.rr.com:

I might be missing something here, but I'm not seeing an INSERT or
UPDATE command anywhere here.


oops, here is the insert info is:

<?

$query = "INSERT INTO optional (Subject,search_terms,location) VALUES
('$Subject','$Keywords','$Description')";
mysql_query($query) or die("Invalid query: " . mysql_error());

$query = "INSERT INTO company
(category,country,name,phone_num,fax,address,city) VALUES
('$Industry','$country','$CompanyName','$Tel','$Fa x','$MailingAdd','$city')
";
mysql_query($query) or die("Invalid query: " . mysql_error());

$query = "INSERT INTO contact (last_name,email) VALUES ('$Name','$Email')";
mysql_query($query) or die("Invalid query: " . mysql_error());
?>

Jul 17 '05 #3


John wrote:
<snip stuff>


Try commenting out your mysql_query() lines and echoing the $query to
see if it changes.

-Jay

Jul 17 '05 #4
Jay Moore <ad*****@isp.tld> wrote in news:3B***************@twister.rdc-
kc.rr.com:


John wrote:
<snip stuff>


Try commenting out your mysql_query() lines and echoing the $query to
see if it changes.

-Jay

Ok, that just stopped everything from entered, but I think you're on the
right track.

Here's the input again:

<?

$query = "INSERT INTO optional (Subject,search_terms,intro) VALUES
('$Subject','$Keywords','$Description')";
// mysql_query($query) or die("Invalid query: " . mysql_error());

$query = "INSERT INTO company
(category,country,name,phone_num,fax,address,city) VALUES
('$Industry','$country','$CompanyName','$Tel','$Fa x','$MailingAdd','$cit
y')";
// mysql_query($query) or die("Invalid query: " . mysql_error());

$query = "INSERT INTO contact (last_name,email) VALUES
('$Name','$Email')";
// mysql_query($query) or die("Invalid query: " . mysql_error());
?>

How can I combine all those into one query instead of 3 seperate ones?
If I do that I think it should fix it.

Thanks again in advance :-)
Jul 17 '05 #5
John wrote:
Ok, that just stopped everything from entered, but I think you're on the
right track.
That was the point. I didn't want anything entered, just wanted to know
what the query was each time it got to a '$query =' line.
How can I combine all those into one query instead of 3 seperate ones?
If I do that I think it should fix it.


I'm no MySQL or PHP expert, but as far as I know, there is no way to
INSERT into multiple databases with one statement. If I'm wrong, I'd
appreciate someone telling me how to do it.

-Jay

Jul 17 '05 #6

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

Similar topics

2
by: John | last post by:
Hello all, new problem... When I go to my secondary page of results after I fill info out on a form on the first, I get 3 blank entries automatically inserted into the mysql tables. This second...
4
by: William Wisnieski | last post by:
Hello Everyone, Access 2000 I have a form with multiple pages on it. There is one text field on the third page of the form that I need the user to complete before leaving the form or moving...
1
by: ccr | last post by:
Please view in a text editor so that the columnar text lines up. I used Terminal 9pt font to compose this post and copied/pasted to my newsreader program. I am writing in the hope that one of...
1
by: ccr | last post by:
Reposted with a longer line length. Apologies if I did not cancel the 1st attempt before you got it. If necessary, please view in a text editor so the columnar text lines up. I used Terminal...
0
by: misscrf | last post by:
I am currently working on a database, in 3rd normal form, which is for candidates who apply for a job with the law firm that I workd for. My issue is with good form design. I have a main...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
5
by: JP SIngh | last post by:
Hi All This is a complicated one, not for the faint hearted :) :) :) Please help if you can how to achieve this search. We have a freetext search entry box to allow users to search the...
2
by: stevenrec | last post by:
Hi all, looking for a direction on how to accomplish something someone has surely done before: Have a List Box with article desciptions. Want 3 text boxes where someone enters what they are...
7
by: Birky | last post by:
All, I have scrubbed the archives to see if someone else has requested this type of help but I have not been able to find anything that fits this scenario. I have a form (which is working...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.