Moudiz
Moudiz

Reputation: 7377

pass argument to link and update table

I am not that good in php so you migt find it simple.

this php is not updating on the database

<?php error_reporting(E_ALL); ini_set('display_errors', 1);
//credentials...

$id= intval($_GET['id']);
$likes= intval($_GET['likes']);

$con = mysqli_connect($host,$uname,$pwd,$db) or die(mysqli_error());


    $sql1="UPDATE OBJECTS SET LIKES='$likes' WHERE ID='$id'";
   $result = mysqli_query($con,$sql1);


?>

I tried to run the link http://justedhak.com/old-files/singleactivity.php/id=1&likes=1 by passing the arguments but nothing happen.

Upvotes: 0

Views: 22

Answers (1)

One In a Million Apps
One In a Million Apps

Reputation: 361

Your url has an error. The GET variables are delimited by a ? after the page address.

http://justedhak.com/old-files/singleactivity.php/id=1&likes=1

http://justedhak.com/old-files/singleactivity.php?id=1&likes=1

Change / to ?

Upvotes: 1

Related Questions