Gannon8
November 13th, 2008, 01:43 AM
Hi. I have a LAMPPP Server 8.10, and I have a problem.
When I try to use the text gotten from MySQL in the following PHP script:
<?php
include 'connect_website.inc.php';
$database = mysql_select_db("website_db") or die("ERROR: Cannot access database");
$data = mysql_query("SELECT * FROM links");
print "<!-- STARTING LINKS -->";
while($row = mysql_fetch_array($data, MYSQL_ASSOC))
{
if($row["approved"] != True)
{
continue;
}
print "<tr>\n";
print " <td><a href=\"gotourl.php?link={$row['name']}\">{$row['name']}</a></td>\n";
print " <td>$row['desc']</td>\n";
print " <td>$row['clicks']</td>\n";
print "</tr>\n";
print "\n";
}
print "<!-- END LINKS -->";
?> The page complains $row['desc'] is not of type 'str.' A var_dump, however, reveals that it is a string. The row from the table is in this format:
varchar url, varchar name, varchar desc, unsigned int clicks, tinyint approved
Please help?
When I try to use the text gotten from MySQL in the following PHP script:
<?php
include 'connect_website.inc.php';
$database = mysql_select_db("website_db") or die("ERROR: Cannot access database");
$data = mysql_query("SELECT * FROM links");
print "<!-- STARTING LINKS -->";
while($row = mysql_fetch_array($data, MYSQL_ASSOC))
{
if($row["approved"] != True)
{
continue;
}
print "<tr>\n";
print " <td><a href=\"gotourl.php?link={$row['name']}\">{$row['name']}</a></td>\n";
print " <td>$row['desc']</td>\n";
print " <td>$row['clicks']</td>\n";
print "</tr>\n";
print "\n";
}
print "<!-- END LINKS -->";
?> The page complains $row['desc'] is not of type 'str.' A var_dump, however, reveals that it is a string. The row from the table is in this format:
varchar url, varchar name, varchar desc, unsigned int clicks, tinyint approved
Please help?