Click to See Complete Forum and Search --> : script Error
smilemaker
06-29-2007, 09:57 PM
hey guys i have installed a shopping cart script named "Vip Cart" and it was installed successfully but now i m getting an error like
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/resellpr/public_html/cart/classes.php on line 12
Fatal error: Call to a member function fetch_array() on a non-object in /home/resellpr/public_html/cart/classes.php on line 69
can anyone help me? please
smilemaker
06-29-2007, 11:17 PM
this is my classes.php and i have highlighted the line 12, 69
<? ob_start();
session_start();
session_register("username_session");
session_register("password_session");
$user_name_session=$_SESSION[username_session];
$password_session=$_SESSION[password_session];
$order_prefix="";
//check payment test mode active or not
$prs=mysql_query("select * from ".$prefix."admin where username='payment_testmode'");
$rowp=mysql_fetch_array($prs);
$ptest_mode=$rowp[status];
//admin payment account ids
$rseg=@mysql_fetch_array(@mysql_query("select * from ".$prefix."payment_gateway where gateway_name='Egold' ") );
$egoldid=$rseg[accountid];
$rspl=@mysql_fetch_array(@mysql_query("select * from ".$prefix."payment_gateway where gateway_name='Paypal' ") );
$paypalid=$rspl[accountid];
$rsst=@mysql_fetch_array(@mysql_query("select * from ".$prefix."payment_gateway where gateway_name='Stormpay' ") );
$stormpayid=$rsst[accountid];
$rs2c=@mysql_fetch_array(@mysql_query("select * from ".$prefix."payment_gateway where gateway_name='2Checkout' ") );
$checkoutid=$rs2c[accountid];
$rsau=@mysql_fetch_array(@mysql_query("select * from ".$prefix."payment_gateway where gateway_name='Authorized.net' ") );
$authid=$rsau[accountid];
function get_emails()
{
global $db,$prefix;
$result = $db->query("SELECT the_key,body FROM ".$prefix."email");
while($row = $result->fetch_array())
{
$key = $row['the_key'];
$EMAILS["$key"] = $row['body'];
}
return $EMAILS;
} // end function get_templates()
function get_textemails() // this is for text settinngs body
{
global $db,$prefix;
$result = $db->query("SELECT the_key,body FROM ".$prefix."text_settings");
while($row = $result->fetch_array())
{
$key = $row['the_key'];
$TEXT_EMAILS["$key"] = $row['body'];
}
//print_r($TEXT_EMAILS);
return $TEXT_EMAILS;
} // end function get_templates()
function get_subjects()
{
global $db,$prefix;
//echo "<br>"."SELECT the_key,subject FROM ".$prefix."email";
$result = $db->query("SELECT the_key,subject FROM ".$prefix."email");
while($row = $result->fetch_array())
{
$key = $row['the_key'];
$EMAILSUBJECT["$key"] = $row['subject'];
//echo "<br>classes : ".$EMAILSUBJECT["$key"];
}
//print_r($EMAILSUBJECT);
return $EMAILSUBJECT;
} // end function get_subjects()
MrCoder
06-30-2007, 01:08 PM
Change the following line and re-run the script
$prs=mysql_query("select * from ".$prefix."admin where username='payment_testmode'") or die(mysql_error());
smilemaker
07-03-2007, 12:49 PM
i tired it and workd fine mrcode thanks for the help but there's still one error
Fatal error: Call to a member function fetch_array() on a non-object in /home/resellpr/public_html/cart/classes.php on line 69
function get_subjects()
{
global $db,$prefix;
//echo "<br>"."SELECT the_key,subject FROM ".$prefix."email";
$result = $db->query("SELECT the_key,subject FROM ".$prefix."email");
while($row = $result->fetch_array())
{
$key = $row['the_key'];
$EMAILSUBJECT["$key"] = $row['subject'];
//echo "<br>classes : ".$EMAILSUBJECT["$key"];
}
//print_r($EMAILSUBJECT);
return $EMAILSUBJECT;
} // end function get_subjects()
temp.user123
07-03-2007, 12:54 PM
while($row = fetch_array($result))
smilemaker
07-03-2007, 10:15 PM
i tired it but still getting the same error
please anyone help me
thanks in advance
temp.user123
07-03-2007, 10:19 PM
Oops, that should have been as follows:
while($row = mysql_fetch_array($result))
You could have looked that up in the manual:
PHP Functions for MySQL (http://www.php.net/manual/en/ref.mysql.php)
By the way... I find this one more useful:
while ($row = mysql_fetch_assoc($result))
smilemaker
07-03-2007, 11:12 PM
i tired those both but now its saying
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/resellpr/public_html/cart/classes.php on line 69
temp.user123
07-04-2007, 12:06 AM
Yep, this isn't valid either:
$result = $db->query("SELECT the_key,subject FROM ".$prefix."email");
Where did you get all this bad code from?
smilemaker
07-04-2007, 05:35 AM
all this i got inbuilt when i got this script, please help me temp.user123, if you want i can give you this script
temp.user123
07-04-2007, 09:39 AM
Well, it looks like you must be missing something. That line of code could be valid if you had something like this somewhere else in all that code:
$db = new custom_class();
That other line of code we changed would have been valid, too, in that case.
smilemaker
07-04-2007, 11:26 AM
so where to put the above code please specify it
temp.user123
07-04-2007, 01:53 PM
The problem is, I don't know what is the name of that custom class nor where the code is to go in that custom class. Without it, you're stuck converting all references to that class back to their native PHP counterparts.