数据库返回警告:Printf并且无法显示信息

时间:2016-02-09 14:07:31

标签: php

好的,我得到了最后一个工作,感谢你们在这里。

现在这里是打印出几个警告的内容我似乎没有看到这里的错误

“守则”现在看起来像这样

<html>
<title>Search Records</title>
<head>
<body>
    <form name="" id="" method="post" action="search.php"/>
    <p> Enter Student name : <input type="text" name="fullname" id="fullname"/>
    <input type="submit" name="senda" value="Search Data" />

</form>

<?php
if(isset($_POST['senda'])){

    include 'mysqlconn.php';

    $con = new mysqli($host, $dbuser, $pass, $db) or die('Cannot Connect');
    $name = mysqli_real_escape_string($con,$_POST['fullname']);
    $sql = "SELECT * FROM scores WHERE fullname = '$name'";
    $result = mysqli_query($con,$sql)  or die("Error: ".mysqli_error($con));

    while($row = mysqli_fetch_array($result,MYSQLI_ASSOC))
    {

           printf("%s (%s)\n", $row['Fullname'] ." ". $row['studentNo'] ." ". $row['SubjectName'] ." ". $row['GPA'] ." ". $row['CGPA'] ." ". $row['SCORE']);
            mysqli_free_result($result);
    }
        mysqli_close($con);
    }

?>
</body>
</head>
</html>

他给我的警告看起来像这样

( ! ) Warning: printf(): Too few arguments in C:\wamp\www\schoolmanagementsystem\search.php on line 24
Call Stack
#   Time    Memory  Function    Location
1   0.0051  248384  {main}( )   ..\search.php:0
2   0.1723  265608  printf ( )  ..\search.php:24

( ! ) Warning: mysqli_fetch_array(): Couldn't fetch mysqli_result in C:\wamp\www\schoolmanagementsystem\search.php on line 21
Call Stack
#   Time    Memory  Function    Location
1   0.0051  248384  {main}( )   ..\search.php:0
2   0.1901  261928  mysqli_fetch_array ( )  ..\search.php:21

我不认为这里看错有什么我实际上做得非常错误?

0 个答案:

没有答案