I want to add an ip address to the sql server via a php query, it doesn't work (probably because of a colon) in the Users table, the user_ip column has the data type nvarchar (300)

$userip=$_SERVER['REMOTE_ADDR']; $query= ("update Users set user_ip=(".$userip.") where id= (".$_SESSION['login'].")"); 

error response

  • one
    SQL query parameterization - Igor
  • You know, in SQL queries there is a big difference between 192.168.0.1 and '192.168.0.1' . I advise you to figure it out - ArchDemon
  • and str_replace will help? - delphi
  • You will be helped by enclosing string values ​​in single quotes. nevertheless, as stated in the first comment, learn how the binding of query parameters for the used database access driver works - teran

0