Reply to Counter problem

Your name:

Reply:


Posted by Duderino82 on 04/06/06 12:30

I wanted to ad a counter to records. So when the user views the details
of the record I punch in this php line:

$qry = mysql_query("SELECT * FROM $table WHERE code='$code'",$db);
$row=mysql_fetch_array($qry);
$row[view]++;
$str="UPDATE $table SET view='$row[view]' WHERE code=$code";
mysql_query($str,$db);

when I check $row[view] after the increment it actually cointains
$row[view]++. Even the SQL string is correct. Lets say $row[view] was
23 then $str is:

UPDATE $table SET view='24' WHERE code=$code

The problem is that in the database the value will be 25!!! 'view'
field is a basic INT (11) (no auto_increment). I tryed to put in the
same value I get (in che example 23) with the result that he doesn't
change the value (it remains 23). What is the problem? and I can I
solve it???

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация