This question already has an answer here:
I'm having some problems performing a mysql query inside a php function. The error I am getting is
Notice: Undefined variable: link in C:\path\api\inc\restFunctions.php on line 16
There are several files calling each other so I will attempt to outline the necessary information.
URL Accessed:
localhost/serverList/api/rest.php?action=allServers
serverList/api/rest.php
serverList/api/inc/restFunctions.php
query($serverInfoQuery); $json = array(); while($row = $allServerResults->fetch_assoc()){ $json[]['serverID'] = $row['serverID']; $json[]['environment'] = $row['environment']; $json[]['type'] = $row['type']; $json[]['serverIP'] = $row['serverIP']; $json[]['serverDescription'] = $row['serverDescription']; $json[]['serverCreatedBy'] = $row['serverCreatedBy']; $json[]['serverCreatedDtTm'] = $row['serverCreatedDtTm']; $json[]['serverUpdatedBy'] = $row['serverUpdatedBy']; $json[]['serverUpdatedDtTm'] = $row['serverUpdatedDtTm']; } $jsonResults = json_encode($json); return $jsonResults; } ?>
serverList/api/inc/config.php
I have verified that the query being called works. I also verified that the connection info (masked above) works by using a different page of this software that queries the db.
I'm assuming I must have missed a quote or paren somewhere, but I'm baffled as to where it might be.