Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8794231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:13:27+00:00 2026-06-13T23:13:27+00:00

$sql=SELECT `name` FROM $table ; what happens if into the records from name column

  • 0
$sql="SELECT `name` FROM $table ";

what happens if into the records from name column there are quotes (‘) ?
I need to change that SELECT query? And how? I noticed that Mysql reports an error like this:

1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘activation)” at line 3

’cause ‘activation is not good…
but well…why can i read and manipulate the string variable if it returns an error?
I saw exemples that use a WHERE condition…but I don’t need that, I have to select all the records from the name column… please help

edit:

//..connection to database part, then...


    $sql="SELECT `name` FROM $table ";
    $res=mysql_query($sql);


    $c=0;
    function contains($str, array $arr)
    {
        foreach($arr as $a) {
            if (stripos($str,$a) !== false) return true;
        }
        return false;
    }
    $arr = array("à","â","æ","ç","è","é","ê","ë","î","ï","ô","œ","ù","û","ü","¡","¿","ñ","í","ó","ú","ä","ö","ß","ÿ");
    while ($row = mysql_fetch_row($res)) {
        $contiene = 0;
        $link=strtolower($row[0]);
        $link = iconv('Windows-1252', 'UTF-8//TRANSLIT//IGNORE', $link);
        $link= utf8_decode($link);
        $link = stripslashes($link);
        $link = mysql_real_escape_string($link);
        if (contains($link, $arr)) {
            echo "String containing special char\n";
            echo "$link\n";         
            $link = str_replace("à", "a", $link);
            $link = str_replace("â", "a", $link);
            $link = str_replace("æ", "ae", $link);
            $link = str_replace("ç", "c", $link);
            $link = str_replace("è", "e", $link);
            $link = str_replace("é", "e", $link);
            $link = str_replace("ê", "e", $link);
            $link = str_replace("ë", "e", $link);
            $link = str_replace("î", "i", $link);
            $link = str_replace("ï", "i", $link);
            $link = str_replace("ô", "o", $link);
            $link = str_replace("œ", "oe", $link);
            $link = str_replace("ù", "u", $link);
            $link = str_replace("û", "u", $link);
            $link = str_replace("ü", "ue", $link);
            $link = str_replace("¡", "-", $link);
            $link = str_replace("¿", "-", $link);
            $link = str_replace("ñ", "n", $link);
            $link = str_replace("í", "i", $link);
            $link = str_replace("ó", "o", $link);
            $link = str_replace("ú", "u", $link);
            $link = str_replace("ä", "ae", $link);
            $link = str_replace("ö", "oe", $link);
            $link = str_replace("ß", "ss", $link);
            $link = str_replace("ÿ", "y", $link);
            echo "String with replaced char\n";
            echo "$link\n";
            $c++;
            $contiene = 1;
        }
        $link=ereg_replace("[^a-z0-9\-]", "-", $link);
        echo "String after ereplace:\n";        
        echo "$link\n"; 
        if ($contiene ==1){
            $l="UPDATE $table 
                SET link_rewrite='$link'
                WHERE $table.name = '$row[0]'   "; 
            $r=mysql_query($l);
            if (!$r) {
            echo mysql_errno() . ": " . mysql_error() . "\n";
            }
        }

    }

    echo "Update catlink_rewrite( $c )";

?>

what’s wrong?

String containing the accent or special char:

acer aspire one d270-n261g326ck noir + housse néoprène noir & rouge avec pochette frontale lneo-10 – jusqu’à 10,2″

String after str_replace:

acer aspire one d270-n261g326ck noir + housse neoprene noir & rouge avec pochette frontale lneo-10 – jusqu’a 10,2″

String after ereg_replace:

acer-aspire-one-d270-n261g326ck-noir—housse-neoprene-noir—rouge-avec-pochette-frontale-lneo-10—jusqu-a-10-2-

Mysql error:

1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘à 10,2″” at line 3

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:13:27+00:00Added an answer on June 13, 2026 at 11:13 pm
    $row[0] = mysql_real_escape_string($row[0]);
    

    Do this before the UPDATE query where the $row[0] is used. You are not escaping anything. Your code makes my eyes bleed… and is very unsafe.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When using this SQL query: Select * from table_name what happens if the name
i have this sql query select * from table where name like ? but
This is my SQL query: select name,description from wp_widget_custom where name in ('hemel-hempstead','maidenhead', 'guildford','bromley','east-london','hertfordshire','billericay','surrey')
Describe the output of the following SQL query: select custId, name from customer where
I written a query in my sql like this: select * from table_name order
Please, help me with join results of commands (MS SQL): SELECT name,value FROM table1
I have a SQL-statement like this: SELECT name FROM users WHERE deleted = 0;
I have the following SQL statement: SELECT ID, NAME FROM myTable WHERE ID LIKE
I'm trying to insert text which happens to contain a sql query into a
I have 2 labels that need to be given value from sql server db

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.