MySqlRuben
Programmer
Hi!
I'm a newbie in MySql, so please bear with me. What I want is to select all the informations concerning a specific article, and then to update a field of the resulting query. So, with some help I managed to do something like this
Without the part in italic, it works pretty good. But I wanted to update that specific field without doing another query. Any help is definitely appreciated!
I'm a newbie in MySql, so please bear with me. What I want is to select all the informations concerning a specific article, and then to update a field of the resulting query. So, with some help I managed to do something like this
Code:
$query = sprintf("SELECT [I]CONCAT('UPDATE articles SET visits=(visits+1) WHERE title='".$name_article."'')[/I]
FROM articles a
LEFT JOIN autors b ON a.autor = b.name
WHERE a.title='".$name_article."'");
$result = mysql_query($query);
Without the part in italic, it works pretty good. But I wanted to update that specific field without doing another query. Any help is definitely appreciated!