Php 此程序条将输出搜索的目录,但如果未找到,则必须输出消息 此程序必须输出一个您搜索过的目录,如果没有找到,则必须显示一条消息,说明找不到组织名称,我不知道如何执行此操作,我一直在尝试一些if-else,但它就是不输出。

Php 此程序条将输出搜索的目录,但如果未找到,则必须输出消息 此程序必须输出一个您搜索过的目录,如果没有找到,则必须显示一条消息,说明找不到组织名称,我不知道如何执行此操作,我一直在尝试一些if-else,但它就是不输出。,php,mysql,Php,Mysql,您需要的是mysql\u num\u rows检查查询中有多少结果行 请陈述一个问题。(lol)echo$stmt;mysql_查询($stmt)从未在代码中使用或设置。请在提交之前清理你的代码。谢谢,我忘了删除它 this program must output a directory that you searched for how ever if its not found a message must appear that the org_name is not found,i d

您需要的是
mysql\u num\u rows
检查查询中有多少结果行


请陈述一个问题。(lol)
echo$stmt;mysql_查询($stmt)从未在代码中使用或设置。请在提交之前清理你的代码。谢谢,我忘了删除它
this program must output a directory that you searched for how ever if its not found a message must appear that the org_name is not found,i don't know how to do that, i keep trying on some if-else but it just won't output it.   

            <?php
    $con=mysql_connect("localhost","root","");

    if(!$con) {
    die('could not connect:'.mysql_error());
    }

    mysql_select_db("final?orgdocs",$con);

    $org_name = $_POST["org_name"];
    $position = $_POST["position"];

    $result = mysql_query("SELECT * FROM directory WHERE org_name = '$org_name' OR position = '$position' ORDER BY org_name");



    echo '<TABLE BORDER = "1">';
    $result1 = $result;
    echo '<TR>'.'<TD>'.'Name'.'</TD>'.'<TD>'.'Organization Name'.'</TD>'.'<TD>'.'Position'.'</TD>'.'<TD>'.'Cell Number'.'</TD>'.'<TD>'.'Email-Add'.'</TD>';
    echo '</TR>';

    while ( $row = mysql_fetch_array($result1) ){

    echo '<TR>'.'<TD>'.$row['name'].'</TD>'.'<TD>'.$row['org_name'].'</TD>';

    echo '<TD>'.$row['position'].'</TD>'.'<TD>'.$row['cell_num'].'</TD>'.'<TD>'.$row['email_add'].'</TD>';
    echo '</TR>';
    }

    echo '</TABLE>';

    ?>
if (mysql_num_rows($result)>0) {
  // your thing above with mysql_fetch_array($result1) etc
} else {
  echo 'nor found';
}