我想从我的数据库中获取的查询没有完全显示。 它与 $straat 查询有关。所有其他查询都很好。
问题描述:
这是主页上的正常结果
在 Straat & Huisnummer 展示“Roelofs Mulderweg 3”
这是我尝试用脚本编辑它时的问题
正如您在 Straat & Huisnummer 看到的那样,查询不再完全显示。
//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/