/    Sign up×
Community /Pin to ProfileBookmark

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

to post a comment
PHP

12 Comments(s)

Copy linkTweet thisAlerts:
@smilemakerauthorJun 30.2007 — 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'");
[B][COLOR="Red"] $rowp=mysql_fetch_array($prs);[/COLOR][/B]

$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");

[B][COLOR="Red"][COLOR="Red"] while($row = $result->fetch_array())[/COLOR][/COLOR][/B]

{

$key = $row['the_key'];

$EMAILSUBJECT["$key"] = $row['subject'];
//echo "<br>classes : ".$EMAILSUBJECT["$key"];
}
//print_r($EMAILSUBJECT);
return $EMAILSUBJECT;


} // end function get_subjects()[/QUOTE]
Copy linkTweet thisAlerts:
@MrCoderJun 30.2007 — Change the following line and re-run the script

[code=php]
$prs=mysql_query("select * from ".$prefix."admin where username='payment_testmode'") or die(mysql_error());
[/code]
Copy linkTweet thisAlerts:
@smilemakerauthorJul 03.2007 — i tired it and workd fine mrcode thanks for the help but there's still one error

[B]Fatal error: Call to a member function fetch_array() on a non-object in /home/resellpr/public_html/cart/classes.php on line 69[/B]

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");

[B][COLOR="Red"]while($row = $result->fetch_array())[/COLOR][/B]

{

$key = $row['the_key'];

$EMAILSUBJECT["$key"] = $row['subject'];

//echo "<br>classes : ".$EMAILSUBJECT["$key"];

}

//print_r($EMAILSUBJECT);

return $EMAILSUBJECT;

} // end function get_subjects()
Copy linkTweet thisAlerts:
@temp_user123Jul 03.2007 — [code=php]while($row = fetch_array($result))[/code]
Copy linkTweet thisAlerts:
@smilemakerauthorJul 04.2007 — i tired it but still getting the same error

please anyone help me

thanks in advance
Copy linkTweet thisAlerts:
@temp_user123Jul 04.2007 — Oops, that should have been as follows:
[code=php]
while($row = mysql_fetch_array($result))[/code]

You could have looked that up in the manual:

PHP Functions for MySQL

By the way... I find this one more useful:
[code=php]
while ($row = mysql_fetch_assoc($result))[/code]
Copy linkTweet thisAlerts:
@smilemakerauthorJul 04.2007 — 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
Copy linkTweet thisAlerts:
@temp_user123Jul 04.2007 — 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?
Copy linkTweet thisAlerts:
@smilemakerauthorJul 04.2007 — all this i got inbuilt when i got this script, please help me temp.user123, if you want i can give you this script
Copy linkTweet thisAlerts:
@temp_user123Jul 04.2007 — 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.
Copy linkTweet thisAlerts:
@smilemakerauthorJul 04.2007 — so where to put the above code please specify it
Copy linkTweet thisAlerts:
@temp_user123Jul 04.2007 — 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.
×

Success!

Help @smilemaker spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...