scmeeker Posted July 15, 2010 Share Posted July 15, 2010 I'm testing a page live that works perfectly on my local host server but comes up blank when uploaded to my website. Is there an error setting I can turn on on the live web server in MySql? All the tables are correct but still nothing. Any ideas?? Quote Link to comment https://forums.phpfreaks.com/topic/207895-blank-page-when-live/ Share on other sites More sharing options...
AMcHarg Posted July 15, 2010 Share Posted July 15, 2010 Try this at the top of your script: <?php error_reporting(E_ALL); ini_set('display_errors', '1'); Quote Link to comment https://forums.phpfreaks.com/topic/207895-blank-page-when-live/#findComment-1086784 Share on other sites More sharing options...
scmeeker Posted July 16, 2010 Author Share Posted July 16, 2010 Thanks. That showed me the error BUT, I'm confused by the error: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource Quote Link to comment https://forums.phpfreaks.com/topic/207895-blank-page-when-live/#findComment-1086795 Share on other sites More sharing options...
PFMaBiSmAd Posted July 16, 2010 Share Posted July 16, 2010 It means that your mysql_connect() failed (or was never executed) and the link you put into the mysql_query() statement was not a valid MySQL-Link resource. You would need to determine why your connection code failed and why your error checking logic in your code did not prevent the rest of your code from blindly attempted to execute a query when there was no connection. Quote Link to comment https://forums.phpfreaks.com/topic/207895-blank-page-when-live/#findComment-1086801 Share on other sites More sharing options...
scmeeker Posted July 16, 2010 Author Share Posted July 16, 2010 Here is my code where I'm getting that error, perhaps maybe you might be able to see what I'm not. When I run this on my server here at home, it works perfect but when uploaded live...it give's me the error. I've talked to my Web host but they said it's in my scripting. So I would appreciate if someone could have a look. "Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource " //connect to database $mysqli = mysqli_connect("", "", "", ""); //Set the selected category $selected_cat = (isset($_GET["cat_id"])) ? $_GET["cat_id"] : false; //show categories first $get_cats_sql = "SELECT cat_id, cat_title FROM category ORDER BY cat_id"; $get_cats_res = mysqli_query($mysqli, $get_cats_sql) or die(mysqli_error($mysqli)); if (mysqli_num_rows($get_cats_res) < 1) { $categoryList = "<p><em>Sorry, no categories to browse.</em></p>"; } else { //Display the categories while ($cats = mysqli_fetch_array($get_cats_res)) { $categoryList .= "<a href=\"listtest5.php?cat_id={$cats['cat_id']}\">{$cats['cat_title']} <br /></a>\n"; if ($cats['cat_id']==$selected_cat); } //get items $get_items_sql = "SELECT id, title, city, state, country, deadline, brief_description, activationkey, date FROM table WHERE MONTH(date) = MONTH(CURDATE()) ORDER BY date"; $get_items_res = mysqli_query($mysqli, $get_items_sql) or die(mysqli_error($mysqli)); if (mysqli_num_rows($get_items_res) < 1) { $content = "<p><em>Sorry, no items in this category.</em></p>\n"; } else { $content .= "<ul>\n"; while ($items = mysqli_fetch_array($get_items_res)) { $item_url = "detail.php?id={$items['id']}"; $item_title = stripslashes($items['title']); $item_city = $items['city']; $item_state = $items['state']; $item_country = $items['country']; $item_deadline = $items['deadline']; $item_brief_description = $items['brief_description']; $item_id = $items['id']; $content .= ""; $content .="<table width=\"693\" border=\"0\"><tr><td width=\"200\"><a href=$item_url>$item_title</a></td><tr><td class=blackfont width=\"251\">{$item_city}, {$item_state} - {$item_country}</td></tr><tr><td class=blackfont width=\"109\">Deadline: {$item_deadline}</td></tr><tr><td class=\"blackfont\">{$item_brief_description}</td></tr><br /></table>"; $content .= "\n"; } $content .= "</ul>\n"; } Quote Link to comment https://forums.phpfreaks.com/topic/207895-blank-page-when-live/#findComment-1086826 Share on other sites More sharing options...
scmeeker Posted July 16, 2010 Author Share Posted July 16, 2010 It's giving me the error at this line of code (sorry I didn't include that before): $get_cats_res = mysqli_query($mysqli, $get_cats_sql) or die(mysqli_error($mysqli)); Quote Link to comment https://forums.phpfreaks.com/topic/207895-blank-page-when-live/#findComment-1086831 Share on other sites More sharing options...
Pikachu2000 Posted July 16, 2010 Share Posted July 16, 2010 Are you sure the db connection is succeeding? $mysqli = mysqli_connect("", "", "", "") or die('Failed to connect to database:' . mysqli_connect_error() ); Quote Link to comment https://forums.phpfreaks.com/topic/207895-blank-page-when-live/#findComment-1086835 Share on other sites More sharing options...
scmeeker Posted July 16, 2010 Author Share Posted July 16, 2010 I took out the db connection details off the posting. In fact, I just ran another test on a different page that worked. It was a form with no initial database call for dynamic information that called on a php page to add a record. It worked perfect. Hmmmmm...this has me stumped. Quote Link to comment https://forums.phpfreaks.com/topic/207895-blank-page-when-live/#findComment-1086847 Share on other sites More sharing options...
PFMaBiSmAd Posted July 16, 2010 Share Posted July 16, 2010 The error message you are posting is for a mysql_query() statement. The code you are posting is using mysqli statements, unless you have a library of user written functions to use mysqli statements on a system that does not have mysqli installed. You would need to post the actual code that is producing that error. Quote Link to comment https://forums.phpfreaks.com/topic/207895-blank-page-when-live/#findComment-1086850 Share on other sites More sharing options...
Pikachu2000 Posted July 16, 2010 Share Posted July 16, 2010 I think you're going to want to upload a script to see if the mysqli extension is installed. Paste the following into a new file, save it as phpinfo.php and upload it. Then browse to www.yourdomain.com/phpinfo.php and see if the (long) list shows that mysqli is installed. You should see a section for it about halfway down the page. Once you've verified that it does or doesn't exist, delete the script from the server. <?php phpinfo(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/207895-blank-page-when-live/#findComment-1086854 Share on other sites More sharing options...
scmeeker Posted July 16, 2010 Author Share Posted July 16, 2010 My server doesn't support the mysqli script. I realized that when I uploaded it earlier and it gave me an error for that...not recognizing it. So I changed all the mysqli's to mysql's and the error that I posted before was the result. Sorry for the miscommunication of my posting on that. Here is the code without the "mysqli" included that is still giving me the error. I've purposely left out the db connection info. Thanks for your help. This is the line of code I get the error: $get_cats_res = mysql_query($mysql, $get_cats_sql) or die(mysql_error($mysql)); Here is the rest of the code: <?php error_reporting(E_ALL); ini_set('display_errors', '1'); session_start(); //connect to database $mysql = mysql_connect("", "", "", ""); //Set the selected category $selected_cat = (isset($_GET["cat_id"])) ? $_GET["cat_id"] : false; //show categories first $get_cats_sql = "SELECT cat_id, cat_title FROM category ORDER BY cat_id"; $get_cats_res = mysql_query($mysql, $get_cats_sql) or die(mysql_error($mysql)); if (mysql_num_rows($get_cats_res) < 1) { $categoryList = "<p><em>Sorry, no categories to browse.</em></p>"; } else { //Display the categories while ($cats = mysql_fetch_array($get_cats_res)) { $categoryList .= "<a href=\"listtest5.php?cat_id={$cats['cat_id']}\">{$cats['cat_title']} <br /></a>\n"; if ($cats['cat_id']==$selected_cat); } //get items $get_items_sql = "SELECT id, title, city, state, country, deadline, brief_description, date FROM table WHERE AND MONTH(date) = MONTH(CURDATE()) ORDER BY date"; $get_items_res = mysql_query($mysql, $get_items_sql) or die(mysql_error($mysql)); if (mysql_num_rows($get_items_res) < 1) { $content = "<p><em>Sorry, no items in this category.</em></p>\n"; } else { $content .= "<ul>\n"; while ($items = mysql_fetch_array($get_items_res)) { $item_url = "detail.php?id={$items['id']}"; $item_title = stripslashes($items['title']); $item_city = $items['city']; $item_state = $items['state']; $item_country = $items['country']; $item_deadline = $items['deadline']; $item_brief_description = $items['brief_description']; $item_id = $items['id']; $content .= ""; $content .="<table width=\"693\" border=\"0\"><tr><td width=\"200\"><a href=$item_url>$item_title</a></td><tr><td class=blackfont width=\"251\">{$item_city}, {$item_state} - {$item_country}</td></tr><tr><td class=blackfont width=\"109\">Deadline: {$item_deadline}</td></tr><tr><td class=\"blackfont\">{$item_brief_description}</td></tr><br /></table>"; $content .= "\n"; } $content .= "</ul>\n"; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/207895-blank-page-when-live/#findComment-1086859 Share on other sites More sharing options...
PFMaBiSmAd Posted July 16, 2010 Share Posted July 16, 2010 You cannot just remove the 'i' and change the mysqli_ function calls into mysql_ function calls. The parameters and order of the parameters are not the same. Quote Link to comment https://forums.phpfreaks.com/topic/207895-blank-page-when-live/#findComment-1086862 Share on other sites More sharing options...
scmeeker Posted July 16, 2010 Author Share Posted July 16, 2010 I figured that...after the fact, so I'm going to have to do some research on the differences in the two. If you know of any great online resources, I would appreciate it. Quote Link to comment https://forums.phpfreaks.com/topic/207895-blank-page-when-live/#findComment-1087116 Share on other sites More sharing options...
PFMaBiSmAd Posted July 16, 2010 Share Posted July 16, 2010 How about the documentation where all the php functions are defined - http://www.php.net/download-docs.php Quote Link to comment https://forums.phpfreaks.com/topic/207895-blank-page-when-live/#findComment-1087173 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.