0

website running php 5.2. Inputting text in my search box containing an apostrophe throws up this message : You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 's%' ORDER BY name,shortdesc ASC LIMIT 0,20' at line 1

Here is part of my search.php script. Any help would be appreciated.

function resultados(){

$acc         = $_GET['acc'];
$byartiste = ereg_replace("'","'",$_GET['byartiste']);
$bytitle     = ereg_replace("'","'",$_GET['bytitle']);
$L             = $_GET['L'];
Jeff
  • 1
  • Your PHP version is very badly EOL. It's long past the time to upgrade. https://php.net/supported-versions – ADyson Mar 20 '21 at 13:17
  • You can try this one **$text = mysql_real_escape_string(trim($text))** or **$text = str_replace(array("'"), "\'", $text);** – rsmdh Mar 20 '21 at 15:10

0 Answers0