数据库中保存的未知数据

时间:2018-10-17 18:52:13

标签: javascript

我只是想知道您是否可以帮助我解决我的问题。 下面是我的代码,在这里我可以将数据保存为这样的项目符号形式 enter image description here

我正在为我的项目使用以下代码

<script>
$(".note").focus(function() {
    if(document.getElementById('note').value === ''){
        document.getElementById('note').value +='• ';
	}
});
$(".note").keyup(function(event){
	var keycode = (event.keyCode ? event.keyCode : event.which);
    if(keycode == '13'){
        document.getElementById('note').value +='• ';
	}
	var txtval = document.getElementById('note').value;
	if(txtval.substr(txtval.length - 1) == '\n'){
		document.getElementById('note').value = txtval.substring(0,txtval.length - 1);
	}
});
</script>


<script>
$(".prescription").focus(function() {
    if(document.getElementById('prescription').value === ''){
        document.getElementById('prescription').value +='• ';
	}
});
$(".prescription").keyup(function(event){
	var keycode = (event.keyCode ? event.keyCode : event.which);
    if(keycode == '13'){
        document.getElementById('prescription').value +='• ';
	}
	var txtval = document.getElementById('prescription').value;
	if(txtval.substr(txtval.length - 1) == '\n'){
		document.getElementById('prescription').value = txtval.substring(0,txtval.length - 1);
	}
});
</script>



<?php
include("db.php"); ?>
 <?php 
$sqlsearch;
$row;
$sqlsearch="";
$message="";
$conid="";
          $patient_id="";
          $lname="";
          $mi="";
          $fname="";
          $suffix="";



            
                $sql = "SELECT
                        patient.lname,
                        patient.fname,
                        patient.mi,
                        patient.suffix
                        FROM
                        patient
                        WHERE
                        patient.patient_id= '".$_REQUEST['patient_id']."'";
                        $result = mysqli_query($conn,$sql);
              
                       while($row = mysqli_fetch_array($result)){
                       $lname = $row['lname'];
                       $fname = $row['fname'];
                       $mi = $row['mi'];
                       $suffix = $row['suffix'];
                 
                         echo "<tbody><tr>";     
                        echo "<td> <h5> Patient's name: &nbsp; &nbsp;<u>" . $fname ."&nbsp;" . $mi .".&nbsp;" . $lname ."&nbsp;" . $suffix ."</u></h5></td></tr>";
                                
                    }
                 
                               
                
   ?>  
<form method="POST" action="">
    <textarea id="note" class="form-control note" name="note" id="note" rows="10" placeholder="" required=""></textarea><br><br>
     <textarea id="prescription" class="form-control prescription" id="note" name="prescription" rows="10" placeholder="" required=""></textarea>
</form>

我的SQL查询结果是这样 enter image description here

现在我的问题是,这个字符串'•'也与我的数据一起保存在数据库中,我不知道它来自哪里。你们能指出我的编码错误吗?

2 个答案:

答案 0 :(得分:1)

•字符串是Lorem Ipsum之前的bullet point characters。数据库使用的任何排序规则都不会处理那些UTF字符。

例如

String in 'ANSI'

..And UTF-8

答案 1 :(得分:0)

是项目符号点的SQL表示形式。

将数据发送到数据库时,请确保也不要发送项目符号。