Uncaught SyntaxError: Unexpected end of input
I have checked all the parenthesis and brackets but seems like nothing is missing.
while ($row = mysqli_fetch_array($query)) {
echo '<div class="columns '.$row['type'].'">';
echo '<div class="image" style="background-image: url(images/'.$row['image_tag'].')"></div>';
echo '<div class="description">';
echo '<p class="productName">'.$row['name'].'</p>';
echo '<p class="productDetails">'.$row['details'].'</p>';
echo '<p class="productPrice"> RM'.$row['price'].'</p>';
//the line below cause error.
echo '<button class="addItem" onclick="addToCart("'.$row['name'].'")">Add to cart</button>';
echo "</div>";
echo "</div>";
}
function addToCart(name){
console.log(name);
}