Gayner Posted August 26, 2009 Share Posted August 26, 2009 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 More sharing options...
redarrow Posted August 26, 2009 Share Posted August 26, 2009 UPDATE ibf_members set limitfriend = limitfriend+1 where id='id' Link to comment https://forums.phpfreaks.com/topic/171880-solved-incrementing-in-php/#findComment-906323 Share on other sites More sharing options...
redarrow Posted August 26, 2009 Share Posted August 26, 2009 so u understand ok m8. <?php $clicks = $row['clicks']+1; $result = mysql_query("UPDATE downloads SET clicks = '$clicks' WHERE down_id = '$id'") or die (mysql_error()); ?> Link to comment https://forums.phpfreaks.com/topic/171880-solved-incrementing-in-php/#findComment-906325 Share on other sites More sharing options...
Gayner Posted August 26, 2009 Author Share Posted August 26, 2009 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 ~ ? Link to comment https://forums.phpfreaks.com/topic/171880-solved-incrementing-in-php/#findComment-906327 Share on other sites More sharing options...
redarrow Posted August 26, 2009 Share Posted August 26, 2009 the numbers in the database need to be in a INT database format from mysql/database i guess try change your database format bro. only guessing. Link to comment https://forums.phpfreaks.com/topic/171880-solved-incrementing-in-php/#findComment-906330 Share on other sites More sharing options...
Gayner Posted August 26, 2009 Author Share Posted August 26, 2009 the numbers in the database need to be in a INT database format from mysql/database i guess try change your database format bro. only guessing. Thanks, i just tryed that, it didn't work Link to comment https://forums.phpfreaks.com/topic/171880-solved-incrementing-in-php/#findComment-906331 Share on other sites More sharing options...
Gayner Posted August 26, 2009 Author Share Posted August 26, 2009 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! Link to comment https://forums.phpfreaks.com/topic/171880-solved-incrementing-in-php/#findComment-906335 Share on other sites More sharing options...
redarrow Posted August 26, 2009 Share Posted August 26, 2009 well done your grate, see you can do it well done bro. Link to comment https://forums.phpfreaks.com/topic/171880-solved-incrementing-in-php/#findComment-906345 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.