coolphpdude Posted March 10, 2009 Share Posted March 10, 2009 Hi people, im tryin to remind myself how to do php so i've knocked together a basic page as follows... <?php echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>"; echo "<html xmlns='http://www.w3.org/1999/xhtml'>"; echo "<head>"; echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />"; echo "</head>"; // *** Connection - START *** // connect to database $db = @mysql_connect("localhost","xxxxxx","xxxxxx"); if (!$db) { do_error("Could not connect to the server"); } // Check connection - if it does not exist then go to the error function @mysql_select_db("xxxxx",$db)or do_error("Could not connect to the database"); // *** Connection - END *** echo "<html>"; // *********************** No Results ************************** function do_error($error) { echo "User not found. Please enter your login details on the right."; } echo "</html>"; ?> and it brings up the following message when i try to load that page... Error in my_thread_global_end(): 1 threads didn't exit Failed loading C:\WINDOWS\system32\inetsrv\ioncube\ioncube_loader_win_5.2.dll Is there something I have forgot to do??? Also one last thing, is there any way to write a section of code for example a query checking your username and password that you are going to use accross multiple pages and then call that. rather than having to type out that same query on each and every php page that uses it? Thanks Quote Link to comment Share on other sites More sharing options...
lonewolf217 Posted March 10, 2009 Share Posted March 10, 2009 dont know about the error, sounds like something wrong with server configuration rather than your code. try a google search on it. as far as the login, just write a separate login.php page and include it on each page that may be logged in from. alternatively, keep the login.php separate. each page with a login form sends the results to login.php and also sets a session variable for the current page. after the login request is successfully handled, you can redirect them back to the current page using a header Quote Link to comment Share on other sites More sharing options...
coolphpdude Posted March 10, 2009 Author Share Posted March 10, 2009 sounds like what i'm after. So does an include statement just pull in code that i've written on a seperate page and then execute that before continueing through the rest of the code on my page??? I tried to google in but only came back with 2 results which wern't relative Cheers for replying Quote Link to comment Share on other sites More sharing options...
synking Posted March 10, 2009 Share Posted March 10, 2009 I think you issue is with calling <html> twice. without closing the first one. Quote Link to comment Share on other sites More sharing options...
MadnessRed Posted March 10, 2009 Share Posted March 10, 2009 it looks like the problem is on your server, not in the php and also whilst it wil not be causing the error, you know that you start the <html> twice? you start it at the top then start it again helfway down the page. Quote Link to comment Share on other sites More sharing options...
coolphpdude Posted March 10, 2009 Author Share Posted March 10, 2009 ahh my bad i typed that in by accident. Right im gonna give up for the night but i'll check out the server config tomorrow and post again! cheers for your help lads! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.