Moderators: Spunkmeyer, Dale Ray, Jackanape, SrNupsen, Bluetooth
FakeSQL
ClickCount SQL/PHP
bozoka45 wrote:Sorry for the late reply. I'll have to look into this, as I'm pretty sure I know whats causing the bug, I just need to figure out how to fix it.
foreach my $i(@field) {
$escaped = $dbh->quote(${$i}); #Escape Characters
if($escaped ne NULL) {
$values .= "`" . $i . "` = " . $escaped . ", ";
}
}
foreach my $i(@field) {
$escaped = $dbh->quote(${$i}); #Escape Characters
if($escaped ne NULL) {
$values .= "`" . $i . "` = " . $escaped . ", ";
} elsif ($fieldDB{$i}->{'FieldType'} == 4) {
$values .= "`" . $i . "` = '', ";
}
}
bozoka45 wrote:
- Code: Select all
foreach my $i(@field) {
$escaped = $dbh->quote(${$i}); #Escape Characters
if($escaped ne NULL) {
$values .= "`" . $i . "` = " . $escaped . ", ";
} elsif ($fieldDB{$i}->{'FieldType'} == 4) {
$values .= "`" . $i . "` = '', ";
}
}
Basically, if the field is NULL, IE, there's nothing there, then it doesn't put it in the SQL statement. It saves a little speed. Well, if its a checkbox, then its kinda important if its unchecked or not, so thats what the elsif statement is for.
$escaped = $dbh->quote(${$i});
$escaped =~ s/\"/\\\"/;
bozoka45 wrote:This is a quick, untested fix that should work (let me know, please).
Around lind 152, find:
- Code: Select all
$escaped = $dbh->quote(${$i});
After that, add:
- Code: Select all
$escaped =~ s/"/\\"/;
Basically, that should find all double quotes and replace it with ", basically what add slashes does.
BTW, if you're doing an SQL query with PHP and use addslashes(), you don't need to use stripslashes() when using the data, the slashes are "removed" when inserted into the database.
$escaped = $dbh->quote(${$i});
$escaped =~ s/"/\\"/;
Return to Addon Release and Support
Users browsing this forum: No registered users and 1 guest