检索数据仅显示第一个字母

时间:2015-05-04 14:50:39

标签: php mysql

我能够从我的数据库中检索数据,但它只为每个表显示一个单词。在我的数据库中,类型是varchar,大小为100.这是我的代码

 <?php
 $profile=mysql_query("SELECT * FROM info WHERE category='$_POST[edit_id]'");

 if($profile)
 {
$row = mysql_fetch_array($profile);
echo $row['description']. "" ;

echo "
<form name='custform' action='2.7update.php' method='POST'>
    <center>
        <table border=1 class='table_common'>
        <tr><td>
            <h2>Championship</h2>
            <table border=0>

            <td><input type='hidden' name='id' id='id' value=".$row['id']."></td>


            <tr>
            <td>Category</td>
            <td>:</td>
            <td><input type='text' name='category' id='category' value=".$row['category']."></td>
            </tr>

            <tr>
            <td>Description</td>
            <td>:</td>
            <td><input type='text' name='description' id='description' value=".$row['description']."></td>
            </tr>

            <tr>
            <td>Date</td>
            <td>:</td>
            <td><input type='date' name='date' id='date' value=".$row['date']."></td>
            </tr>

            <tr>
            <td>Status</td>
            <td>:</td>
            <td><input type='text' name='status' id='status' value=".$row['status']."></td>
            </tr>


            <tr>
            <td colspan=3 align=center>
            <input type='submit' name='submit' id='submit_update' value='Confirm and submit'>
            <input type='button' name='back' id='back' value='Back' onClick='javascript:document.location.href=&#39;2.5vieweditchampion.php&#39;;'>
            <input type='button' name='Main Menu' id='Mainmenu' value='Main Menu' 

 onClick='javascript:document.location.href=&#39;2.2coachmain.php&#39;;'>
            </td>
            </tr>
            </table>
        </td></tr>
        </table>
    <BR>
</center>
</form>";
 }
 else
 echo "".mysql_error();

 ?>

如何才能检索完整的句子,而只是显示一个单词?

1 个答案:

答案 0 :(得分:0)

这是一个HTML错误。处理完毕后,您的输入将如下所示:

cmd.Parameters.AddWithValue("@tinno", tinNo.Trim());//Bind supplier tin no.

那只会是那些。你需要报价:

<input type='text' name='description' id='description' value=This is a long string>

你显然感到困惑,因为你认为&#34;是报价。这结束了串联的字符串。你需要更多的报价。

<input type='text' name='description' id='description' value='This is a long string'>