[英]How can I store and display a date value in a JavaScript variable from a MySql query in php script?
[英]can't display a complete value from a variable in php form using PostgreSQL query
(初學者)盡管使用了許多論壇,但我找不到解決方案。 我查詢 PostgreSQL 並嘗試在 php 頁面的文本字段中顯示結果。
查詢:
$sql3 = "select * from matable where code_tranche = $1" ;
然后
$marequete = pg_query_params(pg_connect("host=$server port=$port dbname=$base user=$_SESSION[identifier] password=$_SESSION[password]"),
$sql3, array($code_tranche)) ;
然后,html:
<body class = "imagemenuu">
<div >
<form >
<h4>Operation <?php echo $code_tranche ?></h4>
<?php
if (pg_num_rows($marequete) ==0) {
echo "<h5> The operation "$code_tranche' does not exist </h5>" ;
}
else {
line = pg_fetch_assoc($marequete) ;
var_dump($line[nomope]) ;
}
?>
<p class="psga" >operation name: <input type="text" size='60' name="nom_ope" value=<?php echo"'$ligne[nomope]'" ; ?> class = "alert alert-info" >
</div>
</form>
</body>
正如所寫,字段 nom_ope 顯示變量 $line 的字段名稱的內容,除非該字段包含一個' ex: phase 110 ,很好但是L而不是L'hopital 。
我試過了:
echo $ligne[nomope]
結果: L'hopital但只是相。
addslashes($line[nomope])
不比L'\\hopital 好。
htmlentities($line[name], ENT_QUOTES)
也不是更好。
value=<?php echo htmlspecialchars($ligne[nomope]) ; ?>
沒門...
總之,根據所使用的功能,無論是我整場並沒有什么后“或者我與文本”,只是第一場對其他案件的字。 :o
哪種技術可以讓我獲得完整的結果, '或不?
我忘記了“屬性:所以現在:
value="<?php echo $ligne['nomope'] ; ?>"
它工作正常。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.