Re: [PHP-DB] Please help a newbie

[email protected] (Daniel Carrera)
Newsgroups php.db
Message-ID <[email protected]>
Rij wrote:
> I input the values from a HTML form. Here is the partial code.
>         $phone = $_POST['phone'];
>         $name  = $_POST['name'];
>         $address = $_POST['address'];
>         $query = "INSERT INTO contacts VALUES ('$phone', '$name', '$address')";
>         if (mysql_query($query, $con)) echo "Values inserted";
>         else die('Unable to create table : '.mysql_error());

This is unsafe code. I suggest you lookup "prepared statements" and the 
PDO library (which is part of PHP).

Daniel.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.