查询未完全显示
Query not fully showing
我想从我的数据库中获取的查询没有完全显示。
它是关于 $straat 查询的。所有其他查询都很好。
描述的问题:
这是主页上的正常结果
在 Straat & Huisnummer 展示 "Roelofs Mulderweg 3"
这是我尝试用脚本编辑它时出现的问题
正如您在 Straat & Huisnummer 看到的那样,查询不再完全显示。
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>
试试这个:
<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 html_special_chars($track);?>"></td>
<td><input type="text" style="width:100%" name="straat" value="<?php echo html_special_chars($straat);?>"></td>
<td><input type="text" style="width:100%" name="postcode" value="<?php echo html_special_chars($postcode);?>"></td>
<td><input type="text" style="width:100%" name="plaats" value="<?php echo html_special_chars($plaats);?>"></td>
<td><input type="text" style="width:100%" name="land" value="<?php echo html_special_chars($land);?>"></td>
<td><input type="text" style="width:100%" name="datum" value="<?php echo html_special_chars($datum);?>"></td>
<td><input type="text" style="width:100%" name="klantnummer" value="<?php echo html_special_chars($klantnummer);?>"></td>
</tr>
</table>
<input type="hidden" name="id" value="<?php echo html_special_chars($_GET['id']);?>">
<input type="submit" name="update" value="Update">
一个 tr
有 7 个 td
,另一个
有 8 个
还有:
1) 不要忘记将您的属性值放在引号中
2) 在输出值上使用 html_special_chars,以防止 xss 和破坏标记
如评论中所建议:
value=<?php echo $straat;?>>
由于值中的空格而中断。将此行替换为
value="<?php echo $straat;?>">
(注意连字符)解决了问题。
我想从我的数据库中获取的查询没有完全显示。 它是关于 $straat 查询的。所有其他查询都很好。
描述的问题:
这是主页上的正常结果
在 Straat & Huisnummer 展示 "Roelofs Mulderweg 3"
这是我尝试用脚本编辑它时出现的问题
正如您在 Straat & Huisnummer 看到的那样,查询不再完全显示。
HTML
//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'];
}
?>
<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>
试试这个:
<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 html_special_chars($track);?>"></td>
<td><input type="text" style="width:100%" name="straat" value="<?php echo html_special_chars($straat);?>"></td>
<td><input type="text" style="width:100%" name="postcode" value="<?php echo html_special_chars($postcode);?>"></td>
<td><input type="text" style="width:100%" name="plaats" value="<?php echo html_special_chars($plaats);?>"></td>
<td><input type="text" style="width:100%" name="land" value="<?php echo html_special_chars($land);?>"></td>
<td><input type="text" style="width:100%" name="datum" value="<?php echo html_special_chars($datum);?>"></td>
<td><input type="text" style="width:100%" name="klantnummer" value="<?php echo html_special_chars($klantnummer);?>"></td>
</tr>
</table>
<input type="hidden" name="id" value="<?php echo html_special_chars($_GET['id']);?>">
<input type="submit" name="update" value="Update">
一个 tr
有 7 个 td
,另一个
还有:
1) 不要忘记将您的属性值放在引号中
2) 在输出值上使用 html_special_chars,以防止 xss 和破坏标记
如评论中所建议:
value=<?php echo $straat;?>>
由于值中的空格而中断。将此行替换为
value="<?php echo $straat;?>">
(注意连字符)解决了问题。