Kaskus

Tech

fajrisuksesAvatar border
TS
fajrisukses
[Bth Bantuan] Mohon bantuan Masta Php tentang MYSQL Resource Error..
Salam untk semua Kaskuser.
Saya ada ketemu Error di Web saya
"
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/buy4php/public_html/matrix/matrixpro/purchasepos.php on line 99"

Code:
<?php
session_start();
include "header.php";
include "config.php";
if (!isset($_SESSION["username_session"]))
{

?>
<form action=login.php method=post>

<br><br><Center><table><tr><td colspan=2 align=center><h3>Members Login Area</h3></td></tr>
<tr><td>Username</td><td><input type=text name=id></td></tr>
<tr><td>Password</td><td><input type=password name=password></td></tr>
<tr><td>�</td><td>
<a href="forgot.php"><font face="Verdana,Arial,Helvetica" size="1" color="#000000"><b>Forgot Your Password?</b></font></a></td></tr>
<tr><td colspan=2 align=center><input type=submit value="Log In"></td></tr>
</table></form>



<?php
}
else
{

middle();
}

function middle()
{
include "config.php";
$id=$_SESSION["username_session"];
$username=$_SESSION["username_session"];
$rs = mysql_query("select * from users where Username='$id'");
$arr=mysql_fetch_array($rs);
$ref_by=$arr[11];
$status=$arr[14];
$unpaid=$arr[16];

$err=0;
$errmsg="";

if($status==2) {
if($multipurchaseallowed==0) {
if($pospurnextlevel==0) {
$err=1;
$errmsg="<br><b>You are not allowed to purchase more than 1 position in the system.</b><br>";
}
else {
$ll=0;
$lastl=0;
$rsm=mysql_query("select * from membershiplevels order by ID");
while($arrm=mysql_fetch_array($rsm)) {
$lastl=$arrm[0];
$rsm1=mysql_query("select * from matrix$arrm[0] where Username='$username'");
$num=mysql_num_rows($rsm1);
if($num>0) $ll=$arrm[0];
}

if($ll==$lastl) {
$err=1;
$errmsg="<br><b>You are not allowed to purchase more than 1 position any matrix level and you already have a position in each matrix level.</b><br>";
}

}
} else {

if($pospurnextlevel==0) {
$rsm=mysql_query("select * from membershiplevels order by ID limit 0,1");
while($arrm=mysql_fetch_array($rsm)) {
$rsm1=mysql_query("select * from matrix$arrm[0] where Username='$username'");
$num=mysql_num_rows($rsm1);
if($num>($maxposperlevel-1)) {
$err=1;
$errmsg="<br><b>You have already purchased the maximum number of allowed position in the system.</b><br>";
}
}
} else {
$chk=0;
$rsm=mysql_query("select * from membershiplevels order by ID");
$chk1=mysql_num_rows($rsm);
while($arrm=mysql_fetch_array($rsm)) {
$rsm1=mysql_query("select * from matrix$arrm[0] where Username='$username'");
$num=mysql_num_rows($rsm1);
if($num>($maxposperlevel-1)) $chk++;
}

if($chk==$chk1) {
$err=1;
$errmsg="<br><b>You have already purchased the maximum number of allowed position in the system.</b><br>";
}

}

}
}

$rsm1=mysql_query("select * from matrix$startmatrix where Username='$username'");
[B]$snum=mysql_num_rows($rsm1);[/B]

?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="10" colspan="2">�</td>
</tr>
<tr>
<td align="left" class="bodytext" width="150" valign="top"><br>
<p align="left"> �<br><font face=verdana size=2><a href="login.php">Members Home</a><br><br>
<a href="purchasepos.php">Purchase Position(s)</a><br><br>
<a href="stats.php">Stats</a><br><br>
<a href="managepos.php">Matrix Positions</a><br><br>
<a href="withdrawal.php">Withdrawal</a><br><br>
<a href="ads.php">Promotional Center</a><br><br>
<a href="banners.php">Banner Advertisement</a><br><br>
<a href="textadv.php">Text Ad Advertisement</a><br><br>
<a href="sbanners.php">Side Banner Advertisement</a><br><br>
<a href="bonus.php">Bonus</a><br><br>
<a href="update_pf.php">Profile</a><br><br>
<a href="submittestimonials.php">Submit Testimonials</a><br><br>
<a href="logout.php">Logout</a>
</font></p>
</td><td align="left" class="bodytext" width="500" valign="top">
<table border="0" width="98%"><tr><td><font face="verdana" size="3"><b><p align="center">Purchase Position(s)</b></font></p>
<br><font face=verdana size=2>
<?php

if($err==1) {
echo $errmsg;
}
else {
if(!$_POST) {
?>
<form action=purchasepos.php method=post>
Position: <select name=package>
<?php
if($snum==0) {
$rsm=mysql_query("select * from membershiplevels where ID=$startmatrix");
while($arrm=mysql_fetch_array($rsm)) {
echo "<option value=$arrm[0]>$arrm[1] Position for $$arrm[2]</option>";
}
}
else {
if($status==1) {
$m=0;
$rsm=mysql_query("select * from membershiplevels order by ID");
while($arrm=mysql_fetch_array($rsm)) {
$m++;
if($m==1) echo "<option value=$arrm[0]>$arrm[1] Position for $$arrm[2]</option>";
else {
if($pospurnextlevel==1) echo "<option value=$arrm[0]>$arrm[1] Position for $$arrm[2]</option>";
}

} // End of Membership Levels check
} // End of free membership status
else {
$rsm=mysql_query("select * from membershiplevels order by ID");
while($arrm=mysql_fetch_array($rsm)) {
$rsm1=mysql_query("select * from matrix$arrm[0] where Username='$username'");
$num=mysql_num_rows($rsm1);

if($pospurnextlevel==0) {
if($num>0&&$multipurchaseallowed==1&&$num<$maxposperlevel)
echo "<option value=$arrm[0]>$arrm[1] Position for $$arrm[2]</option>";
}
else {
if($num==0)
echo "<option value=$arrm[0]>$arrm[1] Position for $$arrm[2]</option>";
elseif($multipurchaseallowed==1&&$num<$maxposperlevel)
echo "<option value=$arrm[0]>$arrm[1] Position for $$arrm[2]</option>";
}

} // End of Membership Levels check
} // End of pro membership status
}
?>


Line 99 adalah coding yang saya kasih BOLD $snum=mysql_num_rows($rsm1);

Mohon koreksi dan Bantuan agan2 ..
Kira2 error nya knapa y?
Saya sangat berterima kasih sekali atas bantuan agan2 semuanya

Wassalam
Ahmad..
0
1K
3
GuestAvatar border
Komentar yang asik ya
Urutan
Terbaru
Terlama
GuestAvatar border
Komentar yang asik ya
Komunitas Pilihan