0

This is not a Duplicate, the link proposed doesn't help me at all

Recently I'm having a problem on my website where you get a white screen with a MySql Select Query showing. Sometimes it's not a white screen but part of the page loaded, then somewhere (an include) there's just a Select Query and the rest of the page doesn't load.

Most of the time, in the Select Query showing up, the information in there isn't right, for example my query (in the code) is "Select * from X where id='".$userid."'" and on screen it's written "Select * from X where id=0" but the id should never be 0 normally.

It happens when there's a lot of people on the website, sometimes there's also an error saying that there is more than what the max_connection allows.

I don't know how to track the problem, I don't know the steps to isolate it, so it's pretty hard to fix since I don't understand it.

If you have any help it would be very usefull!

Thank you!

Jessie
  • 3
  • 5
  • Page code please? – somejkuser Apr 08 '19 at 02:12
  • It's a gigantic code, it's a web browser game, there's a lot of includes, that goes from forum, to the game, to specific parts of the game. That's why I'm looking for where to look at, because I can't even know where the problem is. – Jessie Apr 08 '19 at 03:49
  • Also for those who are saying that this is a duplicate of the white screen of death, it would be useful if you could tell me how this is a duplicate because except for the white page, it doesn't look the same at all for me and don't know how I can use that link to help me resolve my problem. I did research before asking and didn't found a solution :/ – Jessie Apr 08 '19 at 03:53

1 Answers1

1

Did you type the SQL query like "Select from X Where id=$userid" ? That's probably you have an error on your syntax. The correct SQL syntax should be like this *SELECT * FROM table_name WHERE field_name='Your Variable' remember, if you using the stars character() it's mean that you select all data in your table.

Correct Example :

<?php 
//MySql Connection
$connect = mysqli_connect('host_name', 'user_name', 'password', 'db_name');

//Query Statement
$id = 'A001';
$selectData = mysqli_query($connect, "SELECT * FROM table_name WHERE id='$id'");

//Check wether the selected data is exist or not
if($selectData){
     echo"Exist";
}
else {
     echo"Doesn't Exist";
}
?>
  • Yes I am looking for specific data, I removed it to remove unnecessary data to make it easier to understand the problem. My code works 99% of the time, it's just when it's crowded that I get the SQL SELECT Query. – Jessie Apr 08 '19 at 03:46