Guys, I need some help. I installed a mod on oscmax for updated product attributes. It works fine, BUT now the products in my site won't pull up. Everything looks fine on the site until you actually click on a product, then you get.

Warning:mysql_fetch_array(): supplied argument is not a valid MySQL results resource in /home/sportsti/public_html/includes/functions/database.php on line 101

FYI, line 101 is " return $result;"

I didn't make any changes to database.php

Please help. I don't know what I did wrong.

the site is www.sportstickies.com

Thanks

}



    $result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error());



    if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {

      if (mysql_error()) $logger->write(mysql_error(), 'ERROR');

    }



    return $result;

  }



  function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') {

    reset($data);

    if ($action == 'insert') {

      $query = 'insert into ' . $table . ' (';

      while (list($columns, ) = each($data)) {

        $query .= $columns . ', ';

      }

      $query = substr($query, 0, -2) . ') values (';

Thank you for helping.

an invalid resource is usually caused by a bad sql query. this doesn't mean something is wrong with the database page. the problem lies in the page that calls that function on the database page. can you post the code for product_info.php

<?php

/*

$Id: product_info.php 3 2006-05-27 04:59:07Z user $



  osCMax Power E-Commerce

  [url]http://oscdox.com[/url]



  Copyright 2006 osCMax



  Released under the GNU General Public License

*/



// Most of this file is changed or moved to BTS - Basic Template System - format.

// For adding in contribution or modification - parts of this file has been moved to: catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).

//       catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).

// (Sub 'fallback' with your current template to see if there is a template specific file.)



  require('includes/application_top.php');



// LINE ADDED: MOD - Added for Dynamic MoPics v3.000

  require(DIR_WS_FUNCTIONS . 'dynamic_mopics.php');

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);



// BOE: Attribute Sort with Clone Tool
        $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' order by pa.attribute_sort");
// EOE: Attribute Sort with Clone Tool


  $product_check = tep_db_fetch_array($product_check_query);



  $content = CONTENT_PRODUCT_INFO;

  $javascript = 'popup_window.js';



  



  include (bts_select('main', $content_template)); // BTSv1.5



  require(DIR_WS_INCLUDES . 'application_bottom.php');

?>

I did have to modify the code on this page.

// BOE: Attribute Sort with Clone Tool
        $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' order by pa.attribute_sort");
// EOE: Attribute Sort with Clone Tool

REPLACED

$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");

does attribute_sort column exist in the TABLE_PRODUCTS_ATTRIBUTES table? that is the only thing added so something is wrong there.

also, check the error log for the sql error. post the error once you find it.

I don't know where to find the error log. I am new to this. please advise.

its probably a config setting when you install the software. check your config files. also look for folders and files that say log or error, ect.

also, it might be in the logging class. can you find this log class? its referenced in your first post. it logs the error somehow.

}

$result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error());

if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {

if (mysql_error()) $logger->write(mysql_error(), 'ERROR');

}

return $result;

}

function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') {

reset($data);

if ($action == 'insert') {

$query = 'insert into ' . $table . ' (';

while (list($columns, ) = each($data)) {

$query .= $columns . ', ';

}

$query = substr($query, 0, -2) . ') values (';


Thank you for helping.

I noticed a few errors in that script. One is the sql linker will need the extra dollar sign removing and is shown as follows:

$result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error());

//above may need replacing with below:

$result = mysql_query($query, $link) or tep_db_error($query, mysql_errno(), mysql_error());

Also the line return $result; may also cause an error if it is not within a box. By saying a box, I meen a function, a external to internal command call (eg. include() ) or oop object. If the return is not in a box then from my experience, it will just return the $result status and prevent further executing of the php file and may even cause an extra error during the process.
But that $$link variable should really be changed and hope it helps.

I noticed a few errors in that script. One is the sql linker will need the extra dollar sign removing and is shown as follows:

$result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error());

//above may need replacing with below:

$result = mysql_query($query, $link) or tep_db_error($query, mysql_errno(), mysql_error());

Also the line return $result; may also cause an error if it is not within a box. By saying a box, I meen a function, a external to internal command call (eg. include() ) or oop object. If the return is not in a box then from my experience, it will just return the $result status and prevent further executing of the php file and may even cause an extra error during the process.
But that $$link variable should really be changed and hope it helps.

$$link is valid. you can use a dynamic name for a variable.

Here is the error log:

[Fri Feb 20 08:03:19 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 08:03:19 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/images/OSCMAX_infobox_bg.gif
[Fri Feb 20 08:03:19 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 08:03:19 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/swfobject.js
[Fri Feb 20 08:03:17 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 08:03:17 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/images/OSCMAX_infobox_bg.gif
[Fri Feb 20 08:03:17 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 08:03:17 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/swfobject.js
[Fri Feb 20 08:03:14 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 08:03:14 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/images/OSCMAX_infobox_bg.gif
[Fri Feb 20 08:03:11 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 08:03:11 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/swfobject.js
[Fri Feb 20 07:45:16 2009] [error] [client 66.249.71.114] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 07:45:16 2009] [error] [client 66.249.71.114] File does not exist: /home/sportsti/public_html/robots.txt
[Fri Feb 20 07:30:40 2009] [error] [client 65.55.209.120] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 07:30:40 2009] [error] [client 65.55.209.120] File does not exist: /home/sportsti/public_html/robots.txt
[Fri Feb 20 07:06:21 2009] [error] [client 74.95.187.222] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 07:06:21 2009] [error] [client 74.95.187.222] File does not exist: /home/sportsti/public_html/images/OSCMAX_infobox_bg.gif
[Fri Feb 20 07:06:21 2009] [error] [client 74.95.187.222] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 07:06:21 2009] [error] [client 74.95.187.222] File does not exist: /home/sportsti/public_html/images/OSCMAX_infobox_bg.gif
[Fri Feb 20 07:06:21 2009] [error] [client 74.95.187.222] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 07:06:21 2009] [error] [client 74.95.187.222] File does not exist: /home/sportsti/public_html/images/OSCMAX_infobox_bg.gif
[Fri Feb 20 07:06:21 2009] [error] [client 74.95.187.222] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 07:06:21 2009] [error] [client 74.95.187.222] File does not exist: /home/sportsti/public_html/images/OSCMAX_infobox_bg.gif
[Fri Feb 20 07:06:21 2009] [error] [client 74.95.187.222] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 07:06:21 2009] [error] [client 74.95.187.222] File does not exist: /home/sportsti/public_html/images/OSCMAX_infobox_bg.gif
[Fri Feb 20 07:06:21 2009] [error] [client 74.95.187.222] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 07:06:21 2009] [error] [client 74.95.187.222] File does not exist: /home/sportsti/public_html/images/OSCMAX_infobox_bg.gif
[Fri Feb 20 07:06:21 2009] [error] [client 74.95.187.222] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 07:06:21 2009] [error] [client 74.95.187.222] File does not exist: /home/sportsti/public_html/images/OSCMAX_infobox_bg.gif
[Fri Feb 20 07:05:04 2009] [error] [client 74.95.187.222] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 07:05:04 2009] [error] [client 74.95.187.222] File does not exist: /home/sportsti/public_html/images/OSCMAX_infobox_bg.gif
[Fri Feb 20 07:05:01 2009] [error] [client 74.95.187.222] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 07:05:01 2009] [error] [client 74.95.187.222] File does not exist: /home/sportsti/public_html/swfobject.js
[Fri Feb 20 05:55:04 2009] [error] [client 66.249.71.112] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 05:55:04 2009] [error] [client 66.249.71.112] File does not exist: /home/sportsti/public_html/css/dropdown/default.ultimate.css
[Fri Feb 20 03:27:24 2009] [error] [client 125.211.218.16] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 03:27:24 2009] [error] [client 125.211.218.16] File does not exist: /home/sportsti/public_html/sumthin
[Fri Feb 20 02:54:16 2009] [error] [client 66.249.71.112] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 02:54:16 2009] [error] [client 66.249.71.112] File does not exist: /home/sportsti/public_html/robots.txt
[Fri Feb 20 02:34:23 2009] [error] [client 72.30.142.223] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 02:34:23 2009] [error] [client 72.30.142.223] File does not exist: /home/sportsti/public_html/robots.txt
[Fri Feb 20 01:36:28 2009] [error] [client 65.55.107.188] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 01:36:28 2009] [error] [client 65.55.107.188] File does not exist: /home/sportsti/public_html/swfobject.js
[Fri Feb 20 01:06:19 2009] [error] [client 76.175.32.221] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 01:06:19 2009] [error] [client 76.175.32.221] File does not exist: /home/sportsti/public_html/favicon.ico
[Fri Feb 20 01:06:16 2009] [error] [client 76.175.32.221] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 01:06:16 2009] [error] [client 76.175.32.221] File does not exist: /home/sportsti/public_html/crossdomain.xml
[Fri Feb 20 01:06:16 2009] [error] [client 76.175.32.221] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 01:06:16 2009] [error] [client 76.175.32.221] File does not exist: /home/sportsti/public_html/favicon.ico
[Fri Feb 20 01:06:15 2009] [error] [client 76.175.32.221] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 01:06:15 2009] [error] [client 76.175.32.221] File does not exist: /home/sportsti/public_html/images/OSCMAX_infobox_bg.gif
[Fri Feb 20 01:06:13 2009] [error] [client 76.175.32.221] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 01:06:13 2009] [error] [client 76.175.32.221] File does not exist: /home/sportsti/public_html/swfobject.js
[Fri Feb 20 00:32:58 2009] [error] [client 76.220.55.170] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 00:32:58 2009] [error] [client 76.220.55.170] File does not exist: /home/sportsti/public_html/favicon.ico
[Fri Feb 20 00:32:55 2009] [error] [client 76.220.55.170] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 00:32:55 2009] [error] [client 76.220.55.170] File does not exist: /home/sportsti/public_html/crossdomain.xml
[Fri Feb 20 00:32:55 2009] [error] [client 76.220.55.170] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 00:32:55 2009] [error] [client 76.220.55.170] File does not exist: /home/sportsti/public_html/favicon.ico
[Fri Feb 20 00:32:54 2009] [error] [client 76.220.55.170] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 00:32:54 2009] [error] [client 76.220.55.170] File does not exist: /home/sportsti/public_html/images/OSCMAX_infobox_bg.gif
[Fri Feb 20 00:32:51 2009] [error] [client 76.220.55.170] File does not exist: /home/sportsti/public_html/404.shtml
[Fri Feb 20 00:32:51 2009] [error] [client 76.220.55.170] File does not exist: /home/sportsti/public_html/swfobject.js
[Thu Feb 19 23:49:45 2009] [error] [client 24.110.249.245] File does not exist: /home/sportsti/public_html/404.shtml

I think the problem might be this was designed for OSCOMMERCE and not OSCMAX. Everything works in the ADMIN tool, but it breaks my real site. Maybe it will never work? Or is this a simple fix?

Judging by the errors it seems it is a .htaccess problem. Because it looks like the htaccess file creates a virtual url of which the real path does not exist then it is directed to the 404 error page which does not exist. So I am 89% sure it is your .htacccess file if there is one. So try posting your .htaccess file and your real file structure and I shall help.

Here are the contents of that file:


# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName sportstickies.com
AuthUserFile /home/sportsti/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/sportsti/public_html/_vti_pvt/service.grp

Guys, where did you go? :)

Here I am!
So the .htaccess file you posted is located at /home/sportsti/public_html/.htaccess or in other words is in the base of your public_html web directory?
Seems kinda odd that it redirects to a 404.shtml error page without that entry in the .htaccess file. Unless of course that 404.shtml file is located within the security policies which are included into the .htaccess file.

So what I can tell from your .htaccess file is that each time a user tries to retrieve a picture, javascript file etc, the server denies the user from accessing them due to the .htaccess file security policies. And that is what appears to be appending to your error log file. It appears the .htaccess file only contains data in relation to the security policies so if you tried to remove the .htaccess file then those errors append to the log. However if the security policies are still needed though, you will probably need to modify your .htaccess file to allow the browser to download the pictures, javascript files, robots.txt file etc.

I'm not that sure on how to make the correct modifications to your .htaccess file you might want to experiment with the sections that say deny from all and allow from all and order deny,allow Those sections are what control the security policies and are currently too strict for the browser to even just download a picture.

At least that is just from my observations of what you have posted so you can try removing the .htaccess file as a test and clearing the error log. Than after that load the page (with an empty error log and no .htaccess file) and see what errors are reported then. I believe that should remove at least some of the problems being reported in the error log.

so I tried removing the .htacess file, actually renaming it not.htaccess,

this made no difference on the errors. I am at a loss. I may just have to revert back to an old version and give up on the sort functionality. I find support for OSCMAX to be not very good. I don't understand why the backend admin tool displays everything correctly, yet the actual site breaks.??

[Mon Feb 23 09:30:30 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/404.shtml
[Mon Feb 23 09:30:30 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/swfobject.js
[Mon Feb 23 09:30:28 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/404.shtml
[Mon Feb 23 09:30:28 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/swfobject.js
[Mon Feb 23 09:30:25 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/404.shtml
[Mon Feb 23 09:30:25 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/swfobject.js
[Mon Feb 23 09:30:18 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/404.shtml
[Mon Feb 23 09:30:18 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/swfobject.js
[Mon Feb 23 02:30:45 2009] [error] [client 65.55.209.111] File does not exist: /home/sportsti/public_html/404.shtml

so I tried removing the .htacess file, actually renaming it not.htaccess,

this made no difference on the errors. I am at a loss. I may just have to revert back to an old version and give up on the sort functionality. I find support for OSCMAX to be not very good. I don't understand why the backend admin tool displays everything correctly, yet the actual site breaks.??

[Mon Feb 23 09:30:30 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/404.shtml
[Mon Feb 23 09:30:30 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/swfobject.js
[Mon Feb 23 09:30:28 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/404.shtml
[Mon Feb 23 09:30:28 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/swfobject.js
[Mon Feb 23 09:30:25 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/404.shtml
[Mon Feb 23 09:30:25 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/swfobject.js
[Mon Feb 23 09:30:18 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/404.shtml
[Mon Feb 23 09:30:18 2009] [error] [client 66.177.129.191] File does not exist: /home/sportsti/public_html/swfobject.js
[Mon Feb 23 02:30:45 2009] [error] [client 65.55.209.111] File does not exist: /home/sportsti/public_html/404.shtml

From all the topics I have posted on this one seems the weirdest. Because from the previous posts all the other possibilities have been eliminated saying that it is your script. And yet there is a custom 404 error page without the help of a .htaccess file. However the custom 404 error page cannot be found so it too is then redirect to a different error page. So if it is your script, I understand that it is possible to rewrite urls (probably php4 - unsure if php5) with the following code:

<?
$docroot        = $_SERVER['DOCUMENT_ROOT'];
$script_root    = str_replace( basename($_SERVER['SCRIPT_NAME']),'',$_SERVER['SCRIPT_NAME'] );
$script_ext     = substr( $_SERVER['SCRIPT_NAME'], strrpos( $_SERVER['SCRIPT_NAME'],'.' ) );
$fakework_root  = $script_root.basename( $_SERVER['SCRIPT_NAME'] ).'/';
$framework_root = $script_root.'_'.basename( $_SERVER['SCRIPT_NAME'], $script_ext ).'/';
$frequest_root  = dirname( $framework_root.substr( $_SERVER['PATH_INFO'], 1 )).'/';
$frequest_name  = basename( $_SERVER['PATH_INFO'] );
$frequest_ext   = (strrpos($frequest_name,'.')===FALSE ? FALSE : strtolower(substr( $frequest_name, ( strrpos( $frequest_name, '.' )+1 ) ) ) );
$frequest_full  = $frequest_root.$frequest_name;
$doc_frequest   = $docroot.$frequest_full;
$doc_framework   = $docroot.$framework_root;

$DO_PARSE = in_array( $frequest_ext, $chk_exts );
if( $DO_PARSE )
{
    $tmpfname = tempnam( $doc_framework.'tmp', 'aj_' ).($frequest_ext? ('.'.$frequest_ext) : '');
    if( ($to_parse=@file_get_contents($doc_frequest))===FALSE )
        $to_parse="404";
    $tmpvname = str_replace( $docroot, '', $tmpfname );
    $tmpvname = str_replace( '\\\\', '/', $tmpvname );
// - - - - - - - - - - - - - - - - - - - - - - - - - - -
//  Do processing of data stored in $to_parse
// - - - - - - - - - - - - - - - - - - - - - - - - - - -
    $to_parse = striptags( $to_parse );

// - - - - - - - - - - - - - - - - - - - - - - - - - - -
    $handle = fopen($tmpfname, "w");
    fwrite($handle, $to_parse);
    fclose($handle);
    @virtual( $tmpvname.$getvars );
    unlink( $tmpfname );
}
else
    @virtual( $frequest_full.$getvars );

?>

The above code shows what you may need to watch for within your script. In particular the virtual() function. Now that the other possibilities are eliminited, I suspect there is something simular (perhaps written in totally differently style) within your php pages. As rare as scripts like this appear they still do appear.

So I ask, could you check your script for the following functions and post the code surrounding the function (perhaps post 15 lines if one is found)

  • virtual()
  • apachie_* (* being a wild card)
  • tmpfile()
This article has been dead for over six months. Start a new discussion instead.