Re: MySQLand a prepared statement problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Hello everyone,
>
> I have a problem. When I insert <a href="http://example.com>Example</a>
> into my database with the following code...
>
> $connect = mysqli_connect($hostname, $username, $password, $database);
> $sql="INSERT INTO notes VALUES ('$id', '$note')";
> $result=mysqli_query($connect, $sql);
>
> ...everything works fine. The link (when I SELECT it and display it in my
> browser) works as one would expect.
>
> However when I insert <a href="http://example.com";>Example</a> into my
> database with the following code (prepared statement)...
>
> $submitnote = mysqli_prepare($connect, "INSERT INTO notes VALUES (?, ?)");
> mysqli_stmt_bind_param($submitnote, "is", $id, $note);
> mysqli_stmt_execute($submitnote);
>
> ...the link (when I SELECT it and display it in my browser) shows up as...
>
> http://jasoncarson.ca/admin/\"http://example.com\";
>
> ...Anyone know how to fix this so I can use the prepared statement?
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Just to clarify, $id would be different for each entry in the database.
$id=1 or 2 or 3 etc...
and
$note = <a href="http://example.com";>Example</a>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux