Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Dave Faliskie
Dave Faliskie
17,793 Points

Seeing a blank white page when submitting a php form

I recently picked up a PHP site from another developer and am trying to get it setup on my local computer using MAMP. I was successfully able to copy down the files and get the site running locally. I also made a copy of the data base and changed the credentials in the php project to use the local database.

When I try and create a new user locally I am brought to a blank page and my file path does not change as it would if the POST request was successful. The local database was also not updated with the new account I was trying to create.

I'm pretty stuck on this and not entirely sure how to trouble shoot this. Has anyone experienced a similar issue or are there any ideas on ways I can trouble shoot this?

jamesjones21
jamesjones21
9,260 Points

Hi, has the config file to access the database been updated with your local credentials? Also within the form tags, have you specified the correct path to the file within the action attribute?

Dave Faliskie
Dave Faliskie
17,793 Points

@jamesjones21 yes the config file has been updated with the local database credentials, and the form tags do use the proper path now. I was able to get the following logs but I'm not quite sure what to make of them...

E_NOTICE Error in file »login.php« at line 85: Undefined variable: msg 
E_STRICT Error in file »DBConn.php« at line 16: Non-static method DB::connect() should not be called statically 
E_STRICT Error in file »DB.php« at line 520: Non-static method DB::parseDSN() should not be called statically 
E_STRICT Error in file »mysql.php« at line 49: Declaration of DB_mysql::quote() should be compatible with DB_common::quote($string = NULL) 
E_DEPRECATED Error in file »mysql.php« at line 241: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead
E_STRICT Error in file »DB.php« at line 557: Non-static method DB::isError() should not be called statically 
E_STRICT Error in file »DBConn.php« at line 17: Non-static method PEAR::isError() should not be called statically 
E_STRICT Error in file »common.php« at line 2200: Non-static method DB::isManip() should not be called statically, assuming $this from incompatible context 
E_STRICT Error in file »common.php« at line 1009: Non-static method DB::isError() should not be called statically, assuming $this from incompatible context 
E_STRICT Error in file »common.php« at line 2200: Non-static method DB::isManip() should not be called statically, assuming $this from incompatible context 
E_STRICT Error in file »common.php« at line 1014: Non-static method DB::isError() should not be called statically, assuming $this from incompatible context 
E_STRICT Error in file »login.php« at line 92: Non-static method DB::isError() should not be called statically 
E_STRICT Error in file »DB.php« at line 1387: Non-static method DB::isError() should not be called statically, assuming $this from incompatible context 
E_STRICT Error in file »common.php« at line 1009: Non-static method DB::isError() should not be called statically, assuming $this from incompatible context 
E_STRICT Error in file »common.php« at line 2200: Non-static method DB::isManip() should not be called statically, assuming $this from incompatible context E_STRICT Error in file »login.php« at line 114: Non-static method DB::isError() should not be called statically WARNING Error in file »login.php« at line 130: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/KOL/public_html/login.php:56)
jamesjones21
jamesjones21
9,260 Points

There we go, but without seeing the full picture quite hard to pin point it, but least its fixed 👌

Dave Faliskie
Dave Faliskie
17,793 Points

@jamesjones21 yes definitely not something anyone would have been able to solve with the info I posted. Thanks for your help on this, in a way your comment lead me to finding the problem!

jamesjones21
jamesjones21
9,260 Points

happy to help in a small way :) I would also look to change from using mysqli to using PDO, which makes PHP and Database work a lot easier :)

1 Answer

Dave Faliskie
Dave Faliskie
17,793 Points

I was able to figure it out. I had to change an import that was referencing a file in the same directory

require_once 'DB/common.php';
// changed to
require_once 'common.php';