Page 1 of 2

[SOLVED] When accessing database returns blank page

Posted: Mon Mar 28, 2005 8:15 pm
by anthony88guy
When I test the script the page comes up. It works correctly if you try and register with a already registered username. But when you try adding a user to the database you get a blank page. I have checked the database nothing gets added. A registered user is: test. You can try it at

Posted: Mon Mar 28, 2005 8:57 pm
by feyd
check the error logs on the server, an error/notice/whatever may have written there instead of being displayed.

Posted: Mon Mar 28, 2005 10:16 pm
by anthony88guy
where could i access the server logs? Did you try it out?

Posted: Tue Mar 29, 2005 5:12 am
by feyd
there's no way for us to "try it out."

If you have Cpanel, there's a button called "Error Log." Other control panels have similar buttons in various places.

Posted: Tue Mar 29, 2005 5:19 am
by CoderGoblin
Or insert the following lines into your Php.

Code: Select all

error_reporting(E_ALL);
ini_set('display_errors', TRUE);
This should display any php errors or warnings. (Coding not logic)

Posted: Tue Mar 29, 2005 12:19 pm
by anthony88guy
I dont think you guys understand what i mean. I tested out where my problems begin by using print at different stages in the code. The print function stops working at line: 31. So I believe that their is something going on their thats not Correct. My objective is to make a register script that checks:

1) Matching passwords
2) Any blank feilds
3) If username is taken
4) Register account

I have some ideas about how to write some of the code. Hopefully it will work. My old register script worked, but it didn't check for registered usernames.

Posted: Tue Mar 29, 2005 12:27 pm
by feyd

Code: Select all

ERROR - Please Try Again Later
sure doesn't look like a blank page to me.. not to mention all the advertising junk..

Posted: Tue Mar 29, 2005 2:07 pm
by anthony88guy
I added the ERROR - Please Try Again, in my script before line: 31, and the advertisments come from my hosting. I am using firefox and it blocks all that.

Posted: Tue Mar 29, 2005 2:33 pm
by John Cartwright
CoderGoblin wrote:Or insert the following lines into your Php.

Code: Select all

error_reporting(E_ALL);
ini_set('display_errors', TRUE);
This should display any php errors or warnings. (Coding not logic)
have you tried this?

Posted: Tue Mar 29, 2005 2:55 pm
by infolock
Try this query...

Code: Select all

$result = mysql_query("INSERT INTO users (user, pass, strikeaction, armysize, statid) VALUES('".$username."', '".$pass1."', '".$strikeaction."', '".$armysize."', '".$statid."')") or die(mysql_error());

Posted: Tue Mar 29, 2005 3:43 pm
by anthony88guy
Phenom wrote:
CoderGoblin wrote:Or insert the following lines into your Php.

Code: Select all

error_reporting(E_ALL);
ini_set('display_errors', TRUE);
This should display any php errors or warnings. (Coding not logic)
have you tried this?
Yes, I have tried that. Nothing turns up. I will try your query infolock.

EDIT: Same result infolock. Am I using mysql_query() wrong on line 31?
EDIT2: I uploaded my old register.php that worked. Only thing it doesnt check for registered usernames.

Posted: Tue Mar 29, 2005 6:40 pm
by infolock
no your query was correct i just didn't know how you setup your id field so i omitted it from the query itself. was just a test more than anything else.

however, in your check this might cause a problem :

Code: Select all

if($username !== "" && $pass1 !== "" && $pass2 !== "" && $statid !== "" && $strikeaction !== "" && $armysize !== "" && $pass1 == $pass2){
try this instead...

Code: Select all

if($username != "" && $pass1 != "" && $pass2 != "" && $statid != "" && $strikeaction != "" && $armysize != "" && $pass1 == $pass2){

Posted: Tue Mar 29, 2005 8:26 pm
by anthony88guy
infolock wrote:no your query was correct i just didn't know how you setup your id field so i omitted it from the query itself. was just a test more than anything else.

however, in your check this might cause a problem :

Code: Select all

if($username !== "" && $pass1 !== "" && $pass2 !== "" && $statid !== "" && $strikeaction !== "" && $armysize !== "" && $pass1 == $pass2){
try this instead...

Code: Select all

if($username != "" && $pass1 != "" && $pass2 != "" && $statid != "" && $strikeaction != "" && $armysize != "" && $pass1 == $pass2){
Correct me if i am wrong but DONT you need to compare them using ==, if you use = you are setting the variable. I am a noob so i could be wrong. I also had another thought that it could be my hosting because it is very flaky and i have rewritten the same code like 5 times in different ways, all the same result. I have free hosting and they seem to have more down time then uptime. I know its not the right place but if you know any good quailty hosting with PHP (duh) and good amount of space and bandwidth please tell me.

Posted: Tue Mar 29, 2005 8:41 pm
by feyd
anthony88guy wrote:Correct me if i am wrong but DONT you need to compare them using ==, if you use = you are setting the variable.
when alone, yes, that's true. But with the negation (!) it's a completely different operator. I can understand the confusion, since both ! and = are operators seperately, plus they are a different operator together.

Posted: Wed Mar 30, 2005 9:04 am
by magicrobotmonkey
!= checks for inequality (0!='' returns false)
!== checks for inequality and type (0!=='' returns true)