WordPress.org

Ready to get started?Download WordPress

Forums

Installation and wp-db code bug? (2 posts)

  1. CallMeAndy
    Member
    Posted 5 years ago #

    My PHP is not good enough to be sure if there is a bug however the installation is not working if I embed the blog on my home page (It is working when in the default wordpress folder) thus:

    main.php

    <html>
    <head>
    
    <?PHP
    require './comps/page_essentials.inc';
    require './comps/login.inc';
    include_once "./comps/conn.inc"; 
    
    ?>
    </head>
    <body>
    
    <?PHP
    
    $department = 'Front Desk';
    $contentfile='./wordpress/index_mod.php';
    $pagetitle='The News!';
    require './comps/header.inc';
    require './comps/body_up.inc';
    require './comps/leftmenu.inc';
    require './comps/bodycenter.inc';
    require './comps/body_down.inc';
    require './comps/footer.inc';
    ?>
    </body>
    </html>

    bodycenter.inc

    <TD bgcolor="#FFFBE3">
    <table border="0" valign="top" >
    	<tr>
      		<td width="100%" align="left" >
    			<p class=myPageTitle><?php echo $pagetitle; ?></p>
    		</td>
    	</tr>
    	<tr>
    
        	<td width="100%" align="left" valign="top" >
    	    	<?php require $contentfile; ?>
    		</td>
         </tr>
     </table>
     </TD>

    and ./wordpress/index_mod.php

    <?php
    /**
     * Front to the WordPress application. This file doesn't do anything, but loads
     * wp-blog-header.php which does and tells WordPress to load the theme.
     *
     * @package WordPress
     */
    
    /**
     * Tells WordPress to load the WordPress theme and output it.
     *
     * @var bool
     */
    define('WP_USE_THEMES', true);
    
    /** Loads the WordPress Environment and Template */
    require('./wordpress/wp-blog-header.php');
    ?>

    The wordpress address in dashboard is /web/wordpress
    Blog address (URL) is /web which is where main.php resides.

    The page fails to load the wordpress blog and on stepping through execution in PHPEd we come to the code

    if ( preg_match("/^\\s*(insert|delete|update|replace|alter) /i",$query) ) {
    .....
    } else {
    $i = 0;
    while ($i < @mysql_num_fields($this->result)) {

    the step-through takes the else route as the query is a SET NAMES 'utf8' statement. Now I dont know what the @ prefix does on mysql_num_fields but ordinarily mysl_num_fields would expect a 'resource result' in this case $this->result is a boolean TRUE. And this is where the codes kick out an error saying "supplied argument is not a valid MySQL result resource"

    I have not changed the code in any way or added any plugins etc, literally all i have done is change the relative locations between blog and dashboard in which I created one test posting.

  2. CallMeAndy
    Member
    Posted 5 years ago #

    oh I forgot to mention, in relation to saying the blog is working in the default location, a similar step through reaches the same point in the code as for the repositioned blog however this time the Boolean TRUE is not rejected by mysql_num_fields

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags