these are the error codes that keep coming up:

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/maddog/public_html/profiles/v. 2.0/functions.php on line 4859

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/maddog/public_html/profiles/v. 2.0/functions.php on line 19

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/maddog/public_html/profiles/v. 2.0/functions.php on line 28

Warning: Cannot modify header information - headers already sent by (output started at /home/maddog/public_html/profiles/v. 2.0/functions.php:4859) in /home/maddog/public_html/profiles/v. 2.0/functions.php on line 463

here is the code file:

functions.php

I'm looking for someone that can download it, fix it, and send it to me. my e-mail is [EMAIL="maddogs_profiles@yahoo.com"]maddogs_profiles@yahoo.com[/EMAIL] thanks :)

Attachments
<?
$conn_id;
$sql_res;
$sql_res2;
$sql_query;
$HTTP_REFERER=$_SERVER["HTTP_REFERER"];
$REQUEST_METHOD=$_SERVER["REQUEST_METHOD"];

function sql_connect(){
	global $conn_id,$sql_host,$sql_user,$sql_pass,$sql_db;
	$conn_id=mysql_connect($sql_host,$sql_user,$sql_pass);
	mysql_select_db($sql_db);
}

function sql_execute($sql_query,$wtr){
	global $conn_id;
	$sql_res=mysql_query($sql_query,$conn_id);
	if($wtr=='get'){
		if(mysql_num_rows($sql_res)){
			return mysql_fetch_object($sql_res);
		}
		else {
			return '';
		}
	}
	elseif($wtr=='num'){
	//	echo $sql_query;
		return mysql_num_rows($sql_res);
	}
	elseif($wtr=='res'){
		return $sql_res;
	}
}

function sql_rows($id,$table){
global $conn_id;
$query="select $id from $table";
$result=mysql_query($query,$conn_id);
$number=mysql_num_rows($result);
return $number;
}

function sql_close(){
global $conn_id;
mysql_close($conn_id);
}
function h_banners()	{
global $cookie_url,$main_url;

	$sql="select * from banners where b_blk='N' and b_typ='H' and b_exp='N'";
	$res=mysql_query($sql);
	$dis=array();
	$dis_id=array();
	$num=mysql_num_rows($res);
	if(mysql_num_rows($res))	{
		while($row=mysql_fetch_object($res))	{
			$tmp=explode(".",$row->b_img);
			$tmp_count=count($tmp);
			$ext=strtolower($tmp[$tmp_count-1]);
			if($ext=="swf")	{
				$img_s="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='420' height='60'>
  						<param name='movie' value='".$main_url."/".$row->b_img."'>
						<param name='quality' value='high'>
						<embed src='".$main_url."/".$row->b_img."' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='420' height='60'></embed></object>";
			}	else	$img_s="<img src='".$main_url."/".$row->b_img."' border='0' width='420' height='60' alt='".stripslashes($row->b_desc)."' ismap>";
			$dis[]="<A href='".$main_url."/banners/index.php?url=".$row->b_url."&seid=".$row->b_id."&sess=set' target='_blank'>".$img_s."</a>";
			$dis_id[]=$row->b_id;
		}
		$tak=rand(0,$num);
		$sql_query="select * from banners where b_id='$dis_id[$tak]'";
		$num=sql_execute($sql_query,'num');
		if($num!=0)	{
			$bann=sql_execute($sql_query,'get');
				$d_f=date("d",$bann->b_f_day);
				$m_f=date("m",$bann->b_f_day);
				$y_f=date("Y",$bann->b_f_day);
				$d_t=date("d",$bann->b_t_day);
				$m_t=date("m",$bann->b_t_day);
				$y_t=date("Y",$bann->b_t_day);
//				$f_day=mktime(0,0,0,$m_f,$d_f,$y_f);
//				$t_day=mktime(0,0,0,$m_t,$d_t,$y_t);
				$f_day=mktime(0,0,0,$m_f,$d_f,$y_f);
				$t_day=mktime(0,0,0,$m_t,$d_t,$y_t);
				$today=mktime(0,0,0,date("m"),date("d"),date("Y"));
				if(($bann->b_dur=="D") and ($today>$t_day))	{
					delete_banner($dis_id[$tak]);
				}
				elseif($bann->b_dur=="C" and ($bann->b_ncl<=$bann->b_clks))	{
					delete_banner($dis_id[$tak]);
				}
				elseif($bann->b_dur=="I" and ($bann->b_noi<=$bann->b_see))	{
					delete_banner($dis_id[$tak]);
				}
			echo $dis[$tak];
			for($i=0; $i<=$ip_co; $i++)	{
					mysql_query("update banners set b_see=b_see+1 where b_id='$dis_id[$tak]'");
			}
		}
	}
}
function f_banners()	{
global $cookie_url,$main_url;

	$sql="select * from banners where b_blk='N' and b_typ='F' and b_exp='N'";
	$res=mysql_query($sql);
	$dis=array();
	$dis_id=array();
	$num=mysql_num_rows($res);
	if(mysql_num_rows($res))	{
		while($row=mysql_fetch_object($res))	{
			$tmp=explode(".",$row->b_img);
			$tmp_count=count($tmp);
			$ext=strtolower($tmp[$tmp_count-1]);
			if($ext=="swf")	{
				$img_s="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='720' height='60'>
  						<param name='movie' value='".$main_url."/".$row->b_img."'>
						<param name='quality' value='high'>
						<param name='wmode' value='opaque'>
						<param name='loop' value='false'>
						<embed src='".$main_url."/".$row->b_img."' loop='false' wmode='opaque' quality='high' swLiveConnect='false' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='720' height='60'></embed></object>";
			}	else	$img_s="<img src='".$main_url."/".$row->b_img."' border='0' width='720' height='60' alt='".stripslashes($row->b_desc)."' ismap>";
			$dis[]="<A href='".$main_url."/banners/index.php?url=".$row->b_url."&seid=".$row->b_id."&sess=set' target='_blank'>".$img_s."</a>";
			$dis_id[]=$row->b_id;
		}
		$tak=rand(0,$num);
		$sql_query="select * from banners where b_id='$dis_id[$tak]'";
		$num=sql_execute($sql_query,'num');
		if($num!=0)	{
			$bann=sql_execute($sql_query,'get');
				$d_f=date("d",$bann->b_f_day);
				$m_f=date("m",$bann->b_f_day);
				$y_f=date("Y",$bann->b_f_day);
				$d_t=date("d",$bann->b_t_day);
				$m_t=date("m",$bann->b_t_day);
				$y_t=date("Y",$bann->b_t_day);
//				$f_day=mktime(0,0,0,$m_f,$d_f,$y_f);
//				$t_day=mktime(0,0,0,$m_t,$d_t,$y_t);
//				$today=mktime(0,0,0,date("m"),date("d"),date("Y"));
				$f_day=mktime(0,0,0,$m_f,$d_f,$y_f);
				$t_day=mktime(0,0,0,$m_t,$d_t,$y_t);
				$today=mktime(0,0,0,date("m"),date("d"),date("Y"));
				if(($bann->b_dur=="D") and ($today>$t_day))	{
					delete_banner($dis_id[$tak]);
				}
				elseif($bann->b_dur=="C" and ($bann->b_ncl<=$bann->b_clks))	{
					delete_banner($dis_id[$tak]);
				}
				elseif($bann->b_dur=="I" and ($bann->b_noi<=$bann->b_see))	{
					delete_banner($dis_id[$tak]);
				}
			echo $dis[$tak];
			for($i=0; $i<=$ip_co; $i++)	{
				mysql_query("update banners set b_see=b_see+1 where b_id='$dis_id[$tak]'");
			}
		}
	}
}

function mailing($to,$name,$from,$subj,$body) {
global $SERVER_NAME,$admin_mail;
$subj=nl2br($subj);
$body=nl2br($body);
$recipient = $to;
$headers = "From: $name <$from>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Return-Path: <$admin_mail>\n";
$headers .= "Content-Type: text/html;\n";
$headers .= "X-Mailer: PHP/" . phpversion();
ini_set("sendmail_from", $from);
mail("$recipient","$subj","$body","$headers");
}

function form_get($value){
	global $HTTP_POST_VARS,$HTTP_GET_VARS,$_SERVER;
	$REQUEST_METHOD=$_SERVER["REQUEST_METHOD"];
	if($REQUEST_METHOD=='POST')
		$get_value=$HTTP_POST_VARS["$value"];
	elseif($REQUEST_METHOD=='GET')
		$get_value=$HTTP_GET_VARS["$value"];
	return addslashes_deep($get_value);
}
function addslashes_deep($value) {
   $value = is_array($value) ?
               array_map('addslashes_deep', $value) :
               addslashes($value);
   return $value;
}


function cookie_get($name){
global $HTTP_COOKIE_VARS;
return $HTTP_COOKIE_VARS[$name];
}

//require file, depending on mode
function check($mode){
	global $cookie_url,$main_url;
	$modules=array("article","blog_url","blogs","calendar","chkuser","events","forums","help","im","iml","imv","join","listing","login","main","messages","paypal","paystat","people_card","photo_album","privacy","profile","rank","recent_view","search","terms","tour","tribe","update_paypal","user","forgot","tacs");

	if(isset($mode))
		if(in_array($mode,$modules))
	    	$document=$mode.".php";
		else
			$document="main.php";
	else
		$document="main.php";
	require("$document");
}

//require admin file, depending on mode
function ad_check($mode){
  if(isset($mode)){
    $document=$mode.".php";
  }
  else{
  	$document="main.php";
  }
  require("admin/$document");
}
//require calendar file, depending on mode
function cal_check($mode){
  if(isset($mode)){
    $document=$mode.".php";
  }
  else{
  	$document="calendar.php";
  }
  require("calendar/$document");
}

//printing java code for listing categories
function listing_cats_java($mod){
$sql_query="select * from categories";
$res=sql_execute($sql_query,'res');
while($cat=mysql_fetch_object($res)){
if($mod==1){
echo ";
 listCategory.setDefaultOption('$cat->cat_id','$cat->cat_id');
 listCategory.addOptions('$cat->cat_id','Select Subcategory','$cat->cat_id'";
}
elseif($mod==2){
$nex=$cat->cat_id+1;
echo "
listmessage_categoryId.setDefaultOption('$cat->cat_id','$nex');
listmessage_categoryId.addOptions('$cat->cat_id'";
}
   $sql_query="select * from sub_categories where cat_id='$cat->cat_id'";
   $res2=sql_execute($sql_query,'res');
   while($sub=mysql_fetch_object($res2)){
      echo ",'$sub->name','$sub->sub_cat_id'";
   }//while
   echo ");";
}//while

}//function

// Returnds the curent page number on a multipage display
function getpage(){
  	if(!isset($_GET['page'])) $page=1;
  	else $page=$_GET['page'];
    return $page;
}
function getpages(){
  	if(!isset($_GET['page'])) $page=1;
  	else $page=$_GET['page'];
    return $page;
}

//Displays the page numbers
function show_page_nos($sql,$url,$lines,$page){
    $tmp	=explode("LIMIT",$sql);
    if(count($tmp)<1) $tmp	=explode("limit",$sql);
  	$pgsql	=$tmp[0];
    include 'show_pagenos.php';
}
//Formats The Date
function format_date($date,$time=0){
    $tmp	=explode(" ",$date);
	$date2	=explode("-",$tmp[0]);
	$date	=$date2[1]."-".$date2[2]."-".$date2[0];
	if($time) return $date." ".$tmp[1];
	else return $date;
}

//just printing listing cats list
function listing_cats($sel){
$sql_query="select * from categories";
$res=sql_execute($sql_query,'res');
while($cat=mysql_fetch_object($res)){
    if($cat->cat_id=="$sel"){
    echo "<option selected value='$cat->cat_id'>$cat->name";
    }
    else{
    echo "<option value='$cat->cat_id'>$cat->name";
    }

}//while
}//function
//just printing events cats list
function events_cats($sel){
$sql_query="select * from event_cat";
$res=sql_execute($sql_query,'res');
while($cat=mysql_fetch_object($res)){
    if($cat->cat_id=="$sel"){
    echo "<option selected value='$cat->event_id'>".stripslashes($cat->event_nam)."</option>";
    }
    else{
    echo "<option value='$cat->event_id'>".stripslashes($cat->event_nam)."</option>";
    }

}//while
}//function

//admin header
function show_ad_header($adsess){
$mode=form_get("mod

error 2 and 3 are occurring because you haven't initiated a MySQL connection.

define your $conn_id

ex:

<?php
$db_name="rps";
$db_url="localhost";
$db_username="root";
$db_password="rps";
$connection = mysql_connect($db_url,$db_username,$db_password);

This question has already been answered. Start a new discussion instead.