I've created this function and I wonder if ever I COULD USE VARIABLES IN reading
column values on database table.
function vote($column, $imgid)//the $column stands for a variable handling a string I've passed from my previous call. For now I am setting it as a string named "likes" which is equal to the name of 1 of my column in the table.
{
$query="SELECT $column FROM images WHERE imgid=$imgid";
$result=mysql_query($query);
if($column=mysql_fetch_assoc($result))
{
$column=$column[$column]; // problem starts here. It prompts an error saying "Warning: Illegal offset type in C:\xampp\htdocs\wakiki\index.php";
$column+=1;
}
$query="UPDATE images SET $column=$column WHERE imgid=$imgid";
$result=mysql_query($query);
}
Any help would be appreciated. Thanks