Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/57.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_Mysql - Fatal编程技术网

如何在php中显示数据库中的多个复选框值

如何在php中显示数据库中的多个复选框值,php,mysql,Php,Mysql,我想显示数据库中的复选框值 Example : my value is 25,26. So, How can i display it one by one ? such as, -- 1st value is : 25. --2nd Value is : 26. 我的代码: } 谢谢。您知道,您可以使用echo将html标记写入页面。所以基本上是这样的: while($data = $result->fetch_object()){ echo '<input type=

我想显示数据库中的复选框值

Example : my value is 25,26.
So, How can i display it one by one ?
such as,
-- 1st value is : 25.
--2nd Value is : 26.
我的代码:

}


谢谢。

您知道,您可以使用echo将html标记写入页面。所以基本上是这样的:

while($data = $result->fetch_object()){
    echo '<input type="checkbox" name="check" value="'.$data->educationid.'">'.$data->educationid.'<br>';
}

我认为您所寻找的谜题的一部分可能是从给定的字符串$data->educationid ie:25,26爆炸创建一个整数数组

$db = new mysqli("localhost","paroshic_paroshic","kxmcwQzLTrTR","paroshic_matri2018jl");
$sql = "select * from tbldatingusermaster order by userid desc";
$result = $db->query( $sql );

if( $result ){
    while( $data = $result->fetch_object() ){
        /* explode the string into little integers */
        $ids=explode( ',', $data->educationid );

        /* iterate through the pieces and generate an input[checkbox] element */
        foreach( $ids as $id )printf('<input type="checkbox" name="UNKNOWN[]" value="%s" />',$id);
    }
}

您是否有代码和一些您可能已经尝试过的东西?您要求的内容太广泛和不清楚。如果您还没有浏览帮助区域以及其中的相关链接,那么浏览帮助区域将对您有所帮助。通读一遍,您将看到这里的堆栈溢出是如何工作的。这将给你一个好主意,如何制定一个好的问题,看看什么可以和不应该被问,以及什么是期望从你。这是为了帮助你们在堆栈溢出方面有一个更好和积极的体验,这是每个人都想要和追求的。我已经上传了我的代码。plzz检查我的值在数据库中是25,26…我是通过复选框插入的…但我想显示它…示例[我的值是25,我的值是26]。
$db = new mysqli("localhost","paroshic_paroshic","kxmcwQzLTrTR","paroshic_matri2018jl");
$sql = "select * from tbldatingusermaster order by userid desc";
$result = $db->query( $sql );

if( $result ){
    while( $data = $result->fetch_object() ){
        /* explode the string into little integers */
        $ids=explode( ',', $data->educationid );

        /* iterate through the pieces and generate an input[checkbox] element */
        foreach( $ids as $id )printf('<input type="checkbox" name="UNKNOWN[]" value="%s" />',$id);
    }
}