RE: [PHP-DB] No data being put into the DB
Yeah, I prefer the ... '".$_POST["varname"]."' ... syntax primarily because of the way my editor (EditPlus) highlights the code. I tried the braces syntax in EditPlus and it doesn't highlight the same way. I'll check out the editors you guys (Jason and Jeffrey) use to see if I like them and maybe I'll switch (especially if they're free :) ). I'll admit, the whole quote-dot syntax thing is a bigger pain than the braces syntax. But I'm not aware of any performance or security issues related to the use of quote-dot notation. If there are any, I'd certainly like to be made aware of them. However, I think it comes down to issues of personal preference and the coding standards of your individual corporate environment or client. > -Original Message- > From: Jason Wong [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 03, 2004 10:09 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] No data being put into the DB > > > On Thursday 04 March 2004 10:36, [EMAIL PROTECTED] wrote: > > > >>IMO it is better to use the braces syntax: > > >>"insert into show > > >>values('','{$_POST['Accnt_name']}','{$_POST['acc_num']}', ...)" > > > > I'm not second guessing at all, just curious as to why? Is > it less work on > > the parser? > > Do you find it cleaner? > > Consistent - items in arrays are always referenced by $array['item']. > Clean - no jumping in and out of double-quotes > > > I've often used Richard's method myself, for the > > color coding that shows > > in my editors(Ultraedit and VIM) when concatenating with . > , mainly for > > readability...but have found myself, of late, using the > braces more... > > The braces syntax highlights fine on Quanta. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications > Development * > -- > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-db > -- > /* > Never go to bed mad. Stay up and fight. > -- Phyllis Diller, "Phyllis Diller's Housekeeping Hints" > */ > > -- > 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
Re: [PHP-DB] No data being put into the DB
Hello. I'm not sure, but, witch version of php are u using ? replace all the instances of $_POST[varname] with $HTTP_POST_VARS[' varname '] and see what happens !!! Cheers Robert Sossomon wrote: I have a form: http://www.garlandcnorris.com/registration_tradeShow.html That then goes to this page: $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"; print "the result I just ran was: $result"; print "the error I just ran was: $error"; $display_block = ""; $display_block .= "Thank you for registering for the Garland C Norris 100 year Celebration Trade Show and party!\n\nThe information you submitted on $date_sub was:Account Name: $_POST[Accnt_name]Account Number: $_POST[acc_num]Email Address: $_POST[email]Authorized Buyer: $_POST[auth_buyer]Attendee: $_POST[attend_1]Attendee: $_POST[attend_2]Attendee: $_POST[attend_3]# Attending Party: $_POST[num_att]"; $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: [EMAIL PROTECTED]'; mail($sendto, $subject, $message,$header); $display_block .= "\nhttp://www.gcnorris.com/index3.html\";>Click Here to continue through to the Garland C Norris Website. You should be receiving an email shortly with the information you have just submitted.We look forward to seeing you in May!"; ?> Thanks For Registering
rightmargin="0" marginwidth="0" marginheight="0" height="100%" width="100%"> This is the results: the query I just ran was: insert into show values('','robert\'s Test','123456','[EMAIL PROTECTED]','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: [EMAIL PROTECTED] 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
Re: [PHP-DB] No data being put into the DB
On Thursday 04 March 2004 10:36, [EMAIL PROTECTED] wrote: > >>IMO it is better to use the braces syntax: > >>"insert into show > >>values('','{$_POST['Accnt_name']}','{$_POST['acc_num']}', ...)" > > I'm not second guessing at all, just curious as to why? Is it less work on > the parser? > Do you find it cleaner? Consistent - items in arrays are always referenced by $array['item']. Clean - no jumping in and out of double-quotes > I've often used Richard's method myself, for the > color coding that shows > in my editors(Ultraedit and VIM) when concatenating with . , mainly for > readability...but have found myself, of late, using the braces more... The braces syntax highlights fine on Quanta. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Never go to bed mad. Stay up and fight. -- Phyllis Diller, "Phyllis Diller's Housekeeping Hints" */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] No data being put into the DB
On Thursday 04 March 2004 08:08, Rich Hutchins wrote: > 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"]."'); >>IMO it is better to use the braces syntax: >>"insert into show >>values('','{$_POST['Accnt_name']}','{$_POST['acc_num']}', ...)" I'm not second guessing at all, just curious as to why? Is it less work on the parser? Do you find it cleaner? I've often used Richard's method myself, for the color coding that shows in my editors(Ultraedit and VIM) when concatenating with . , mainly for readability...but have found myself, of late, using the braces more... Thanks Jeff > In your query you have omitted the quotes. Don't know if that causes > problems, but echoing out $addtocart would show that anyway. >>Also ... > mysql_close(); > $error = mysql_error(); >>call mysql_error() before you close the connection. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* If you give Congress a chance to vote on both sides of an issue, it will always do it. -- Les Aspin, D., Wisconsin */ -- 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
Re: [PHP-DB] No data being put into the DB
On Thursday 04 March 2004 08:08, Rich Hutchins wrote: > 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"]."'); IMO it is better to use the braces syntax: "insert into show values('','{$_POST['Accnt_name']}','{$_POST['acc_num']}', ...)" > In your query you have omitted the quotes. Don't know if that causes > problems, but echoing out $addtocart would show that anyway. Also ... > mysql_close(); > $error = mysql_error(); call mysql_error() before you close the connection. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* If you give Congress a chance to vote on both sides of an issue, it will always do it. -- Les Aspin, D., Wisconsin */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] No data being put into the DB
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:[EMAIL PROTECTED] Sent: Wednesday, March 03, 2004 5:36 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] No data being put into the DB I have a form: http://www.garlandcnorris.com/registration_tradeShow.html That then goes to this page: $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"; print "the result I just ran was: $result"; print "the error I just ran was: $error"; $display_block = ""; $display_block .= "Thank you for registering for the Garland C Norris 100 year Celebration Trade Show and party!\n\nThe information you submitted on $date_sub was:Account Name: $_POST[Accnt_name]Account Number: $_POST[acc_num]Email Address: $_POST[email]Authorized Buyer: $_POST[auth_buyer]Attendee: $_POST[attend_1]Attendee: $_POST[attend_2]Attendee: $_POST[attend_3]# Attending Party: $_POST[num_att]"; $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: [EMAIL PROTECTED]'; mail($sendto, $subject, $message,$header); $display_block .= "\nhttp://www.gcnorris.com/index3.html\";>Click Here to continue through to the Garland C Norris Website. You should be receiving an email shortly with the information you have just submitted.We look forward to seeing you in May!"; ?> Thanks For Registering This is the results: the query I just ran was: insert into show values('','robert\'s Test','123456','[EMAIL PROTECTED]','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: [EMAIL PROTECTED] 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