Saturday, December 30, 2017

php Why does this database script not return any results

php Why does this database script not return any results



I have a problem, and I can not correct myself with the help of a friend.

The basic thing is that I am trying to do this, call a PHP script with 2 arguments: username and subscriptionid .

The PHP script should read "User" by a user named "User", then user ID by user name, in another table, called subscriptionlog , check what the user id is and If so, see that he has an entry with subscriptionid . If so, print the "status" variable of that table.

Heres my code:

  & lt ;? Php // checkkey.php? User = ZeD & subid = 2 - & gt; Called as $ ServerName = "localhost"; $ Username = "username"; $ Password = "password"; $ Dbname = "database"; $ Uname = $ _GET ["user"]; $ Subid = $ _GET ["subid"]; // Create connection $ conn = new mysqli ($ servername, $ username, $ password, $ dbname); // Check connection if ($ conn- & gt; connect_error) {dead ("Connection failed:". $ Conn-> connect_error); } $ Sql ??= "Subscription in the Selection Position where subscriptionid = $ subid and userid = (user user name WHERE user name = $ uname)"; $ Result = mysqli_query ($ sql); If ($ result === incorrect) echo ("error with bitch SQL"); While ($ line = mysqli_fetch_assoc ($ result)) {echo $ line ["status"]; } $ Conn- & gt; Close (); ? & Gt;  

It just leaves the page blank, there is no echo at all.

Try adding at the top of your page:

  error_reporting (E_ALL); Ini_set ("display_errors", 1);  

So you can see that you have an error.



go to link download

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.