BostonGuru
05-04-2008, 05:37 PM
I have very basic code to get a cell from a MySQL DB
$mysqli = new mysqli($host,$user,$password,$database);
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if ($stmt = $mysqli->prepare("SELECT pageContent FROM articles WHERE articleID=?")) {
$articleID = 20;
$stmt->bind_param("i", $articleID);
$articleID = 20;
$stmt->execute();
$stmt->bind_result($articleContent);
while ($stmt->fetch()) {
printf("%s \n", $articleContent);
}
$stmt->close();
}
else
{
echo 'error';
}
$mysqli->close();
So I have a article title column which is of type 'text' and a content column of type 'longtext'. When I run this code with the SQL query to grab the title column it works fine, but when I run this code with the SQL query to grab the content column, it returns an empty string.
The content cells have html markup in them. Could that be causing a problem? If not, what could the problem be? Thanks.
$mysqli = new mysqli($host,$user,$password,$database);
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if ($stmt = $mysqli->prepare("SELECT pageContent FROM articles WHERE articleID=?")) {
$articleID = 20;
$stmt->bind_param("i", $articleID);
$articleID = 20;
$stmt->execute();
$stmt->bind_result($articleContent);
while ($stmt->fetch()) {
printf("%s \n", $articleContent);
}
$stmt->close();
}
else
{
echo 'error';
}
$mysqli->close();
So I have a article title column which is of type 'text' and a content column of type 'longtext'. When I run this code with the SQL query to grab the title column it works fine, but when I run this code with the SQL query to grab the content column, it returns an empty string.
The content cells have html markup in them. Could that be causing a problem? If not, what could the problem be? Thanks.
