I'm very new here as well as in php and mysql and I hope you can help me :)
I'm trying to build a JSON for a visualization using data from a database. My problem is, that it doesn't passes the if-request. In the while-loop the data should be used row by row in a certain way but before that, there have to be done something else. But everthing ONLY if there is any row in the result.
Following code is relevant for my issue:
            //get data where a value fits former input
            $query = "SELECT * FROM table1 WHERE column1 = '" . $input. "'";
            $data = mysql_query($query) or die (mysql_error());
            if ( mysql_num_rows(data) > 0){
            //if($data != NULL){ (didn't work either)
                //do something
                while($data_Row = mysql_fetch_array($data)){
                    //do something
                }
            }
I hope you understood the issue (not sure whether I was able to make it clear). I already tested several solutions from diverse sites but nothing worked so far.
I would appreciate your help :)
 
    