|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Inserting string Values into Table
ok, I'm having trouble getting the following to Parse because the Value for $insert_item is a string that contains commas (,)
Code:
$sql = "INSERT INTO $inv_item (invoicenumber, qty, item) VALUES
('$insert_invoicenumber', '$insert_qty', '$insert_item')";
any suggestions? |
|
#2
|
|||
|
|||
|
RE: Inserting string Values into Table
ok i just went back and did
Code:
mysql_escape_string but to no effect.. =( |
|
#3
|
|||||
|
|||||
|
RE: Inserting string Values into Table
I don't think comma would be a problem... can you echo your sql statement and check what values are there?
php Code:
|
|
#4
|
|||
|
|||
|
RE: Inserting string Values into Table
ok heres the code i have:
Code:
<?
if ( $_POST[add_invoicenumber] and $_POST[add_qty] and $_POST[add_item] )
{
$db_name = "steelskindata";
$connection = @mysql_connect("localhost", "steelskin", "winter")
or die (mysql_error());
$db = @mysql_select_db($db_name, $connection) or
die(mysql_error());
$insert_invoicenumber = $_POST[add_invoicenumber];
$insert_qty = $_POST[add_qty];
$insert_item = "(mysql_escape_string($_POST[add_item]))";
$sql = "INSERT INTO $inv_item (invoicenumber, qty, item) VALUES
('$insert_invoicenumber', '$insert_qty', '$insert_item')";
echo "$sql";
$result = @mysql_query($sql, $connection) or die(mysql_error());
exit;
}
?>
and the error i get reads: INSERT INTO (invoicenumber, qty, item) VALUES ('36', '55', '(mysql_escape_string(18 gauge , 1/4 length , BB , NOTES: ))')You have an error in your SQL syntax near '(invoicenumber, qty, item) VALUES ('36', '55', '(mysql_escape_string(18 gauge , ' at line 1 |
|
#5
|
|||
|
|||
|
RE: Inserting string Values into Table
this is the string value for the item:
18 gauge , 1/4 length , BB , NOTES: i think that slash is doing something... |
|
#6
|
|||||
|
|||||
|
RE: Inserting string Values into Table
Run this code and see...
php Code:
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > Inserting string Values into Table |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|