Skip to main content

Posts

Showing posts with the label json-encode

JSON PHP data returning null

i am trying to fetch a PHP script using AJAX and return the values as JSON. For some reason, my script fails and i am trying to figure out the problem. When i enter a value form the database into the address bar, like www.someaddress/post.php?kinaseEntry=aValue i get a json out put like so; {"kinaseSKU":null,"url":null,"molecularWeight":null,"tracerSKU":null,"antiSKU1":"antiSKU1","antiSKU2":"antiSKU2","bufferSKU":"bufferSKU","tracerConc":null,"assayConc":null} My php file looks like so; <?php //Include connection to databse require_once 'connect.php'; $kinase = mysql_real_escape_string ($_POST["kinaseEntry"]); mysql_query('SET CHARACTER SET utf8'); $findKinase = "SELECT * FROM kbaData where cleanSKU = '" .$kinase. "' "; if ($result = mysql_query($findKinase)) { $row = mysql_fetch_arra