samedi 27 décembre 2014

sql update random number


if (empty($_SESSION['last_read_topic']) || $_SESSION['last_read_topic'] != $topic)

{
$smcFunc['db_query']('', '
UPDATE {db_prefix}topics
SET num_views = num_views + 99
WHERE id_topic = {int:current_topic}',
array(
'current_topic' => $topic,
)
);

$_SESSION['last_read_topic'] = $topic;
}


in line... SET num_views = num_views + 99


how i random number between 1-99


thank you so much


i have answer thank you http://stackoverflow.com/users/3349551/nodisplayname



SET num_views = num_views + ROUND(((99-1-1) * RAND() + 1), 0)




Aucun commentaire:

Enregistrer un commentaire