 |
| Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

December 31st, 2009, 07:38 AM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
trying to insert record but i don't know why it does not
this is the sql that is processed but returns 0 errors. i realise it is incomplete, but why does it get chopped off? i did use the mysql_real_escape_string() function around the attributes array seperated by <br /> in the join. i've replaced this with ", ", and the sql string is now complete, but it still won't insert records.
what's puzzling me now is why would a possibly escaped < cut off the rest of the query? the value of $attribs = "Test Attribute 1 = Test Value 1<br />Test Attribute 2 = Test Value 3". this is confirmed in the email sent if no errors after inserting the record with this problematic line.
INSERT INTO 6_serviceleads (text_Consumer, text_LeadSubject, text_LeadAttributes, text_LeadMessage, bigint_ServiceID, bigint_SupplierID, bigint_RegionID) VALUES ("Piet Pompies;[email protected]","test subject","Test Attribute 1 = Test Value 1
INSERT INTO 6_serviceleads (text_Consumer, text_LeadSubject, text_LeadAttributes, text_LeadMessage, bigint_ServiceID, bigint_SupplierID, bigint_RegionID) VALUES ("Piet Pompies;[email protected]","test subject","Test Attribute 1 = Test Value 1, Test Attribute 2 = Test Value 3","test message",1,2,8);
the php where it's used is the following (had to keep lines shorter to fit on board due to no wrapping):
PHP Code:
$sql1 = "INSERT INTO 6_serviceleads ( text_Consumer, text_LeadSubject, text_LeadAttributes, text_LeadMessage, bigint_ServiceID, bigint_SupplierID, bigint_RegionID ) VALUES ( \"".$consumerfullname.";".$consumeremail."\",\"". $subject."\",\"". $attribs."\",\"". $message."\",". $service.",". $supplierids[$i].",". $region.");\n"; $sql .= $sql1; $result1 = mysql_query($sql1); $err = mysql_error(); $sql .= strtoupper($err)."\n";
the connection is made successfully, column namesand datas are valid from what i can see. here is the table layout, copied and pasted from phpmyadmin to notepad and edited a bit for here.
Quote:
column name, datatype, collation, attributes, null, default, extra, keys
================================================== =====
bigint_LeadID, bigint(64), None, None, No, None, auto_increment, Primary
text_Consumer, text, utf8_unicode_ci, None, No None, None, Fulltext
text_LeadSubject, text, utf8_unicode_ci, None, No, None, None, Fulltext
text_LeadAttributes, text, utf8_unicode_ci, None, No, None, None, Fulltext
text_LeadMessage, text, utf8_unicode_ci, None, No, None, None, Fulltext
bigint_ServiceID, bigint(64), None, None, No, None, None, None
bigint_SupplierID, bigint(64), None, None, No, None, None, None
bigint_RegionID, bigint(64), None, None, No, None, None, None
tinyint_LeadSent, tinyint(1), None, None, Yes, 0, None, None
timestamp_LeadCreated, timestamp, None, on update CURRENT_TIMESTAMP, Yes, CURRENT_TIMESTAMP, on update CURRENT_TIMESTAMP, None
|
__________________
Sincerely,
Pierre "Greywacke" du Toit
[email protected]
don't worry about my 0 thankyou's either way, i would say thank you should you help, and i will gladly help others when this work rush is over.
Last edited by Greywacke; December 31st, 2009 at 10:07 AM..
|
|

December 31st, 2009, 10:09 AM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
issue solved
okay, it inserts again and runs through the loops. the problem was the missing $result1 = mysql_query($sql1);. so much code you don't even notice the simple things 0o
__________________
Sincerely,
Pierre "Greywacke" du Toit
[email protected]
don't worry about my 0 thankyou's either way, i would say thank you should you help, and i will gladly help others when this work rush is over.
|
|
 |