Home mysqli_query() WHERE - insert data
Reply: 0

mysqli_query() WHERE - insert data

user952
1#
user952 Published in June 24, 2018, 3:23 am

i'm new to php and what im trying to do here is add rating +1 for specific id (1,10,30....) whenever i press arrow up button.

I need to add id value (echo $row['id'];) to mysqli_query() somehow. Can someone help please? :)

<?php include("db.php")?>
<?php 
$sql = "SELECT * FROM gifs";
$result = mysqli_query ($db,$sql);
?>
 <?php 
//Fetch data from database
if ($result -> num_rows >0){

    while($row = mysqli_fetch_array($result)){
    ?>   

      <div><?php echo $row["name"];?></div>

            <p id="<?php echo $row['id'];?>">
            <?php echo $row['copygif'];?></p>

$add = $row['id']; //i know this dosnt work...
<i onClick="<?php mysqli_query($db,"UPDATE gifs SET rating = rating + 1 WHERE id= $add ");?>"></i>

How do i translate ($row['id'];) into mysqli_query( id = ?)

Thank You

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.310864 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO