0

I have the following query:

<?php
$query="SELECT * FROM table LIMIT 4";
$result=mysql_query($query);

echo "<tr>";
for($i=1;$i<mysql_num_fields($result);$i++)
{

    echo "<th style='height: 10px; padding: 0px;'>";
    echo mysql_field_name($result, $i);
    echo "</th>";
}

while($row=mysql_fetch_row($result))
{
    echo "<tr>";
    for($j=1;$j<$i;$j++)
    {
    echo "<td style='height: 10px; padding: 0px;'>";
    echo $row[$j];
    echo "</td>";
    }
    echo "</tr>";
}

echo "</tr>";

?>

What I am trying to do is echo a URL from the database. I have added the URL into the database as <a href="http://somesite.com">Some Site</a>. It echoes the URL but cuts it off, for some reason it only gives me the first 7 characters of the displayed link. For example, the echoed URL would be "Some Si". Could someone please tell me what I am doing wrong? I also want to mention that the field contains additional text besides the URL. Thanks.

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Tekkno
0

your db field isn't long enough. The field should be 'varchar' datatype, set it to 200 or something, else if you think the whole text will be longer than 256 characters, use the 'text' datatype.

0

I had a suspicion that was what it was, thanks for the simple fix.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.