When you grab a row from a loop with php, the rows come back at you with strings. However, using the (int) cast is a method to convert the number string into an integer. For example, say you wanted to add an integer into a json function or use it for mathematical purposes. You simple add the (int) in front of the number string to make it an integer.
Read below for details.
$command = "SELECT * FROM tablename "; $result = mysqli_query($db, $command); while ($row = mysqli_fetch_assoc($result)) { $myid = row['id']; // this is a string if the column is varchar $id = (int)$myid; $id2 = (int)trim($myid); }
© 2018 ALL Rights Reserved | Sitemap
Vancouver | North Vancouver | Burnaby | Richmond | Coquitlam | Port Coquitlam | Surrey | Langley | Maple Ridge | Mission | Abbotsford | Kamloops | Kelowna | Victoria | Squamish | Whistler | Pemberton