Line 1526 & 1658: need period before $table_prefix
################ -- Find --> in bookstore.php --> this is fixing the call by reference problem --> We are removing the reference sign on function call and putting it on function definition.
# Mainfunction to parse the XML defined by URL
function amazon_xml_parsexml ($URL) {
amazon_xml_loadxml($URL,&$String);
$Encoding=amazon_xml_encoding($String);
amazon_xml_deleteelements(&$String,"?");
amazon_xml_deleteelements(&$String,"!");
amazon_xml_readxml($String,&$Data,$Encoding);
return($Data);
}
################ -- Replace with:
# Mainfunction to parse the XML defined by URL
function amazon_xml_parsexml ($URL) {
amazon_xml_loadxml($URL,$String);
$Encoding=amazon_xml_encoding($String);
amazon_xml_deleteelements($String,"?");
amazon_xml_deleteelements($String,"!");
amazon_xml_readxml($String,$Data,$Encoding);
return($Data);
}
################ -- Find in --> bookstore.php
function amazon_xml_loadxml($URL,$String) {
################ -- Replace with:
function amazon_xml_loadxml($URL,&$String) {
################ -- Find in --> bookstore.php
function amazon_xml_deleteelements($String,$Char) {
################ -- Replace with:
function amazon_xml_deleteelements(&$String,$Char) {
################ -- Find in --> bookstore.php
function amazon_xml_readxml($String,$Data,$Encoding='') {
################ -- Replace with:
function amazon_xml_readxml($String,&$Data,$Encoding='') {
################ -- Find in these files in your /mod/bookstore/ folder
Rename file: INDEX.PHP to index.php
Rename file: CACHE to cache
################ -- After all that NOW -->
Okay so now I am getting the following errors on lines 1193, 1277, 1673, 1659: I ignore them and click on INSTALL anyway and I get a successful install and these errors are gone I believe this happened because the actual database tables these lines of code were trying to access didnt exist because they hadnt been installed/created
yet So now that I installed the tables have been created and these errors are gone
Line 1193
$resShowRec = mysql_query("SELECT ShowRec FROM ".$table_prefix."mod_bookstore_config WHERE ShowRec=1");
list ($ShowRec) = mysql_fetch_row ($resShowRec);
Line 1277
$res = mysql_query("SELECT ShowSearch FROM ".$table_prefix."mod_bookstore_config WHERE ShowSearch=1");
while (list ($ShowSearch) = mysql_fetch_row ($res)) {
Line 1673
$resShowSugg = mysql_query("SELECT showsugg FROM ".$table_prefix."mod_bookstore_config WHERE showsugg=1");
list ($showsugg) = mysql_fetch_row ($resShowSugg);
Line 1659
$result = mysql_query ("SELECT category_id, name FROM " .$table_prefix. "mod_bookstore_categories ORDER by name");
if(mysql_num_rows($result)) {
################ -- Find in --> bookstore.php -- only if your sever didn't pick up the images -- mine didn't so I downloaded
the images to my /images/ folder and changed "http://images.amazon.com/images/G/01/" to "http://yourwebsite.org/images/"
After reviewing your code I noticed you were missing the & in the following function defs in bookstore.php
-- we reverse what the original program does by defining the function with the pass by ref &$ rather than calling the func w/ the pass by ref &$ -- this gets rid of the blank screen...
# Delete elements
function amazon_xml_deleteelements(&$String,$Char) {
# Read XML and transform into array
function amazon_xml_readxml($String,&$Data,$Encoding='') {
# Function to load the XML from File/URL
function amazon_xml_loadxml($URL,&$String) {
-->>>> and in bookstore_admin.php
there was a ".$umod.; that needed to be ".$umod; on line 152
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is what I had to do to get rid of the: Couldn't delete book from database: Table 'mars_grandma.mod_bookstore_items' doesn't exist
and
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /usr/www/users/mars/akratiri/mod/bookstore/bookstore_admin.php on line 272...
If you haven't tried deleting a book yet give it a go and see what happens...
First goto your config.php for phpws and look in there and see what you $table_prefix= is equal to... Mine was set to $table_prefix ="phpws_";
In bookstore_admin.php
find and replace all (including the quotes) --> " .$table_prefix. "
with --> phpws_
or with --> a single space -->if your $table_prefix="" ;
hope this helps...
all the best,
annie
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
goto phpgirl.com and ask her -- she is running 9x and has some bookstore code up and running -- probably not this old module -- something new -- or she may have modified it herself...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
################ -- Find --> bookstore.php
Line 1526 & 1658: need period before $table_prefix
################ -- Find --> in bookstore.php --> this is fixing the call by reference problem --> We are removing the reference sign on function call and putting it on function definition.
# Mainfunction to parse the XML defined by URL
function amazon_xml_parsexml ($URL) {
amazon_xml_loadxml($URL,&$String);
$Encoding=amazon_xml_encoding($String);
amazon_xml_deleteelements(&$String,"?");
amazon_xml_deleteelements(&$String,"!");
amazon_xml_readxml($String,&$Data,$Encoding);
return($Data);
}
################ -- Replace with:
# Mainfunction to parse the XML defined by URL
function amazon_xml_parsexml ($URL) {
amazon_xml_loadxml($URL,$String);
$Encoding=amazon_xml_encoding($String);
amazon_xml_deleteelements($String,"?");
amazon_xml_deleteelements($String,"!");
amazon_xml_readxml($String,$Data,$Encoding);
return($Data);
}
################ -- Find in --> bookstore.php
function amazon_xml_loadxml($URL,$String) {
################ -- Replace with:
function amazon_xml_loadxml($URL,&$String) {
################ -- Find in --> bookstore.php
function amazon_xml_deleteelements($String,$Char) {
################ -- Replace with:
function amazon_xml_deleteelements(&$String,$Char) {
################ -- Find in --> bookstore.php
function amazon_xml_readxml($String,$Data,$Encoding='') {
################ -- Replace with:
function amazon_xml_readxml($String,&$Data,$Encoding='') {
################ -- Find in --> bookstore.php
amazon_xml_readxml($ThisContent,&$TmpData,$Encoding);
################ -- Replace with:
amazon_xml_readxml($ThisContent,$TmpData,$Encoding);
################ -- Find --> bookstore_admin.php
Line 152 need period before $umod
Line 282 & 508 need period after $table_prefix
################ -- Find --> bookstore.php line 1019
amazon_xml_readxml($ThisContent,&$TmpData,$Encoding);
################ -- Replace with:
amazon_xml_readxml($ThisContent,$TmpData,$Encoding);
################ -- Find in these files in your /mod/bookstore/ folder
Rename file: INDEX.PHP to index.php
Rename file: CACHE to cache
################ -- After all that NOW -->
Okay so now I am getting the following errors on lines 1193, 1277, 1673, 1659: I ignore them and click on INSTALL anyway and I get a successful install and these errors are gone I believe this happened because the actual database tables these lines of code were trying to access didnt exist because they hadnt been installed/created
yet So now that I installed the tables have been created and these errors are gone
Line 1193
$resShowRec = mysql_query("SELECT ShowRec FROM ".$table_prefix."mod_bookstore_config WHERE ShowRec=1");
list ($ShowRec) = mysql_fetch_row ($resShowRec);
Line 1277
$res = mysql_query("SELECT ShowSearch FROM ".$table_prefix."mod_bookstore_config WHERE ShowSearch=1");
while (list ($ShowSearch) = mysql_fetch_row ($res)) {
Line 1673
$resShowSugg = mysql_query("SELECT showsugg FROM ".$table_prefix."mod_bookstore_config WHERE showsugg=1");
list ($showsugg) = mysql_fetch_row ($resShowSugg);
Line 1659
$result = mysql_query ("SELECT category_id, name FROM " .$table_prefix. "mod_bookstore_categories ORDER by name");
if(mysql_num_rows($result)) {
################ -- Find in --> bookstore.php -- only if your sever didn't pick up the images -- mine didn't so I downloaded
the images to my /images/ folder and changed "http://images.amazon.com/images/G/01/" to "http://yourwebsite.org/images/"
<img align=\"middle\" src=\"http://images.amazon.com/images/G/01/associates/home-logo-130x60wgif\" alt=\"homelogo\" width=\"130\" height=\"60\" border=\"0\" /></a></td></tr>";
################ -- Replace with: -- only if your sever didn't pick up the images -- mine didn't
<img align=\"middle\" src=\"http://yourwebsite.org/images/amazon130X60w.gif\" alt=\"homelogo\" /></a></td></tr>";
Hmmm. I made all these changes, and still I get the blank screen at the admin part. What else might I need to do?
After reviewing your code I noticed you were missing the & in the following function defs in bookstore.php
-- we reverse what the original program does by defining the function with the pass by ref &$ rather than calling the func w/ the pass by ref &$ -- this gets rid of the blank screen...
# Delete elements
function amazon_xml_deleteelements(&$String,$Char) {
# Read XML and transform into array
function amazon_xml_readxml($String,&$Data,$Encoding='') {
# Function to load the XML from File/URL
function amazon_xml_loadxml($URL,&$String) {
-->>>> and in bookstore_admin.php
there was a ".$umod.; that needed to be ".$umod; on line 152
This is what I had to do to get rid of the: Couldn't delete book from database: Table 'mars_grandma.mod_bookstore_items' doesn't exist
and
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /usr/www/users/mars/akratiri/mod/bookstore/bookstore_admin.php on line 272...
If you haven't tried deleting a book yet give it a go and see what happens...
First goto your config.php for phpws and look in there and see what you $table_prefix= is equal to... Mine was set to $table_prefix ="phpws_";
In bookstore_admin.php
find and replace all (including the quotes) --> " .$table_prefix. "
with --> phpws_
or with --> a single space -->if your $table_prefix="" ;
hope this helps...
all the best,
annie
Did a working mod come from any of this?
Will the above changes make it work on phpws 8.3?
It worked fine in most applications, but there are a couple of bugs.
Also, it doesn't work with 0.9.x, only 0.8.x
Victor
goto phpgirl.com and ask her -- she is running 9x and has some bookstore code up and running -- probably not this old module -- something new -- or she may have modified it herself...
It's funny -- but my download said it was 8.3, but if you do a view source I see 8.1 -- weird...
If you want I can send you a zip file with all my bookstore code w/ changes so you can try it...