Update Mysql table
This will update data in a MySQL table whether is empty or not.
UPDATE artists SET city = ‘Los Angeles’ WHERE city=’Sydney’
In this case Sydney will be replaced by Los Angeles.
… Read moreThis will update data in a MySQL table whether is empty or not.
UPDATE artists SET city = ‘Los Angeles’ WHERE city=’Sydney’
In this case Sydney will be replaced by Los Angeles.
… Read moreIn web design sometimes it’s neccesary to keep things short, so large numbers have to be trimmed for display. The following simple code will format any number > to 1000 to its 1K version and will limit decimals to 2 digits.
$shares = $this->page->shares;
$shares2 = $shares / 1000;
if ($shares < 1000) {
echo ‘$shares’;
}
else {
echo number_format($shares2, 2);
echo ‘k’;
}
With this simple code, a number preserves its format if it’s lower than 1000 (i.e.…
Read moreIf you want to show some divs instead of others on a website IF some condition is met you can use the following piece of code:
php if ($artist_id == “1980”) { ?>
php } else { ?>
<? } ?>
The data and the whole layout can be different, as in this case, but it doesn’t have to.…
Read more