php - 查询未完全显示

标签 php mysql edit

我想从我的数据库中获取的查询没有完全显示。 它与 $straat 查询有关。所有其他查询都很好。

问题描述:

这是主页上的正常结果

在 Straat & Huisnummer 展示“Roelofs Mulderweg 3”

This is the normal result on the main page

这是我尝试用脚本编辑它时的问题

正如您在 Straat & Huisnummer 看到的那样,查询不再完全显示。

This is the problem when I try to edit it with the script PHP

//selecting data associated with this particular id
$result = mysql_query("SELECT * FROM tt WHERE id=$id");

while($res = mysql_fetch_array($result))
{
    $track = $res['track'];
    $straat = $res['straat'];
    $postcode = $res['postcode'];
    $plaats = $res['plaats'];
    $land = $res['land'];
    $datum = $res['datum'];
    $klantnummer = $res['klantnummer'];
}
?>

HTML

        <tr bgcolor='#CCCCCC'>
            <td>Track & Trace</td>
            <td>Straat & Huisnummer</td>
            <td>Postcode</td>
            <td>Plaats</td>
            <td>Land</td>
            <td>Datum</td>
            <td>Klantnummer</td>
</tr>
        <tr>
            <td><input type="text" style="width:100%" name="track" value=<?php echo $track;?>></td>
            <td><input type="text" style="width:100%" name="straat" value=<?php echo $straat;?>></td>
            <td><input type="text" style="width:100%" name="postcode" value=<?php echo $postcode;?>></td>
            <td><input type="text" style="width:100%" name="plaats" value=<?php echo $plaats;?>></td>
            <td><input type="text" style="width:100%" name="land" value=<?php echo $land;?>></td>
            <td><input type="text" style="width:100%" name="datum" value=<?php echo $datum;?>></td>
            <td><input type="text" style="width:100%" name="klantnummer" value=<?php echo $klantnummer;?>></td>
            <td><input type="hidden" name="id" value=<?php echo $_GET['id'];?>></td>
        </tr>

    </table>
                <input type="submit" name="update" value="Update">

</form>

最佳答案

如评论中所建议的那样:

value=<?php echo $straat;?>>

由于值中的空格而中断。将此行替换为

value="<?php echo $straat;?>">

(注意连字符)解决了这个问题。

关于php - 查询未完全显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32050104/

相关文章:

php - 如何在 Wordpress 中使用图像 ID 数组显示分页图像?

sql - 如何在 "generic"SQL 中编写 MySQL DATE_ADD()

java - 为什么 mysql 不识别其 LONGTEXT 数据类型上的 Unicode 字符?

mysql - 仅当我重新声明数据类型时,修改才有效吗?

javascript - Html 表(XML 绑定(bind)),带有用于编辑、删除、创建的命令按钮

php - 如何确定Laravel中belongsToMany关系中的数据透视表名称?

php - 从PHP中的Sqlcipher加密数据库中选择行

forms - 在drupal模块中编辑表单?

php - 使用 python 脚本 "Exit Code: 127(Command not found)"的 Laravel 任务计划

WordPress,允许评论者编辑自己的评论吗?