Jump to content

[HELP] Warning: mysql_fetch_array


Warren_Ceo

Recommended Posts

Hi out there,

So I get this warrning:

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\functions\config.php on line 586

Here is rest of code:

<?php
include($_SERVER['DOCUMENT_ROOT'] . '/forum/conf_global.php'); // norādam pareizu foruma mapi
# Pieslēgšanās datubāzei, savadam datus, definīcijas
$forum = $INFO['board_url']; // foruma adrese
$url = "localhost"; // sākumlapa
$page_title = "Evoross.com"; //lapas nosaukums
$defavatar = $forum."/public/style_images/master/profile/default_large.png"; // def usera avatars
$defmapimg = $url."design/img/noimage.jpg"; // def kartes bilde monitoram

# definicijas - neko nemainam
define("prefx", $INFO['sql_tbl_prefix']);  // prefix
define("url", $url); // sakumlapa
define("forum", $forum); //forums
define("defavatar", $defavatar); //def avatars

# Cik daudz kas jāizvelk
$skaits = "5"; //foruma jaunumu skaits
$news_c = "3"; // jaunumu skaits sākumlapā - 1 lapā
$users_c = "30"; // lietotāju skaits lietotāju sadaļā - 1 lapā
define("comment_c", "5");  // komentāru skaits lietotāju sadaļā - 1 lapā
$multimedia_c = "10"; // video/galeriju skaits - 1 lapā
# Kļūdu ziņošana
error_reporting(E_ALL);
# Pieslēdzamies
$connect = mysql_connect($INFO['sql_host'], $INFO['sql_user'], $INFO['sql_pass']) or die('Can\'t create connection: '.mysql_error());
mysql_select_db($INFO['sql_database'], $connect) or die('Can\'t access specified db: '.mysql_error());
# Funkcijas
	function mininfo($msg, $color){
	if($color == "green"){echo "<div class='info-g'>".$msg."</div>";}
	elseif($color == "blue"){echo "<div class='info-b'>".$msg."</div>";}
	else{echo "<div class='info-r'>".$msg."</div>";}
	}
	
	function id_exists($id, $tbl, $colon) {
      $result = mysql_query("SELECT COUNT(*) FROM ".$tbl." WHERE `".$colon."` = '".(int) $id."' ");
      list($count) = mysql_fetch_row($result);
	  if($count > 0){return true;}else{return false;}
	  }
	function page_exists($page, $pages) {
	  if($page > $pages){
	  return false;
	  }else{
	  return true;
	  }
	  }
	function date_lv($date) {
    $en = array('/May/', '/Jun/', '/Jul/', '/October/', '/Monday/', '/Tuesday/', '/Wednesday/', '/Thursday/', '/Friday/', '/Saturday/', '/Sunday/', '/January/', '/February/', '/March/', '/April/', '/May/', '/June/', '/July/', '/August/', '/September/', '/October/', '/November/', '/December/');
    $lv = array('Mai', 'Jun', 'Jul', 'Okt', 'Pirmdiena', 'Otrdiena', 'Trešdiena', 'Ceturtdiena', 'Piektdiena', 'Sestdiena', 'Svētdiena', 'Janvāris', 'Februāris', 'Marts', 'Aprīlis', 'Maijs', 'Jūnijs', 'Jūlijs', 'Augusts', 'Septembris', 'Oktobris', 'Novembris', 'Decembris');
    $date = preg_replace($en, $lv, $date);
    return $date;
}

// pārbauda vai lietotājs ir ielogojies
function login(){
	if(isset($_COOKIE['member_id']) && isset($_COOKIE['pass_hash'])){
	$user = mysql_real_escape_string((int)$_COOKIE['member_id']);
	$pw = mysql_real_escape_string($_COOKIE['pass_hash']);
    $res = mysql_query("SELECT member_login_key FROM ".prefx."members WHERE member_login_key='$pw' AND member_id='$user' LIMIT 1");
    if(mysql_num_rows($res)==1){
		return true;
		}else{
		return false;
		}

	}
}

// Pārbauda vai lietotājs ir admins
function admin(){
	if(login()){
	$mid = mysql_real_escape_string($_COOKIE['member_id']);
	$qwery = mysql_query("SELECT member_group_id FROM ".prefx."members WHERE member_id = '$mid' AND member_group_id = '4'") or die(mysql_error());
    if(mysql_num_rows($qwery)==1){
		return true;
		}else{
		return false;
		}
	}
}
// Pārbauda vai lietotājs ir moderators
function moderator(){
	if(login()){
	$mid = mysql_real_escape_string($_COOKIE['member_id']);
	$qwery = mysql_query("SELECT member_group_id FROM ".prefx."members WHERE member_id = '$mid' AND member_group_id = '6'") or die(mysql_error());
    if(mysql_num_rows($qwery)==1){
		return true;
		}else{
		return false;
		}
	}
}
// pārbauda vai lietotājs nav guests, validating vai banned
function is_user(){
	if(login()){
	$mid = mysql_real_escape_string($_COOKIE['member_id']);
	$qwery = mysql_query("SELECT member_group_id FROM ".prefx."members WHERE member_id = '$mid' AND member_group_id != '1' AND member_group_id != '5' AND member_group_id != '2'") or die(mysql_error());
    if(mysql_num_rows($qwery)==1){
		return true;
		}else{
		return false;
		}
	}
}
// Uzzinam pašreizējo lapu
function curPageURL() {
 $pageURL = 'http';
 if (!empty($_SERVER['HTTPS'])) {$pageURL .= "s";}  
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}
$current_url = str_replace("www.", "", curPageURL());
function activity_update(){
	if(login()){
	$user_time = time();
	$id = mysql_real_escape_string($_COOKIE['member_id']);
	mysql_query("UPDATE ".prefx."members SET last_activity = '$user_time' WHERE member_id = '$id'") or die(mysql_error());
}
}
function user_activity_update($page, $pageid, $activity){
	$id = mysql_real_escape_string($_COOKIE['member_id']);
	$date = TIME();
	mysql_query("INSERT INTO activities (activity, user, page, page_id, date) VALUES ('$activity', '$id', '$page', '$pageid', '$date')");
}
// atjauninam lietotāju lokāciju
function location_update($place, $placeid=0, $type = 0){
  if(login()){
	$id = mysql_real_escape_string($_COOKIE['member_id']);
	mysql_query("UPDATE ".prefx."sessions SET `current_section` = '".$place."', `location_1_type` = '".$type."', `location_1_id` = '".$placeid."' WHERE `member_id` = '".$id."'")or die(mysql_error());
  }
}
	function dbcount($field,$table,$conditions="") {
	$cond = ($conditions ? " WHERE ".$conditions : "");
	$result = @mysql_query("SELECT Count".$field." FROM ".$table.$cond);
	if (!$result) {
		echo mysql_error();
		return false;
	} else {
		$rows = mysql_result($result, 0);
		return $rows;
	}
}
// lapu izvēlne/pagination
function pager($rpp, $count, $href) {
	$pages = ceil($count / $rpp); // Skaita cik kopaa lapas
	if (isset($_GET["page"])) {
		$page = (int)$_GET["page"] - 1;
		if ($page < 0)
			$page = 0;
	}
		else
			$page = 0;
			$pager = "";
			$mp = $pages - 1;
			$as = "«";
		if ($page >= 1) {
			$pager .= "<a href=\"{$href}" . ($page ) . "\" >".$as."</a>";
		}else{
			$pager .= "<span class=\"disabled\">".$as."</span>";
		}
	$as = "»";
	if ($page < $mp && $mp >= 0) {
		$pager2 = "<a href=\"{$href}" . ($page + 2) . "\">".$as."</a>";
	}
	else	 
		$pager2 = "<span class=\"disabled\">".$as."</span>";
	if ($count) {
		$pagerarr = array();
		$dotted = 0;
		$dotspace = 2;
		$dotend = $pages+1 - $dotspace;
		$curdotend = $page +1 - $dotspace;
		$curdotstart = $page +2 + $dotspace ;
		for ($i = 1; $i <= $pages; $i++) {
			if (($i >= $dotspace && $i <= $curdotend) || ($i >= $curdotstart && $i < $dotend)) {
				if (!$dotted)
				   $pagerarr[] = "<span class='disabled'>..</span>";
				$dotted = 1;
				continue;
			}
			$dotted = 0;
			$start = $i * $rpp;
			$end = $start + $rpp - 1;
			if ($end > $count)
				$end = $count;
        $href2 = $href. $i;
			 $text = $i;
			if ($i != $page +1)
				$pagerarr[] = "<a href=\"{$href2}\">".$text."</a>";
			else
				$pagerarr[] = "<span class=\"current\">".$text."</span>";

				  }

		$pagerstr = join("", $pagerarr);
		$pagertop = "<div id=\"pages\">$pager$pagerstr$pager2</div>\n";
		$pagerbottom = "<div id=\"pages\">$pager$pagerstr$pager2</div>\n";
	}
	
	else {
	if($count >= "1"){
		$pagertop = "<div id=\"pages\">$pager$pagerstr$pager2</div>\n";
		$pagerbottom = "<div id=\"pages\">$pager$pagerstr$pager2</div>\n";
	}
	}

	$start = $page * $rpp;
	if($count >= "1"){
	return array($pagertop, $pagerbottom, "LIMIT $start,$rpp");
	}
	
}

function linkify($text) {
    $url_pattern = '/# Rev:20100913_0900 github.com\/jmrware\/LinkifyURL
    # Match http & ftp URL that is not already linkified.
      # Alternative 1: URL delimited by (parentheses).
      (\()                     # $1  "(" start delimiter.
      ((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]+)  # $2: URL.
      (\))                     # $3: ")" end delimiter.
    | # Alternative 2: URL delimited by [square brackets].
      (\[)                     # $4: "[" start delimiter.
      ((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]+)  # $5: URL.
      (\])                     # $6: "]" end delimiter.
    | # Alternative 3: URL delimited by {curly braces}.
      (\{)                     # $7: "{" start delimiter.
      ((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]+)  # $8: URL.
      (\})                     # $9: "}" end delimiter.
    | # Alternative 4: URL delimited by <angle brackets>.
      (<|&(?:lt|\#60|\#x3c)  # $10: "<" start delimiter (or HTML entity).
      ((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]+)  # $11: URL.
      (>|&(?:gt|\#62|\#x3e)  # $12: ">" end delimiter (or HTML entity).
    | # Alternative 5: URL not delimited by (), [], {} or <>.
      (                        # $13: Prefix proving URL not already linked.
        (?: ^                  # Can be a beginning of line or string, or
        | [^=\s\'"\]]          # a non-"=", non-quote, non-"]", followed by
        ) \s*[\'"]?            # optional whitespace and optional quote;
      | [^=\s]\s+              # or... a non-equals sign followed by whitespace.
      )                        # End $13. Non-prelinkified-proof prefix.
      ( \b                     # $14: Other non-delimited URL.
        (?:ht|f)tps?:\/\/      # Required literal http, https, ftp or ftps prefix.
        [a-z0-9\-._~!$\'()*+,;=:\/?#[\]@%]+ # All URI chars except "&" (normal*).
        (?:                    # Either on a "&" or at the end of URI.
          (?!                  # Allow a "&" char only if not start of an...
            &(?:gt|\#0*62|\#x0*3e);                  # HTML ">" entity, or
          | &(?:amp|apos|quot|\#0*3[49]|\#x0*2[27]); # a [&\'"] entity if
            [.!&\',:?;]?        # followed by optional punctuation then
            (?:[^a-z0-9\-._~!$&\'()*+,;=:\/?#[\]@%]|$)  # a non-URI char or EOS.
          ) &                  # If neg-assertion true, match "&" (special).
          [a-z0-9\-._~!$\'()*+,;=:\/?#[\]@%]* # More non-& URI chars (normal*).
        )*                     # Unroll-the-loop (special normal*)*.
        [a-z0-9\-_~$()*+=\/#[\]@%]  # Last char can\'t be [.!&\',;:?]
      )                        # End $14. Other non-delimited URL.
    /imx';
    $url_replace = '$1$4$7$10$13<a href="$2$5$8$11$14">$2$5$8$11$14</a>$3$6$9$12';
    return preg_replace($url_pattern, $url_replace, $text);
}

function update_views($id, $views, $tbl){
mysql_query("UPDATE `".$tbl."` SET `views` = '$views' WHERE `id` = '$id'");
}
function seo($string) {
        //Unwanted:  {UPPERCASE} ; / ? : @ & = + $ , . ! ~ * ' ( )
        $string = strtolower($string);
        //Strip any unwanted characters
        $string = preg_replace("/[^a-z0-9_\s-]/", "", $string);
        //Clean multiple dashes or whitespaces
        $string = preg_replace("/[\s-]+/", " ", $string);
        //Convert whitespaces and underscore to dash
        $string = preg_replace("/[\s_]/", "-", $string);
        return $string;
}
// pirms x laika
function time_stamp($pievienots)
{
$time_difference = time() - $pievienots ;

$seconds = $time_difference ;
$minutes = round($time_difference / 60 );
$hours = round($time_difference / 3600 );
$days = round($time_difference / 86400 );
$weeks = round($time_difference / 604800 );
$months = round($time_difference / 2419200 );
$years = round($time_difference / 29030400 );
if($seconds <= 10)
{
echo "tik tikko";
}
// Seconds
elseif($seconds <= 60)
{
echo "pirms $seconds sekundēm";
}
//Minutes
elseif($minutes <=60)
{

   if($minutes==1)
  {
   echo "pirms 1 minūtes";
   }
   else
   {
    echo "pirms $minutes minūtēm";
   }

}
//Hours
elseif($hours <=24)
{

   if($hours==1)
  {
   echo "pirms 1 stundas";
  }
  else
  {
   echo "pirms $hours stundām";
  }

}
//Days
elseif($days <= 7)
{

  if($days==1)
  {
   echo "pirms 1 dienas";
  }
  else
  {
   echo "pirms $days dienām";
   }

}
//Weeks
elseif($weeks <= 4)
{

   if($weeks==1)
  {
   echo "pirms aptuveni nedēļas";
   }
  else
  {
   echo "pirms $weeks nedēļām";
  }

}
//Months
elseif($months <=12)
{

   if($months==1)
  {
   echo "pirms aptuveni mēneša";
   }
  else
  {
   echo "pirms $months mēnešiem";
   }

}
//Years
else
{

   if($years==1)
   {
    echo "pirms gada";
   }
   else
  {
    echo "pirms $years gadiem";
   }

}
}
// iegūstam lietotāja lokāciju, neiesaku veikt labojumus bez labas saprašanas
function location_get($location_1_type, $location_1_id, $location_2_type, $location_2_id, $location_3_type, $location_3_id, $current_appcomponent, $current_module, $current_section){
		
		if(empty($location_1_type) AND empty($location_1_id) AND $current_section == "home"){
			return "Skatas <a href='".url."'>sākumlapu</a>";		

		}elseif(empty($location_1_type) AND !empty($location_1_id) AND $current_section == "news"){
			return "Lasa <a href='/news/".$location_1_id."'>jaunumus</a>";

		}elseif(empty($location_1_type) AND !empty($location_1_id) AND $current_section == "video"){
			return "Skatās <a href='".url."video/".$location_1_id."'>video</a>";
			
		}elseif(empty($location_1_type) AND empty($location_1_id) AND $current_section == "videos"){
			return "Skatās <a href='".url."videos'>videoklipus</a>";

		}elseif(empty($location_1_type) AND empty($location_1_id) AND $current_section == "videoa"){
			return "Pievieno <a href='/add/video'>video</a>";
			
		}elseif(empty($location_1_type) AND !empty($location_1_id) AND $current_section == "photo"){
			return "Skatās <a href='".url."photos/".$location_1_id."'>bildi</a>";
			
		}elseif(empty($location_1_type) AND empty($location_1_id) AND $current_section == "photos"){
			return "Skatās <a href='".url."photos'>bildes</a>";
			
		}elseif(empty($location_1_type) AND empty($location_1_id) AND $current_section == "photoa"){
			return "Pievieno <a href='".url."add/photo'>bildi</a>";
			
		}elseif(empty($location_1_type) AND empty($location_1_id) AND $current_section == "shop"){
			return "Izmanto SMS shop";
			
		}elseif(empty($location_1_type) AND empty($location_1_id) AND $current_section == "bans"){
			return "Pēta banu sarakstu";
			
		}elseif(empty($location_1_type) AND empty($location_1_id) AND $current_section == "members"){
			return "Pēta lietotāju sarakstu";
			
		}elseif(empty($location_1_type) AND empty($location_1_id) AND $current_section == "stats"){
			return "Pēta statistiku";
			
		}elseif(empty($location_1_type) AND empty($location_1_id) AND $current_section == "about"){
			return "Lasa <a href='".url."about/'><i>Par Mums</i></a>";
			
		}elseif($location_1_type == "profile" AND !empty($location_1_id) AND $current_appcomponent == "members" AND $current_module == "profile" AND $current_section == "view"){
			return "Pēta kādu lietotāju";
		
		}elseif($current_appcomponent == "members" AND $current_module == "messaging" AND $current_section == "send"){
			return "Raksta vēstuli";
			
		}elseif($location_1_type == "topic" AND $location_1_id == "0" AND $location_2_type == "forum" AND !empty($location_2_id) AND $current_appcomponent == "forums" AND $current_module == "post" AND $current_section == "post"){
			return "Raksta jaunu topiku";
			
		}elseif($location_1_type == "topic" AND !empty($location_1_id) AND $location_2_type == "forum" AND !empty($location_2_id) AND $current_appcomponent == "forums" AND $current_module == "post" AND $current_section == "post"){
			return "Raksta atbildi topikā";
			
		}elseif($location_1_type == "topic" AND !empty($location_1_id) AND $location_2_type == "forum" AND !empty($location_2_id) AND $current_appcomponent == "forums" AND $current_module == "forums" AND $current_section == "topics"){
			return "Lasa topiku";
			
		}elseif(empty($location_1_type) AND $location_1_id == "0" AND $current_appcomponent == "members" AND $current_module == "list"){
			return "Pēta lietotāju sarakstu";
			
		}elseif($current_appcomponent == "core" AND $current_module == "usercp"){
			return "Labo profilu";
			
		}elseif($current_appcomponent == "members" AND $current_module == "messaging"){
			return "Lasa vēstules";
			
		}elseif($current_appcomponent == "core" AND $current_module == "search"){
			return "Kaut ko meklē";
			
		}elseif($current_appcomponent == "forums"){
			return "Čillo forumā";
			
		}else{
			return "Nedara neko";
		}
	}
function showsmiles(){
echo '
	<div id="emoticons">
	<a href="javascript:;" type=":)" title=":)" class="tooltip2"><img src="/design/img/smilies/smile.png" alt=":)" /></a>
	<a href="javascript:;" type=";)" title=";)" class="tooltip2"><img src="/design/img/smilies/wink.png" alt=";)" /></a>
	<a href="javascript:;" type=":P" title=":P" class="tooltip2"><img src="/design/img/smilies/tongue.png" alt=":P" /></a>
	<a href="javascript:;" type=":D" title=":D" class="tooltip2"><img src="/design/img/smilies/biggrin.png" alt=":D" /></a>
	<a href="javascript:;" type=";D" title=";D" class="tooltip2"><img src="/design/img/smilies/laugh.png" alt=";D" /></a>
	<a href="javascript:;" type=":(" title=":(" class="tooltip2"><img src="/design/img/smilies/sad.png" alt=":(" /></a>
	<a href="javascript:;" type=":angry:" title=":angry:" class="tooltip2"><img src="/design/img/smilies/angry.png" alt=":angry:" /></a>
	<a href="javascript:;" type=":mellow:" title=":mellow:" class="tooltip2"><img src="/design/img/smilies/mellow.png" alt=":mellow:" /></a>
	<a href="javascript:;" type=":huh:" title=":huh:" class="tooltip2"><img src="/design/img/smilies/huh.png" alt=":huh:" /></a>
	<a href="javascript:;" type="^_^" title="^_^" class="tooltip2"><img src="/design/img/smilies/happy.png" alt="^_^" /></a>
	<a href="javascript:;" type=":o" title=":o" class="tooltip2"><img src="/design/img/smilies/ohmy.png" alt=":o" /></a>
	<a href="javascript:;" type="B)" title="B)" class="tooltip2"><img src="/design/img/smilies/cool.png" alt="B)" /></a>
	<a href="javascript:;" type="<_<" title="<_<" class="tooltip2"><img src="/design/img/smilies/dry.png" alt="<_<" /></a>
	<a href="javascript:;" type=":wub:" title=":wub:" class="tooltip2"><img src="/design/img/smilies/wub.png" alt=":wub:" /></a>
	<a href="javascript:;" type=":blink:" title=":blink:" class="tooltip2"><img src="/design/img/smilies/blink.png"  /></a>
	</div>
';
}
function smilies($txt){
$smilies = array(
    ":)" => "smile",
    ";D"=>"laugh",
	":D"=>"biggrin",
    ":("=>"sad",
    ";("=>"cry",
    ":@"=>"angry",
    ":blink:"=>"blink",
    ":o"=>"ohmy",
    "(yawn)"=>"-o-",
    "(woot)"=>"woot",
    ";)"=>"wink",
    ":P"=>"tongue",
    "(blush)"=>"blush",
    ":wub:"=>"wub",
	":angry:"=>"angry",
	":mellow:"=>"mellow",
	":huh:"=>"huh",
	"^_^"=>"happy",
	"B)"=>"cool",
	"<_<"=>"dry",

);
	foreach($smilies as $smil => $img){
	$txt = str_ireplace($smil,'<img src="/design/img/smilies/'.$img.'.png" alt="'.$smil.'" style="margin-bottom:-9px;width:18px;height:23px;float:none;border:0;" />',$txt);
	}
	return $txt;
}

### BB Kodi bez smaidiņiem izmantot - simple_bbcode($text)
function simple_bbcode($txt){
$txt = strip_tags($txt);
$txt = nl2br($txt);
$txt = linkify($txt);
$bbcodes = array(
   '/\[right\](.*?)\[\/right\]/is',
   '/\[left\](.*?)\[\/left\]/is',
   '/\[center\](.*?)\[\/center\]/is',
   '/\[b\](.*?)\[\/b]/is',
   '/\[i\](.*?)\[\/i]/is',
   '/\[u\](.*?)\[\/u]/is',
   '/\[s\](.*?)\[\/s]/is',
   '/\[url\](.*?)\[\/url]/is',
   '/\[color=(.*?)\](.*?)\[\/color]/is',
   '/\[url=(.*?)\](.*?)\[\/url]/is',
   '/\[size=(.*?)\](.*?)\[\/size]/is',
   '/\[font=(.*?)\](.*?)\[\/font]/is',
   '/\[img\](.*?)\[\/img]/is',
	'/\[code\](.*?)\[\/code\]/is',
	'/\[quote\](.*?)\[\/quote\]/is',
   '/\[br\]/is'
);
$html = array(
   '<p style="text-align:right;">$1</p>',
   '<p style="text-align:left;">$1</p>',
   '<center>$1</center>',
   '<b>$1</b>',
   '<i>$1</i>',
   '<u>$1</u>',
   '<s>$1</s>',
   '<a href="$1">$1</a>',
   '<font color="$1">$2</font>',
   '<a href="$1" title="$1" style="color:#0099ff;">$2</a>',
   '<span style="font-size:$1px">$2</span>',
   '<span style="font-family:$1;">$2</span>',
   '<img alt="$1" src="$1" />',
	'<code>$1</code>',
	'<blockquote>$1</blockquote>',
   '<br />'
);

return preg_replace($bbcodes,$html,$txt);
	return str_replace("\n", "<br />", $txt);
}

// bbkodi ar smaidiņiem - izmantot bbcode($txt)
function bbcode($txt){
	return smilies(simple_bbcode($txt));
}
// iegūstam lietotāja lokāciju, neiesaku veikt labojumus bez labas saprašanas
function activity_get($user, $activity, $page, $page_id){
$query = mysql_query("SELECT member_id, members_display_name, members_seo_name FROM ".prefx."members WHERE member_id = ".$user);
$row = mysql_fetch_array($query);
if(strlen($row['members_display_name']) > 12){$users = substr($row['members_display_name'], 0, strrpos(substr($row['members_display_name'], 0, 12), " ")).'..';}else{$users = $row['members_display_name'];}
$users = '<a href="'.forum.'/index.php?showuser='.$row['member_id'].'-'.$row['members_seo_name'].'/">'.$users.'</a>';

		if($page == "videos" AND $activity == "add"){
			return $users." pievienoja jaunu <a href='".url.$page."/".$page_id."'>video</a><br />";	

		}elseif($page == "photos" AND $activity == "add"){
			return $users." pievienoja <a href='".url.$page."/".$page_id."'>bildi</a><br />";	
			
		}elseif($page == "news" AND $activity == "add"){
			return $users." pievienoja jaunus <a href='".url.$page."/".$page_id."'>jaunumus</a><br />";	
			
		}elseif($activity == "comment"){
			return $users." pievienoja jaunu <a href='".url.$page."/".$page_id."'>komentāru</a><br />";		

		}else{
			return $users." aši, aši nofapoja<br />";
		}
	}
$q = mysql_query("SELECT
(SELECT COUNT(*) FROM videos) as videos,
(SELECT COUNT(*) FROM photos) as photos");
$get_count = mysql_fetch_array($q);
?>

Could someone help me get this in right way please!

Kind Regards,

Warren Ceo

Edited by Warren_Ceo
Link to comment
Share on other sites

You aren't specifying a table to select from on your last query:

$q = mysql_query("SELECT
(SELECT COUNT(*) FROM videos) as videos,
(SELECT COUNT(*) FROM photos) as photos");

You need to add a FROM clause after "photos."

 

Use mysql_error() to see your error:

$q = mysql_query("SELECT
(SELECT COUNT(*) FROM videos) as videos,
(SELECT COUNT(*) FROM photos) as photos") or die(mysql_error());
Link to comment
Share on other sites

 

You aren't specifying a table to select from on your last query:

$q = mysql_query("SELECT
(SELECT COUNT(*) FROM videos) as videos,
(SELECT COUNT(*) FROM photos) as photos");

You need to add a FROM clause after "photos."

 

Use mysql_error() to see your error:

$q = mysql_query("SELECT
(SELECT COUNT(*) FROM videos) as videos,
(SELECT COUNT(*) FROM photos) as photos") or die(mysql_error());

 

Now it show's me just this:

Table 'forum.videos' doesn't exist
Link to comment
Share on other sites

These errors are specific to your database structure and we don't know anything about that.

 

"Unknown column" means exactly that; the column name is not recognized in your table's structure. If there IS a field called "eco_points," then you probably have the alias wrong.

 

Can you post your updated query with the changes you have made?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.