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 8306575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:21:34+00:00 2026-06-08T18:21:34+00:00

I have some code that pulls data from a mysql db everything is pulling

  • 0

I have some code that pulls data from a mysql db everything is pulling great, dates, variables, etc. The problem I have is the only integer is returning 0 every time.

while($row = mysqli_fetch_array($result)) {
$fufilled = "1";
$flag = $row['flag'];
$shopnumb = $row['Shopnumb'];
$shoptype = $row['Shop_type'];
...

$shoptype and $shopnumb both return correct content however $flag returns 0 every time even though the database has 1,1,1,1,0 for the 5 rows

CREATE TABLE `Shop_data` (
 `Shopnumb` int(15) NOT NULL AUTO_INCREMENT COMMENT 'shop id number',
 `flag` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1=unread 0=read',
 `CID` int(15) NOT NULL COMMENT 'Client this shop belongs to',
 `SID` varchar(50) DEFAULT NULL COMMENT 'identifys which survey to use',
 `comp_date` date DEFAULT NULL COMMENT 'Completion Date',
 `sched_date` date DEFAULT NULL COMMENT 'Scheduled shop date',
 `shop_comp` smallint(1) NOT NULL DEFAULT '0' COMMENT 'shopper submitted report',
 `edit_comp` smallint(1) NOT NULL DEFAULT '0' COMMENT 'Report has been edited',
 `return_shop` smallint(1) NOT NULL DEFAULT '0' COMMENT 'return report to shopper for editing',
 `report_comp` smallint(1) NOT NULL DEFAULT '0' COMMENT 'report ready for client',
 `Shop_type` varchar(50) DEFAULT NULL,
 `Shoploc` varchar(100) DEFAULT NULL,
 `shop_cost` decimal(10,2) DEFAULT NULL COMMENT 'Normal or adjusted cost of shop',
 `shop_reimb` decimal(10,2) DEFAULT NULL COMMENT 'Shopper reimburstment cost',
 `shop_pay` decimal(10,2) DEFAULT NULL COMMENT 'Total cost',
 `shopper_assign` varchar(200) DEFAULT NULL COMMENT 'Identifys which shopper assigned',
 PRIMARY KEY (`Shopnumb`),
 UNIQUE KEY `Shopnumb` (`Shopnumb`)
) ENGINE=MyISAM AUTO_INCREMENT=2252 DEFAULT CHARSET=latin1

my query

SELECT * FROM Shop_data WHERE CID='".$_SESSION['CID']."' AND report_comp='1' AND DATEDIFF(CURDATE(), comp_date) <".$lengthoftime." ORDER BY comp_date DESC;

like I said everything returns great except flag

if statement

        if ($flag = '0') {
            echo "<td align=\"center\">&nbsp;&nbsp;&nbsp;&nbsp;</td>";
        } else {
            echo "<td align=\"center\">&nbsp;&nbsp;<img align=\"middle\" src=\"/images/flag.png\">&nbsp;&nbsp;</td>";
        }

fixed
if ($flag == ‘0’) {

  • 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-06-08T18:21:35+00:00Added an answer on June 8, 2026 at 6:21 pm

    The statement

    if ($flag = '0') {
    

    is assignment, and will always be TRUE (it evaluates to the value assigned, which is a string). You need:

    if( ! intval($flag)) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php page that pulls data from a mysql database based on
So I have a PHP backend that pulls some data from SQL, let's just
I have written some code that pulls info from a plist file and does
I'm refactoring some code so that my app will pull data from a website
I have a function that pulls data from two locations and places the returned
Assume I have some program that pulls airline data. Each airline data uses a
I have a log in page that pulls information from a data base, I
I have a Google Map that pulls data from Fusion Tables and displays it.
I have some code that will change the background color of a specific label
I have some code that is supposed to return an NSString. Instead it is

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.