Jump to content

Msql counter help..


spfoonnewb

Recommended Posts

So I made this script, it checks for the name and id include.. and only runs if its set. When I do set it, such as ?id=1&name=test, it says there is an error. If I take (, name='$name") out, it has no error. But does not update the variable.

[code]<?php

if (!empty($_GET["name"]) && $_GET["id"]) {

$link = mysql_connect("localhost", "username", "password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());

$name = $_GET["name"];
$id = $_GET["id"];

mysql_query ("UPDATE cat SET count=count+1 WHERE id='$id', name='$name") or die(mysql_error());

mysql_close ($link);
}

else {

//Do Nothing

}

?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/34166-msql-counter-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.