RE: No data being put into the DB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert,

I'm assuming that you have an open database connection and that you have
just omitted it from your post for convenience sake.

I'll keep looking at your code, but my first suggestion would be for you to
echo $addtocart before you submit it to the database. This will show you the
exact query string that is being sent. Maybe there's an error in there, but,
like I said, I'll keep looking.

Oh, and, normally, you reference the variables like so: $_POST["varname"]. I
typically use the following syntax:

"INSERT INTO tablename
VALUES('".$_POST["varone"]."','".$_POST["vartwo"]."');

In your query you have omitted the quotes. Don't know if that causes
problems, but echoing out $addtocart would show that anyway.

HTH
Rich

-----Original Message-----
From: Robert Sossomon [mailto:robert@xxxxxxxxxxxx]
Sent: Wednesday, March 03, 2004 5:36 PM
To: php-db@xxxxxxxxxxxxx
Subject:  No data being put into the DB


I have a form:
http://www.garlandcnorris.com/registration_tradeShow.html

That then goes to this page:
<code>
$display_block = "";
$date_sub = date("mdY - H:i:s");

$addtocart = "insert into show
values('','$_POST[Accnt_name]','$_POST[acc_num]','$_POST[email]','$_POST
[auth_buyer]','$_POST[attend_1]','$_POST[attend_2]','$_POST[attend_3]','
$_POST[num_att]', '$date_sub')";
$result = mysql_query($addtocart);
mysql_close();
$error = mysql_error();
print "the query I just ran was: $addtocart<br>";
print "the result I just ran was: $result<br>";
print "the error I just ran was: $error<br>";


$display_block = "";
$display_block .= "<center><h1>Thank you for registering for the Garland
C Norris 100 year Celebration Trade Show and
party!</h1></center>\n<BR><BR>\n<ul>The information you submitted on
$date_sub was:<li>Account Name: $_POST[Accnt_name]<li>Account Number:
$_POST[acc_num]<li>Email Address: $_POST[email]<li>Authorized Buyer:
$_POST[auth_buyer]<li>Attendee: $_POST[attend_1]<li>Attendee:
$_POST[attend_2]<li>Attendee: $_POST[attend_3]<li># Attending Party:
$_POST[num_att]</li></ul>";

$sendto = "$_POST[email]";
$subject = "Registration Details";
$message = "Thank you for registering for the Garland C Norris 100 year
Celebration Trade Show and party! \n\n The information you submitted on
$date_sub was: \n Account Name: $_POST[Accnt_name] \n Account Number:
$_POST[acc_num] \n Email Address: $_POST[email] \n Authorized Buyer:
$_POST[auth_buyer]\nAttendee: $_POST[attend_1]\nAttendee:
$_POST[attend_2]\nAttendee: $_POST[attend_3]\n# Attending Party:
$_POST[num_att]";
$header = 'From: registration@xxxxxxxxxxxx';

mail($sendto, $subject, $message,$header);

$display_block .= "<BR><BR>\n<a
href=\"http://www.gcnorris.com/index3.html\";>Click Here</a> to continue
through to the Garland C Norris Website.<BR><BR> You should be receiving
an email shortly with the information you have just submitted.<BR><BR>We
look forward to seeing you in May!";


?>
<HTML>
<HEAD>
<TITLE>Thanks For Registering</TITLE>
<style type="text/css">
 <!--
 A{text-decoration:none}
 H{text-transform:capitalize}
 -->
</style>
</HEAD>
<body bgcolor="#ffffff" topmargin="0" leftmargin="0" bottommargin="0"
rightmargin="0" marginwidth="0" marginheight="0" height="100%"
width="100%">
<?print $display_block; ?>
</BODY>
</HTML>

</end code>

This is the results:
the query I just ran was: insert into show values('','robert\'s
Test','123456','robert@xxxxxxxxxxxx','Robert','','','','69', '03032004 -
17:30:20')
the result I just ran was:
the error I just ran was:

Thank you for registering for the Garland C Norris 100 year Celebration
Trade Show and party!

The information you submitted on 03032004 - 17:30:20 was:
Account Name: robert\'s Test
Account Number: 123456
Email Address: robert@xxxxxxxxxxxx
Authorized Buyer: Robert
Attendee:
Attendee:
Attendee:
# Attending Party: 69

DB Table:
Empty

Field descriptions:
CREATE TABLE `show` (
  `id` int(11) NOT NULL default '0',
  `act_name` text,
  `acc_num` int(6) default '0',
  `email` text,
  `auth_buyer` text,
  `attend_1` text,
  `attend_2` text,
  `attend_3` text,
  `num_att` int(2) default NULL,
  `date_sub` text,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM;


There are no errors in the php-error log, the mysql error log, the httpd
error log, however there is NOTHING in my 'show' table right now and I
should have about 80 things in there.

Any thoughts??  I am at my wits end trying to figure out the goofy
thing.  I have counted the fields (10 for each) so I made doubly sure I
have 10 fields in the DB table

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux