I want to compute one variable from another variable in the same table original variable is ip (varchar 50) variable to be computed is ip_aton (bigint) I seem to have opened the database correctly, the following statement executes OK (it is just a test without real meaning, it bumps counters for all ip). mysql_query("UPDATE $table_name SET visits=visits+1 WHERE 1=1;"); Code (markup): However, when I try to compute the variable ip_aton, using the function INET_ATON I only get 0 in the column for ip_aton. I think I must have misunderstood how to use the function INET_ATON? mysql_query("UPDATE $table_name SET ip_aton=INET_ATON('ip') WHERE 1=1;") or die(mysql_error()); Code (markup): Thanks
I apologise for beginner's mistake. I should not have single quotes around ip when calling the function. Thread solved Sorry. EDIT: mysql_query("UPDATE $table_name SET ip_aton=INET_ATON(ip) WHERE 1=1;") or die(mysql_error()); Code (markup):