| | |
database.php problem
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Feb 2009
Posts: 9
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Feb 2009
Posts: 9
Reputation:
Solved Threads: 0
php Syntax (Toggle Plain Text)
} $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.
Last edited by peter_budo; Feb 21st, 2009 at 5:01 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: Feb 2009
Posts: 9
Reputation:
Solved Threads: 0
php Syntax (Toggle Plain Text)
<?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.
php Syntax (Toggle Plain Text)
// 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
php Syntax (Toggle Plain Text)
$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 . "'");
Last edited by peter_budo; Feb 21st, 2009 at 5:02 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
•
•
}
$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.
php Syntax (Toggle Plain Text)
$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());
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.
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
•
•
•
•
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:Also the linephp Syntax (Toggle Plain Text)
$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());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.
![]() |
Similar Threads
- php/mysql dynamic multi-level menu problem (MySQL)
- php value problem (PHP)
- Problems using a php generator (PHP)
- PHP/Mysql (PHP)
- Online Database - PHP/ MYSQL (PHP)
- Submit info to database error (PHP)
- PHP Help - Display forum online and total members on main page (PHP)
- Insert radio button value into MS Access database (ASP)
- adding a database to my webpage (PHP)
- php mysql help (PHP)
Other Threads in the PHP Forum
- Previous Thread: single quotes(') problem in inserting data into database
- Next Thread: help form mail script. line 17
| Thread Tools | Search this Thread |
apache api array basic broken cache cakephp class cms code computing confirm countingeverycharactersfromastring crack cron curl customizableitems database date decode delete dynamic echo email error fcc file filter folder form forum freelancing function functions gc_maxlifetime header headmethod howtowriteathesis href htaccess html iframe image include incode integration ip javascript joomla limit link login malfunction match memmory memory menu method mod_rewrite multiple mysql navigation neutrality oop parsing paypal pdf php phpmysql protocol query question random recursiveloop root script search select server sessions sms snippet soap source space sql strip_tags support! system table template thesishelp trouble tutorial upload url variable web window.onbeforeunload=closeme; youtube






