|
-
April 23rd, 2010, 05:31 AM
#1
MySQLi won't return certain strings from DB?
Hey everybody.
I'm using this code to select all 3 columns from my database table.
PHP Code:
$stmt = $mysqli->prepare("SELECT * FROM entries")) {
/* Query uitvoeren */
$stmt->execute();
/* bind result variables */
$stmt->bind_result($id, $title, $body);
/* fetch value */
$stmt->fetch();
}
echo $id;
echo $title;
echo $body;
($mysqli contains a working connection.)
Now. The echo statements at the bottom of the code only produce output for $id and $title. $body is an empty string.
After doing some research, I noticed that mysqli don't bind results to a variable if the result in the database contains these characters: < or >.
So if i would change my title from "This is a title" to "<This is a title". The $title variable will be empty after the bind_result call.
PS: My body always contains HTML code. Like:
<h3>Subtitle</h3>
<p> text </p>
Very simple HTML code. But it seems that mysqli won't return values with a greater than or lesser than sign.. 
PS: I use a MySQL database.
Does anyone know how I could 'fix' this. Or knows a workaround.
Thanks in advance.
Greetings,
Dave
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|