Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6846391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:36:58+00:00 2026-05-27T00:36:58+00:00

I have a code where it should check if the result equals to 8

  • 0

I have a code where it should check if the result equals to 8 it need to show something and if not it need to show something else and all of that happens inside of a while loop.

while ($row_fpages2 = mysql_fetch_array($result_fanpage2))
{
    if ( $row_fpages2['client'] != NULL ) {

        //GRAPHS
    $sql = "SELECT likes, date FROM statistics_pages WHERE idnum = '".$idnum."' AND page_name = '".$row_fpages2['page_name']."' ORDER BY `statistics_pages`.`date` DESC LIMIT 8";
    $result2 = mysql_query($sql) or die(mysql_error());

    if ($result2) {
        $data   = array();

        while ($row = mysql_fetch_assoc($result2)) {
            $data[]   = $row["likes"];
        }

    if ($result2 == 8) {
    $c_data = count($data)-1;
    $final = array();
    for ($i = 0; $i < $c_data; $i++) {
    $final[] = getZeroResult($data[$i], $data[$i+1]);
}
    $data_string = join(",", $final);

    $stats = '<img src="http://chart.apis.google.com/chart?chs=240x140&cht=ls&chd=t:0,0|'.$data_string.'&chg=20,20&chls=0.75,-1,-1|6,4,1&chm=o,FF9900,1,-1,7,-1|b,3399CC44,0,1,0"></img>';

    } else {
        $stats = '<img src="images/stats_un.jpg"></img>';
    };



    } else {
        print('MySQL query failed with error: ' . mysql_error());
    }

echo '...';

The problem is that the first output always showing the ( == 8) (even if it is not equals to 8) instead of the else output.

Then if i have 2 or more everything comes above the first one is correct but the first one is still showing the ( == 8).

Any help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:36:59+00:00Added an answer on May 27, 2026 at 12:36 am

    You do the following which is incorrect:

    $result2 = mysql_query($sql) or die(mysql_error());
    ...
    if ($result2 == 8) {
    

    The return value of mysql_query is a resource not an int. What is that you are trying to do there ?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I frequently have some code that should be run either on a schedule or
I have a small code block that should append text to the beg of
So far I have managed to write some code that should print the source
I have this code <?php session_start(); if (isset($_GET[cmd])) $cmd = $_GET[cmd]; else die(You should
I have the following code that seems like it should set my insertParameter but
I have an iPhone application that is supposed to show images inside a UIScrollView.
I have this code which should create a splash image with either no animation
I have the following code which should put programs startable in Bash. if [
I have some validation code which should display the max / min of a
This should be straight forward for a guru. I don't have any code really

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.