Hello,
I'm a complete beginner and I have a database that I'm getting information from.
How can I subtract one from a string?
This code doesn't work:
<?php
$con = mysqli_connect('localhost', 'sjfrost', 'password', 'sjfrost_test14') or die('Error connecting to the MySQL server.');
$query = ' SELECT id FROM home ORDER BY id DESC LIMIT 0 , 1 ';
$result = mysqli_query($con, $query) or die('Error getting the database information.');
$row = mysqli_fetch_array($result);
$news1 = $row
$news2 = (int) $news1 - 1;
$news3 = (int) $news2 - 1;
?>
When I run that code, the first news query result is displayed (id 4 in my database) but news2 goes to ID 1 in my database.
Thanks for any help in advance,
Steve