mysql errors
Posted: Fri Jan 06, 2012 1:00 pm
hey all
i have this code that i am trying to fix but i am getting errors
here is the code
here is the errors i get
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/myscript/public_html/xtremepro/accounts/allocate.php on line 12
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/myscript/public_html/xtremepro/accounts/allocate.php on line 16
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/myscript/public_html/xtremepro/accounts/allocate.php on line 19
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/myscript/public_html/xtremepro/accounts/allocate.php on line 33
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/myscript/public_html/xtremepro/accounts/allocate.php on line 35
any help i can get would be great
i have this code that i am trying to fix but i am getting errors
here is the code
Code: Select all
<?php
session_start();
require_once('../inc/db.php');
$dbc = db_connect();
require_once('../inc/check_login.php');
include('../inc/functions.php');
include('vars.php');
include('header.php');
$res = mysql_query("select * from members where id='" . $_SESSION['admin_id'] . "'");
$con = mysql_fetch_array($res, MYSQL_ASSOC);
@mysql_free_result($res);
if (mysql_num_rows($res) != 0) {
}
$usrid = $memb['id'];
$credits = mysql_result($res, 0, "credits");
$credits = round($credits, 2);
echo("<p class=big><a href=$self_url" . "accounts/index.php title=\"Back to main page\"><font face=$fontface size=2><b>User account #$usrid</b></font></a><font face=$fontface size=2> : : Allocate credits</p>");
echo("<p>You have <b><font color=red>$credits</font></b> credit(s)");
echo(" on your account.<br>You can allocate ");
if ($credits > 1) {echo("them");} else {echo("it");}
echo(" to the following site(s):<br>
<table border=0 cellpadding=2>
<form action=$self_url" . "accounts/index.php method=post>
<input type=hidden name=fform value=allocate><tr style=\"background-color: $cellbg1\">
<td align=left><font size=2>URL</td><td align=left><font size=2>Site credits</td>
<td align=left><font size=2>Allocate</td></tr>");
$res = mysql_query("select id, url, credits from site where usrid='{$memb['id']}' order by id asc");
$con1 = mysql_fetch_array($res, MYSQL_ASSOC);
@mysql_free_result($res);
for ($i = 1; $i < mysql_num_rows($res); $i++) {
$id = $con1['id'];
$url = mysql_result($res, $i, "url");
$scred = mysql_result($res, $i, "credits");
$scred = round($scred, 2);
$name = "_" . $id;
echo("<tr style=\"background-color: $cellbg2\"><td>
<font size=2>$url</td><td><font size=2>$scred</td>
<td><input type=text size=5 name=$name value=0 class=webforms></td></tr>");
}
echo("<tr>
<td colspan=3 align=right>
<input type=submit value=\"Allocate\" class=\"formbutton\"></td></tr></form>
<tr><form action=$self_url" . "accounts/ method=post>
<input type=hidden name=fform value=nope><td align=right colspan=3>
<input type=submit value=\"Cancel\" class=\"formbutton\"></td></tr></form></table></p>");
mysql_close;
exit;
?>
<?php
include('footer.php');
?>
here is the errors i get
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/myscript/public_html/xtremepro/accounts/allocate.php on line 12
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/myscript/public_html/xtremepro/accounts/allocate.php on line 16
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/myscript/public_html/xtremepro/accounts/allocate.php on line 19
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/myscript/public_html/xtremepro/accounts/allocate.php on line 33
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/myscript/public_html/xtremepro/accounts/allocate.php on line 35
any help i can get would be great