$sql = "SELECT SUM(vote_up)FROM blog WHERE username=‘shail’ and deleted=‘0’ " ";
$query=mysqli_query($db_conx,$sql);
$row=mysqli_fetch_array($query,MYSQLI_NUM);
printf ($row[0]);
P.S I strongly recommend you to bind values in where clause as your current code has big security vulnerability.
@shail_arya ohh then that might be the problem you have…you are filtering for alphabetic values but you are passing a integer value " 0 " in your second parameter to query. (deleted=‘0’).
Anyway i am not sure what is the best method of security. filtering variables or binding variables to query. any thoughts on this @r937 ?
Ok… i have a general question here… Filtering or any other method for security is required at the point where we are taking inputs from the user… right?
Yes it is required when we take input from users. I thought your last object is that. But this is a query you are going to use by your self only you don’t have to do that.BTW do you want to show these result in PHP page or are you just querying inside mysql