Jump to content

[SOLVED] Incrementing in PHP?


Gayner

Recommended Posts

UPDATE ibf_members set limitfriend = '".mysql_real_escape_string('+1')."'

 

I tried that but it just made it +1..

 

I want it to add +1.. My limitfriend is varchar(2) default 6, so when i run that query it makes it 7 or just increments. not all my code is here but that's what it is..

 

full code:

UPDATE ibf_members set limitfriend = '".mysql_real_escape_string('+1')."' WHERE id = '{$ibforums->member['id']}'"

 

Thnaks for ur help ~

Link to comment
https://forums.phpfreaks.com/topic/171880-solved-incrementing-in-php/
Share on other sites

so u understand ok mate.

<?php
$clicks = $row['clicks']+1;
$result = mysql_query("UPDATE downloads SET clicks = '$clicks' WHERE down_id = '$id'") or die (mysql_error());
?>

 

Thanks guys! it isn't working tho!@

 

I have limitfriend to default 6, varchar(2) and when i run query it sstays at 6 any ideas?

 

But if i manually change it from database to 6 to 7 it works ?

 

here it is:

 

UPDATE ibf_members set SET limitfriend=limitfriend+1 WHERE id = '{$ibforums->member['id']}'"

 

thanks mate if u can help ~ ?

NEVERMIND!! I used

 

<?php

$clicks = $row['clicks']+1;

$result = mysql_query("UPDATE downloads SET clicks = '$clicks' WHERE down_id = '$id'") or die (mysql_error());

?>

 

That technique and changed variables around and it works, i also changed it to INT(2) Default 6,

 

Thanks guys alot!

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.