Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用php仅显示全名_Php_Html_Mysql_Sql_Arduino - Fatal编程技术网

如何使用php仅显示全名

如何使用php仅显示全名,php,html,mysql,sql,arduino,Php,Html,Mysql,Sql,Arduino,我设置了MySQL服务器,并试图使用Arduino和Ethernet shield从SQL server获取数据。问题是我无法从输出中删除未使用的全文 我对php了解不多,所以我不能尝试很多东西 <html> <head> <title>Try Session JSON</title> </head> <body> <?php $dbusername =

我设置了MySQL服务器,并试图使用Arduino和Ethernet shield从SQL server获取数据。问题是我无法从输出中删除未使用的全文

我对php了解不多,所以我不能尝试很多东西

    <html>
    <head>
    <title>Try Session JSON</title>
    </head>
    <body>
    <?php

        $dbusername = "root";  
        $dbpassword = ""; 
        $server = "localhost"; 
        $dbconnect = mysqli_connect($server, $dbusername, $dbpassword);
        $dbselect = mysqli_select_db($dbconnect, "test");
        $sql="SELECT full_name FROM test.eattandance WHERE id=1";
        $records=mysqli_query($dbconnect,$sql);
        $json_array=array();
        while($row=mysqli_fetch_assoc($records))
    {
        $json_array[]=$row;
    }
        /*echo '<pre>';
        print_r($json_array);
        echo '</pre>';*/
    echo json_encode($json_array);
    ?>
    </body>
    </html>

尝试会话JSON

我希望tryjson.php的输出是A1,但实际输出是
[{“full_name”:“A1”}]

这是您想要的吗


尝试会话JSON

您想要很多名称还是一个名称?为什么要使用
json\u encode
而不是迭代数组?
   <html>
    <head>
    <title>Try Session JSON</title>
    </head>
    <body>
    <?php

        $dbusername = "root";  
        $dbpassword = ""; 
        $server = "localhost"; 
        $dbconnect = mysqli_connect($server, $dbusername, $dbpassword);
        $dbselect = mysqli_select_db($dbconnect, "test");
        $sql="SELECT full_name FROM test.eattandance WHERE id=1";
        $records=mysqli_query($dbconnect,$sql);
        $json_array=array();
        while($row=mysqli_fetch_assoc($records))
        {
            $json_array[]=$row;
            echo $row['full_name'];
        }
    ?>
    </body>
    </html>