UPDATE doesn't work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,

I'm a graphic designer making a site for giving tutorials, but since i'm just a newbie in coding, tons of problems have fallen on me.

This is my photoshop_tutorial table structure

id int not null auto_increment,
title varchar(255) not null,
author varchar(55) not null,
description text not null,
date int(14) not null,
tutorial mediumtext not null,
view int not null,
primary key (id),
unique id (id)

In the show_photoshop_tutorial.php, i used this

// Fetch info of the tutorial

$result = mysql_query("select * from photoshop_tutorial where id=$id");
while($row = mysql_fetch_array($result)) {

// Format the date

$postdate=date("d-m-Y",$row[date]);

// Add 1 view to the view column

$v = $row[view];
$vplus = $v+1;
$view = mysql_query("update photoshop_tutorial where id=$id set view=$vplus"); // Problem here!

// Fetch user's info from another table

$user = mysql_query("select * from site_users where displayname = '$row[author]'");
$get_info = mysql_fetch_array($user);

// Print out query results to the screen

echo "<p><b>$row[title]</b><br>";
echo "Author: <b><a href=\"mailto: ".$get_info[email]."\">$get_info[displayname]</a></b> on <b>$postdate</b> view ";
echo "<p>$row[description]";
echo "<p>$row[tutorial]";
}

But the view doedn't add 1 to the existing value

Any solutions for that?

Best regards,

Le Hoang

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux