This code does not update my mysql.

//the $q is sent from ajax and looks like this
thumbsup.546 or thumbsdown.567

//the $q is sent trough a working ajax function and looks like this
<a href="#" onclick="thefunction(thumbsup.'.$row['wallid'].');">[+]</a>


$q = mysql_real_escape_string($_GET['q']);

$findme   = 'thumbsup';
$pos = strpos($q, $findme);

if($pos == TRUE){
$thumb  = $q;
$end = end(explode('.', $q));
mysql_query("UPDATE linkwall SET thumbsup=thumbsup +1,thumbuserid='$userid' WHERE wallid ='$end' LIMIT 1");

}

$findme   = 'thumbsdown';
$pos = strpos($q, $findme);
if($pos == TRUE){

$thumb  = $q;
$end = end(explode('.', $q));
mysql_query("UPDATE linkwall SET thumbsdown=thumbsdown +1,thumbuserid='$userid' WHERE wallid ='$end' LIMIT 1");

}

Recommended Answers

All 2 Replies

Try:

mysql_query('UPDATE ...') or die(mysql_error());

i fixed it, but it was something about the strpos that didnt work for me.
Have a great day pritaeas.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.