# Weird Display

**URL:** <https://www.phphelp.com/t/weird-display/25142>\
**Category:** HTML & CSS\
**Created:** [April 18, 2016, 4:42pm UTC](https://www.phphelp.com/t/weird-display/25142 "2016-04-18T16:42:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![gw32](https://www.phphelp.com/user_avatar/www.phphelp.com/gw32/32/1171_2.png) [@gw32](https://www.phphelp.com/u/gw32)\
**Post date:** [April 18, 2016, 4:42pm UTC](https://www.phphelp.com/t/weird-display/25142/1 "2016-04-18T16:42:07Z")

</div>

I have the following statement in my code:

$satt = ( $att = 0 ) ? ‘No’ : ‘Yes’

$satt

It does not display the correct Yes/No and on the screen I get this = ( 0 = 0 ) ? ‘No’ : ‘Yes’ above my table.

What do I have wrong?

Thanks

---

<div class="post-metadata">

**Author:** ![astonecipher](https://www.phphelp.com/user_avatar/www.phphelp.com/astonecipher/32/2797_2.png) [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Post date:** [April 18, 2016, 5:22pm UTC](https://www.phphelp.com/t/weird-display/25142/2 "2016-04-18T17:22:02Z")

</div>

Post that entire snippet, your abbreviation can have errors that are not in the actual file.

Currently, $satt will always equal ‘No’, because you are assigning a 0 value to $att. I am going to guess that, that statement is in a display variable…

---

<div class="post-metadata">

**Author:** ![gw32](https://www.phphelp.com/user_avatar/www.phphelp.com/gw32/32/1171_2.png) [@gw32](https://www.phphelp.com/u/gw32)\
**Post date:** [April 18, 2016, 5:51pm UTC](https://www.phphelp.com/t/weird-display/25142/3 "2016-04-18T17:51:24Z")

</div>

Code to generate with Yes or No:

```auto
$result = $conn->query("select a.name, b.week from players a, dates b where a.playersid = '$player' and b.dateid = '$date'");

while($row = mysqli_fetch_array($result)) {
    echo "<tr>
        <td align='center'>" . $row['name'] . "</td>
        <td align='center'>" . $row['week'] . "</td>";
    echo "$satt = ( $att = 0 ) ? 'No' : 'Yes'";
    echo "<td align='center'><span>$satt</span></td>";
    echo " <td align='center'>$pts</td>
            <td align='center'>$ $amt</td>
            <td align='center'>$ $high</td>
            <td align='center'>$ $fty</td>
    </tr>";

	}
```

---

<div class="post-metadata">

**Author:** ![astonecipher](https://www.phphelp.com/user_avatar/www.phphelp.com/astonecipher/32/2797_2.png) [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Post date:** [April 18, 2016, 5:58pm UTC](https://www.phphelp.com/t/weird-display/25142/4 "2016-04-18T17:58:04Z")

</div>

Just as I said,

[php] echo “$satt = ( $att = 0 ) ? ‘No’ : ‘Yes’”;  
echo “

$satt”;[/php]

Compared to,  
[php] $satt = $att == 0 ? ‘No’ : ‘Yes’;  
echo “

$satt”;[/php]

This is also a bit easier to read:  
[php]while($row = mysqli\_fetch\_array($result)) {  
$satt = $att == 0 ? ‘No’ : ‘Yes’;  
echo "

  
{$row[‘name’]}  
{$row[‘week’]}  
$satt  
$pts  
$ $amt  
$ $high  
$ $fty  
";  
}[/php]

You should also look into the PHP function money\_format(). It formats numbers to local currency in linux OS’s.

---

<div class="post-metadata">

**Author:** ![JimL](https://www.phphelp.com/user_avatar/www.phphelp.com/jiml/32/1842_2.png) [@JimL](https://www.phphelp.com/u/JimL)\
**Post date:** [April 18, 2016, 5:59pm UTC](https://www.phphelp.com/t/weird-display/25142/5 "2016-04-18T17:59:56Z")

</div>

I recommend not echoing code or markup. If you write it normally then your IDE will syntax highlight it properly and it’s much easier to see mistakes.

[php] $result = $conn-\>query(“select a.name, b.week from players a, dates b where a.playersid = ‘$player’ and b.dateid = ‘$date’”);

while($row = mysqli\_fetch\_array($result)) {  
echo "

  
" . $row[‘name’] . "  
" . $row[‘week’] . “”;  
echo “$satt = ( $att = 0 ) ? ‘No’ : ‘Yes’”; // here you echo the php code as plain text  
echo “$satt”;  
echo " $pts  
$ $amt  
$ $high  
$ $fty  
";

```
}[/php]

```

[php]$result = $conn-\>query(“select a.name, b.week from players a, dates b where a.playersid = ‘$player’ and b.dateid = ‘$date’”);

while($row = mysqli\_fetch\_array($result)): ?\>

 \<?= $row['name'] ?\> \<?= $row['week'] ?\>"; \<?= $att == 0 ? 'No' : 'Yes' ?\> \<?= $pts ?\> \<?= $amt ?\> \<?= $high ?\> \<?= $fty ?\> \<?php endwhile;[/php]

---

<div class="post-metadata">

**Author:** ![astonecipher](https://www.phphelp.com/user_avatar/www.phphelp.com/astonecipher/32/2797_2.png) [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Post date:** [April 18, 2016, 6:02pm UTC](https://www.phphelp.com/t/weird-display/25142/6 "2016-04-18T18:02:21Z")

</div>

I would actually toss it into a model use a template engine to parse it… But I learned the old fashion way before the new way.

---

<div class="post-metadata">

**Author:** ![gw32](https://www.phphelp.com/user_avatar/www.phphelp.com/gw32/32/1171_2.png) [@gw32](https://www.phphelp.com/u/gw32)\
**Post date:** [April 18, 2016, 8:13pm UTC](https://www.phphelp.com/t/weird-display/25142/7 "2016-04-18T20:13:18Z")

</div>

Thank you.

In reference to this;  
“I won’t help if you’re using mysql\_\* functions | You should use PDO | MariaDB | Netbeans IDE | About me.”

Never hears of PDO, MariaDB, About ME.

I just downloaded Komodo IDE and Netbeans IDE.

Don’t like Komodo, going to try Netbeans tomorrow.

Thanks

---

<div class="post-metadata">

**Author:** ![astonecipher](https://www.phphelp.com/user_avatar/www.phphelp.com/astonecipher/32/2797_2.png) [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Post date:** [April 18, 2016, 8:21pm UTC](https://www.phphelp.com/t/weird-display/25142/8 "2016-04-18T20:21:41Z")

</div>

um, that is a signature. That’s it. It shows for every post they make.

---

<div class="post-metadata">

**Author:** ![gw32](https://www.phphelp.com/user_avatar/www.phphelp.com/gw32/32/1171_2.png) [@gw32](https://www.phphelp.com/u/gw32)\
**Post date:** [April 18, 2016, 8:27pm UTC](https://www.phphelp.com/t/weird-display/25142/9 "2016-04-18T20:27:18Z")

</div>

OK, anyway I like Netbeans IDE.

Thanks for the info.
