note 82457 deleted from function.mysql-query by felipe
| From: | felipe@php.net | Date: | Tue, 15 Apr 2008 02:13:59 +0000 |
| Subject: | note 82457 deleted from function.mysql-query by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-138318@lists.php.net to get a copy of this message | ||
Note Submitter: chris at network-13 dot com
----
To massiv at nerdshack dot com,
the code you added to the SQL dump function to remove the ; character from the end of the query
<?php
$query = str_replace(";", "", "$query");
?>
not only removes it from the end but removes all instances of it altogether. I better solution would
be to use this
<?php
$lastchar = substr($query,strlen($query) - 1,strlen($query));
if($lastchar == ";"){
$query = substr($query,0,strlen($query) - 1);
}
?>