Title: Installation and wp-db code bug?
Last modified: August 19, 2016

---

# Installation and wp-db code bug?

 *  [CallMeAndy](https://wordpress.org/support/users/callmeandy/)
 * (@callmeandy)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/installation-and-wp-db-code-bug/)
 * 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.

Viewing 1 replies (of 1 total)

 *  Thread Starter [CallMeAndy](https://wordpress.org/support/users/callmeandy/)
 * (@callmeandy)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/installation-and-wp-db-code-bug/#post-979963)
 * 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

Viewing 1 replies (of 1 total)

The topic ‘Installation and wp-db code bug?’ is closed to new replies.

## Tags

 * [PHP Bug](https://wordpress.org/support/topic-tag/php-bug/)

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 1 reply
 * 1 participant
 * Last reply from: [CallMeAndy](https://wordpress.org/support/users/callmeandy/)
 * Last activity: [17 years, 3 months ago](https://wordpress.org/support/topic/installation-and-wp-db-code-bug/#post-979963)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
