I have already read a lot of responses about this issue, and I didn't found the 100% correct.
The code I expect to create in php looks like this:
<a href="#" onclick="a_js_function('moduleSee.php','sql_restriction','popup')">See</a>
a_js_function() is an internal javascript function, it receives some arguments and will be called simply like this
$str = '<a href="#" onclick="';
$str .= " a_js_function('moduleSee.php','sql_restriction','popup')";
$str .='">See</a>';
But the sql_restriction argument contains a quote :
concat('000000',table_id)
And the NOT 100%-working solution is putting \' instead of ' => this allows to SQL query doing properly but creates a javascript error that blocks part of the page.
$str = '<a href="#" onclick="';
$str .= " a_js_function('moduleSee.php','concat(\'000000\',table.id)','popup')";
$str .='">See</a>';
See what chrome says:
Uncaught SyntaxError: Unexpected number -> point the numbers of received argument: concat('000000',table.id)
because with the \' receive ' between the 000, the argument of the js function make error, not SQL. Avoiding this quotes in the number make that SQL query doesn't work
putting ' or \" or \\' or '' doesn't work too, addslashes() neither
Any ideas?
sql_restrictiondirectly to the database? If you are then you are wide open to SQL injection.