linux1880 Posted April 27, 2010 Share Posted April 27, 2010 blank page appear with this mysqli code, pls help <?php // Load in our navigation links from the MySQL database require("abc/conn.php"); $sql = "SELECT * FROM nav"; $result = $conn->query($sql) or die(mysqli_error()); if($result){ while($row = $result->fetch_object()){ echo "<li><a href='{$row->url}' title='{$row->title}'>{$row->name}</a></li>"; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/199859-blank-page-appear-with-this-mysqli-code/ Share on other sites More sharing options...
Hybride Posted April 27, 2010 Share Posted April 27, 2010 Do you have any data in the table so it actually loads? Quote Link to comment https://forums.phpfreaks.com/topic/199859-blank-page-appear-with-this-mysqli-code/#findComment-1049080 Share on other sites More sharing options...
anups Posted April 27, 2010 Share Posted April 27, 2010 There May be 2 reasons 1. There is no record for this case check the total number of records if(mysqli_num_rows($result)>0){ echo "zzz"; } 2. There my be connection problem so on error reporting ini_set("error_reporting", E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/199859-blank-page-appear-with-this-mysqli-code/#findComment-1049101 Share on other sites More sharing options...
PFMaBiSmAd Posted April 27, 2010 Share Posted April 27, 2010 Surprisingly, using the procedural function call mysqli_error() with OOP mysqli just worked when I tried it. However, mysqli_error() requires the $conn variable as a parameter. Otherwise you get a php Warning: and no actual output from mysqli_error that would tell you why the query is failing. Quote Link to comment https://forums.phpfreaks.com/topic/199859-blank-page-appear-with-this-mysqli-code/#findComment-1049106 Share on other sites More sharing options...
linux1880 Posted April 27, 2010 Author Share Posted April 27, 2010 well same statements work when using mysql_connect(). It's seems only mysqli is not working. Do i need to install any special module or package to run mysqli ? pls help. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/199859-blank-page-appear-with-this-mysqli-code/#findComment-1049163 Share on other sites More sharing options...
PFMaBiSmAd Posted April 27, 2010 Share Posted April 27, 2010 You need to use mysqli correctly (some of the problems with your mysqli code have been pointed out in the thread.) There is not an exactly 1:1 conversion between mysql and mysqli usage. Yes, the mysqli extension needs to be installed, just like any of the other php language extensions. Are you developing and debugging your code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini (when you have access to it), in a local php.ini (when php is running as a CGI application), or using equivalent settings in a .htaccess file (when php is running as an Apache Module) so that php would help you by reporting and displaying all the errors it detects? You will save a TON of time. Quote Link to comment https://forums.phpfreaks.com/topic/199859-blank-page-appear-with-this-mysqli-code/#findComment-1049270 Share on other sites More sharing options...
linux1880 Posted April 27, 2010 Author Share Posted April 27, 2010 Thank you, is there a guide to install mysqli in centos ? Quote Link to comment https://forums.phpfreaks.com/topic/199859-blank-page-appear-with-this-mysqli-code/#findComment-1049352 Share on other sites More sharing options...
linux1880 Posted April 27, 2010 Author Share Posted April 27, 2010 when i did rpm query i found rpm -qa | grep php php-pdo-5.1.6-24.el5_4.5 php-cli-5.1.6-24.el5_4.5 php-ldap-5.1.6-24.el5_4.5 php-gd-5.1.6-24.el5_4.5 php-mysql-5.1.6-24.el5_4.5 php-common-5.1.6-24.el5_4.5 php-5.1.6-24.el5_4.5 [root@localhost home]# Quote Link to comment https://forums.phpfreaks.com/topic/199859-blank-page-appear-with-this-mysqli-code/#findComment-1049364 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.