-1
function muIo($val){
    var val = $val;

    <?php $result = mysql_query("UPDATE category SET category_active=1 WHERE category_id=" +  val + "");?>

}
Oliver Spryn
  • 16,871
  • 33
  • 101
  • 195

2 Answers2

0

You have to make a POST request to the server where PHP will then grab that value.

PHP and MySQL are server side while JS is client side.

Check these questions out: send data to MySQL with AJAX + jQuery + PHP

Javascript function post and call php script

Community
  • 1
  • 1
Andriy Lysak
  • 384
  • 5
  • 15
0

Javascript is client side. In order to run PHP and execute SQL Queries you need to have this code on your server setup.

Once you have this server script set up, in order to pass javascript values to this script you need to send a POST or GET request to PHP.

A simple way to do this for a beginner would probably be to use JQuery to use their simple POST functionality.

See Here

Bobby W
  • 836
  • 8
  • 22