Stainystain Posted July 12, 2010 Share Posted July 12, 2010 Hey guys, New to forum, and PHP for that matter... I'm sure you'll be able to tell! So I have created a HTML form and a corresponding update.php page and a PHP page for viewing the data and have uploaded to my server (iPower) In iPower I have created a mysql database using the same fields / names etc and have manually entered a few entries. Problem is, when I submit the form it simply goes to a blank page (no error message) and when checking in iPower the data has not been submitted. Also, if I open the PHP page for viewing the database in my browser (guest_info.php) it comes up as blank as well... I have no idea, like I say I am a complete amateur at this, kinda forced into it! (I graduated in Oceanography!!) So if anyone of you very helpful people out there want to have a quick scan at my code and tell me where I've been an idiot, it would be greatly appreciated!! ( also... is there a difference between ' and " use? ) Many thanks in advance, Regards, Simon guest_info.php (for viewing the data) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="robots" content="noindex" /> <title>Guest Information</title> </head> <body> <?php // make connection mysql_connect ("******.ipowermysql.com", "******", "******") or die ('I dunno...' .mysql_error()); mysql_select_db ("rose_guest_list"); //build query $query = mysql_query ("SELECT * FROM guest_info"); //display results while ($row = mysql_fetch_array($query)) { echo "<br/> Cruise: ".$row['Cruise']. "<br/> Date: ".$row['Date']. "<br/> Adults: ".$row['No_Adults']. "<br/> Kids: ".$row['No_Kids']. "<br/> Name: ".$row['Name']. "<br/> Email: ".$row['Email']. "<br/> Phone: ".$row['Phone']. "<br/> Staying: ".$row['Staying']. "<br/> Payment: ".$row['Payment']. "<br/> Info: ".$row['info']. "<br/>";} ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/ Share on other sites More sharing options...
david_g17 Posted July 12, 2010 Share Posted July 12, 2010 Add this as the first line of PHP in your code: ERROR_REPORTING(E_ALL); See if it tells you anything. Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1084921 Share on other sites More sharing options...
Pikachu2000 Posted July 12, 2010 Share Posted July 12, 2010 And look at the html source (view -> view source) in your browser. See if anything is there. Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1084927 Share on other sites More sharing options...
Stainystain Posted July 12, 2010 Author Share Posted July 12, 2010 David, Pikachu2000, thanks so much for your swift responses... I added the error reporting code as you suggested, but it still simply shows a blank page. Viewing the source in firefox again just shows nothing, the page is 0kb... Regards, Simon Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1084936 Share on other sites More sharing options...
Pikachu2000 Posted July 12, 2010 Share Posted July 12, 2010 Also need to enable the display of errors . . . At the head of the script add: ini_set('display_errors',1); before: error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1084945 Share on other sites More sharing options...
Stainystain Posted July 12, 2010 Author Share Posted July 12, 2010 the first few lines of code now look like: <?php ini_set('display_errors',1); error_reporting(E_ALL); mysql_connect ('******.ipowermysql.com', '******', '******') or die ('I dunno...' .mysql_error()); mysql_select_db(rose_guest_list); But still no joy, still shows a blank page with no source code to view How frustrating... Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1084960 Share on other sites More sharing options...
marcus Posted July 12, 2010 Share Posted July 12, 2010 You don't even see the HTML before you start your PHP? Your doctype declaration, etc.. Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1084962 Share on other sites More sharing options...
Stainystain Posted July 12, 2010 Author Share Posted July 12, 2010 Mgallforever, Yeah sorry, I have made amendments to the PHP section as suggested to view any error codes, and have simply shown that in that last section of code I posted. The HTML elements are all there, see my first post to view the complete code (minus the amendments obviously ) Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1084965 Share on other sites More sharing options...
Pikachu2000 Posted July 12, 2010 Share Posted July 12, 2010 I believe he was trying to find out if you're seeing any html when you view the page source . . . Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1084981 Share on other sites More sharing options...
Stainystain Posted July 12, 2010 Author Share Posted July 12, 2010 Ahhh ok yeah, sorry. Nope it is completely blank, no html code either - no <!DOCTYPE... etc etc just white. It is the same if I type the URL in a browser (Firefox, IE & Safari ) or if on the iPower file manager I preview the page... both give me nothing. Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1085026 Share on other sites More sharing options...
marcus Posted July 12, 2010 Share Posted July 12, 2010 It could be a permission issue. Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1085030 Share on other sites More sharing options...
PFMaBiSmAd Posted July 12, 2010 Share Posted July 12, 2010 Sounds like the uploading of the files to your server is failing and you actually have empty files on the server. Download one of your files to a different name (so that you don't overwrite the original) and check exactly what is in it. Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1085042 Share on other sites More sharing options...
BillyBoB Posted July 12, 2010 Share Posted July 12, 2010 are you putting the error reporting in front of the html code like: <?php ini_set('display_errors',1); error_reporting(E_ALL); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="robots" content="noindex" /> <title>Guest Information</title> </head> <body> <?php // make connection mysql_connect ("******.ipowermysql.com", "******", "******") or die ('I dunno...' .mysql_error()); mysql_select_db ("rose_guest_list"); //build query $query = mysql_query ("SELECT * FROM guest_info"); //display results while ($row = mysql_fetch_array($query)) { echo "<br/> Cruise: ".$row['Cruise']. "<br/> Date: ".$row['Date']. "<br/> Adults: ".$row['No_Adults']. "<br/> Kids: ".$row['No_Kids']. "<br/> Name: ".$row['Name']. "<br/> Email: ".$row['Email']. "<br/> Phone: ".$row['Phone']. "<br/> Staying: ".$row['Staying']. "<br/> Payment: ".$row['Payment']. "<br/> Info: ".$row['info']. "<br/>";} ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1085045 Share on other sites More sharing options...
Stainystain Posted July 12, 2010 Author Share Posted July 12, 2010 Ok thanks mgallforever, So iPower support should be able to sort me out?! Ha... they're rubbish, but I'll give it a go! Weird thing is iPower MySQL Beta, where my database is, can create code: <?php $link = mysql_connect('******.ipowermysql.com', '******', '******'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_select_db(rose_guest_list); ?> When I created a test page with this code I'm sure (terrible memory) it worked at first. Now it doesn't work as the full URL, but if i preview it from iPower it works....?! Also, when using the URL the page is blank but... viewing the source code it shows all the spiel at the top: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> Like I say I'm a real beginner, but this is weird right...?! I've had numerous problems with iPower before, could it be them? Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1085048 Share on other sites More sharing options...
Pikachu2000 Posted July 12, 2010 Share Posted July 12, 2010 Paste this in and see if you get any errors returned from the db selection and/or query. <?php ini_set('display_errors',1); error_reporting(E_ALL); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="robots" content="noindex" /> <title>Guest Information</title> </head> <body> <?php // make connection mysql_connect ("******.ipowermysql.com", "******", "******") or die ('I dunno...' .mysql_error()); mysql_select_db ("rose_guest_list") or die('Unable to select DB.'); //build query $query = mysql_query ("SELECT * FROM guest_info") or die(mysql_error()); //display results while ($row = mysql_fetch_array($query)) { echo "<br/> Cruise: ".$row['Cruise']. "<br/> Date: ".$row['Date']. "<br/> Adults: ".$row['No_Adults']. "<br/> Kids: ".$row['No_Kids']. "<br/> Name: ".$row['Name']. "<br/> Email: ".$row['Email']. "<br/> Phone: ".$row['Phone']. "<br/> Staying: ".$row['Staying']. "<br/> Payment: ".$row['Payment']. "<br/> Info: ".$row['info']. "<br/>";} ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1085051 Share on other sites More sharing options...
Stainystain Posted July 12, 2010 Author Share Posted July 12, 2010 Thanks again guys for this help, much appreciated. Ok so I didn't place the error code in it's own separate php code in front of the html head... but have done now and still no error code from my code. PFMaBiSmAd - in the iPower file manager you can edit the code for each page, there doesn't seem to be an issue with empty files? However I copied Pikachu2000's code into a new page and got the following error code!!: Fatal error: Call to undefined function mysql_connect() in C:\Inetpub\sites\friendshiprose\tester2.php on line 17 Getting there!! Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1085063 Share on other sites More sharing options...
Pikachu2000 Posted July 12, 2010 Share Posted July 12, 2010 Create a new script with just <?php phpinfo(); exit(); ?> in it, save it, upload it, and call it in your browser, the find the section in the output related to MySQL. Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1085071 Share on other sites More sharing options...
Stainystain Posted July 12, 2010 Author Share Posted July 12, 2010 Sorry Pikachu all I can find is this: sql.safe_mode - local: off master: off Is it safe for me to post the URL? thanks Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1085083 Share on other sites More sharing options...
PFMaBiSmAd Posted July 12, 2010 Share Posted July 12, 2010 Perhaps this will help - http://www.ipower.com/knowledgebase/read_article.bml?kbid=7137 Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1085085 Share on other sites More sharing options...
Stainystain Posted July 12, 2010 Author Share Posted July 12, 2010 Arghhhh!! So after PFMaBiSmAd brilliantly found some iPower instructions (I should have found them right, but I have no faith in iPower...) , you would have thought it would all be sorted... Nope, still the same issue - have fiddled around with the code (' and " and $) and the code location, but still no joy - same completely blank page This is exactly how iPower say to write it: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="robots" content="noindex" /> <title>Untitled Document</title> </head> <body> <?php $username = "******"; $password = "******"; $host = "******.ipowermysql.com"; $database = "guest_info" $rose_connect = mysql_connect($******.ipowermysql.com,$name,$password); or die ('I dunno...' .mysql_error()); mysql_select_db($rose_guest_list,$rose_connect); //build query $query = mysql_query ('SELECT * FROM guest_info'); //display results while ($row = mysql_fetch_array($query)) { echo '<br/> Cruise: '.$row['Cruise']. '<br/> Date: '.$row['Date']. '<br/> Adults: '.$row['No_Adults']. '<br/> Kids: '.$row['No_Kids']. '<br/> Name: '.$row['Name']. '<br/> Email: '.$row['Email']. '<br/> Phone: '.$row['Phone']. '<br/> Staying: '.$row['Staying']. '<br/> Payment: '.$row['Payment']. '<br/> Info: '.$row['info']. '<br/>;} ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1085121 Share on other sites More sharing options...
PFMaBiSmAd Posted July 12, 2010 Share Posted July 12, 2010 Ummm... did doing that correct the Fatal error: Call to undefined function mysql_connect() in ... error? Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1085122 Share on other sites More sharing options...
Pikachu2000 Posted July 12, 2010 Share Posted July 12, 2010 That may be how they said to do it, but it's just like it was to begin with and not giving you any errors to debug with. Just for grins, upload the one that I inserted in post #14 in this thread. Let's see if the errors are the same. Also, when you're in your FTP client, poke around to see if there's a PHP error log file. Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1085123 Share on other sites More sharing options...
Stainystain Posted July 13, 2010 Author Share Posted July 13, 2010 Ahh yeah, I managed to resort back to my old crappy code. I tried it with your code but with no joy - no error code this time either... I fiddled around a couple of times to try and make it fit with the new iPower way (trial and error trial and error!) but no joy. this was the last one I tried: <?php ini_set('display_errors',1); error_reporting(E_ALL); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="robots" content="noindex" /> <title>Guest Information</title> </head> <body> <?php $username = "******"; $password = "******"; $host = "******.ipowermysql.com"; $database = "guest_info" $rose_connect = mysql_connect($******.ipowermysql.com,$name,$password); or die ('I dunno...' .mysql_error()); mysql_select_db ($rose_guest_list,$rose_connect) or die('Unable to select DB.'); //build query $query = mysql_query ('SELECT * FROM guest_info') or die('Idunno 2...' .mysql_error()); //display results while ($row = mysql_fetch_array($query)) { echo '<br/> Cruise: '.$row['Cruise']. '<br/> Date: '.$row['Date']. '<br/> Adults: '.$row['No_Adults']. '<br/> Kids: '.$row['No_Kids']. '<br/> Name: '.$row['Name']. '<br/> Email: '.$row['Email']. '<br/> Phone: '.$row['Phone']. '<br/> Staying: '.$row['Staying']. '<br/> Payment: '.$row['Payment']. '<br/> Info: '.$row['info']. '<br/>;} ?> </body> </html> What the...?!?! I just typed in the tester URL I did with your code in randomly, (the one from earlier on - not the code pasted above), and it is now working?! I've had issues with iPower randomly showing pages, then the next day not, the same with images (really common)... Do I trust that this is sorted?! Any ideas why it would do this?! Thanks for all of your help Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1085128 Share on other sites More sharing options...
Stainystain Posted July 13, 2010 Author Share Posted July 13, 2010 I should add; never with PHP involved and never with a complete blank page... Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1085130 Share on other sites More sharing options...
BillyBoB Posted July 13, 2010 Share Posted July 13, 2010 Well you have one error that I can see directly: <?php ini_set('display_errors',1); error_reporting(E_ALL); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="robots" content="noindex" /> <title>Guest Information</title> </head> <body> <?php $username = "******"; $password = "******"; $host = "******.ipowermysql.com"; $database = "guest_info" $rose_connect = mysql_connect($******.ipowermysql.com,$name,$password); or die ('I dunno...' .mysql_error()); mysql_select_db ($rose_guest_list,$rose_connect) or die('Unable to select DB.'); //build query $query = mysql_query ('SELECT * FROM guest_info') or die('Idunno 2...' .mysql_error()); //display results while ($row = mysql_fetch_array($query)) { echo '<br/> Cruise: '.$row['Cruise']. '<br/> Date: '.$row['Date']. '<br/> Adults: '.$row['No_Adults']. '<br/> Kids: '.$row['No_Kids']. '<br/> Name: '.$row['Name']. '<br/> Email: '.$row['Email']. '<br/> Phone: '.$row['Phone']. '<br/> Staying: '.$row['Staying']. '<br/> Payment: '.$row['Payment']. '<br/> Info: '.$row['info']. '<br/>';}// you were missing the ' after <br/> ?> </body> </html> Good luck Quote Link to comment https://forums.phpfreaks.com/topic/207520-blank-page-arghh/#findComment-1085136 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.