Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/61.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 mysql_获取_数组重置_Php_Mysql - Fatal编程技术网

php mysql_获取_数组重置

php mysql_获取_数组重置,php,mysql,Php,Mysql,我想从mysql数据库打印一个列表,但是第一个列表项没有打印,因为mysql\u fetch\u数组被调用了两次。我试着重置,但没有成功。我该怎么办 $current_goam = mysql_real_escape_string($current_goam); $current_content = mysql_real_escape_string($current_content); $note_content = mysql_query("select * from notes where

我想从mysql数据库打印一个列表,但是第一个列表项没有打印,因为mysql\u fetch\u数组被调用了两次。我试着重置,但没有成功。我该怎么办

$current_goam = mysql_real_escape_string($current_goam);
$current_content = mysql_real_escape_string($current_content);

$note_content = mysql_query("select * from notes where title='$current_content' and goam='$current_goam' and user_id='$user_id'");

$note = mysql_fetch_array( $note_content );

if($note['type'] == 'list')
{
    $note_type='list';      
    reset($note);

    print "<table>";
    while($note_info = mysql_fetch_array( $note_content ))
    {
        print "<tr><td>";
           echo $note_info['body'];
            print "</td>";

            echo "<td><input type='checkbox' name='complete_goal' value='".$note_info['note_id']."'></input></td>";         
         print "</tr>";
    }
    print "</table>";
}   
else{
    echo $note['body'];
}
$current\u goam=mysql\u real\u escape\u string($current\u goam);
$current\u content=mysql\u real\u escape\u字符串($current\u content);
$note_content=mysql_query(“从notes中选择*,其中title='$current_content'和goam='$current_goam'和user_id='$user_id');
$note=mysql\u fetch\u数组($note\u content);
如果($note['type']=='list')
{
$note_type='list';
重置(附注);
打印“”;
而($note\u info=mysql\u fetch\u数组($note\u content))
{
打印“”;
echo$note_info['body'];
打印“”;
回声“;
打印“”;
}
打印“”;
}   
否则{
回音$note['body'];
}

尝试此操作,而不是
重置

mysql_data_seek($note_content, 0);

reset
适用于数组

尝试在数组中加载数据,然后按需要使用它

$records = array();
while($r = mysql_fetch_array($note_content)) {
    $records[] = $r;
}

请注意,如果您使用mysqli而不是mysql,则需要使用mysqli\u data\u seek($Note\u content,0);