function muIo($val){
var val = $val;
<?php $result = mysql_query("UPDATE category SET category_active=1 WHERE category_id=" + val + "");?>
}
Asked
Active
Viewed 1,367 times
-1
Oliver Spryn
- 16,871
- 33
- 101
- 195
LIFEWEBDESIGNING
- 1
- 2
-
1Please don't use the `mysql_*` function library, it is deprecated. Use `mysqli_*` and query parameters to avoid SQL injection attacks. http://php.net/manual/en/book.mysqli.php – Oliver Spryn Mar 01 '16 at 19:55
-
thank you about your advice, i will work on it – LIFEWEBDESIGNING Mar 01 '16 at 19:56
2 Answers
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
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