简体   繁体   English

如何在查询字符串中传递mysql_query结果?

[英]how pass mysql_query result in query string?

How can i pass the array result in php is it possible that it can pass the mysql_query result with the query string to use that resulted value in another page. 我如何在php中传递数组结果,是否可以将mysql_query结果与查询字符串一起传递,以在另一个页面中使用该结果值。

        $qry="SELECT machine_equiptype ,COUNT(*) FROM project_machinelist  WHERE machine_status='$wf' group by machine_equiptype";


        $rsl=mysql_query($qry);
            while($rw=mysql_fetch_array($rsl))
            {
                echo "<td>";
                $val = $rw['machine_equiptype'];
                echo $val;
                echo "</td>"."<td>"."&nbsp;&nbsp;&nbsp;&nbsp;";
                $subqry="select project_id from project_machinelist WHERE machine_equiptype='$val'";
                $subrsl=mysql_query($subqry);

                // can i pass query result in query string
                echo "<a href=getsubdata.php?val='$val'"."&val2='$subrsl'"."&wf='$wf'>";
                echo $rw[1];
                echo "</a>"."</td>"."<td>"."&nbsp;&nbsp;&nbsp;&nbsp;";
                echo "0";
                echo "</td>"."<td>"."&nbsp;&nbsp;&nbsp;&nbsp;";
                echo "0";
                echo "</td>"."</tr>";

            }

can i pass this $rsl variable in querystring ? 我可以在querystring中传递此$ rsl变量吗? as given bellow.please help if any one knows thanks in advance.here in this prog i use queries first for print in current page and another one's result i want into linked page so is it possible to pass it .if yes then how if no then why n how much 如给定的bellow.please帮助,如果有人事先知道。在此程序中,我首先使用查询在当前页面中进行打印,而另一个人的结果我要进入链接页面,以便可以通过它。那为什么要多少

mysql_query Return Values, mysql_query返回值,

For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error. 对于SELECT,SHOW,DESCRIBE,EXPLAIN和其他返回结果集的语句,mysql_query()成功时返回资源,错误时返回FALSE。

For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success or FALSE on error. 对于其他类型的SQL语句,例如INSERT,UPDATE,DELETE,DROP等,mysql_query()成功返回TRUE,错误返回FALSE。

The returned result resource should be passed to mysql_fetch_array(), and other functions for dealing with result tables, to access the returned data. 返回的结果资源应传递到mysql_fetch_array()和其他用于处理结果表的函数,以访问返回的数据。

http://php.net/manual/en/function.mysql-query.php http://php.net/manual/zh/function.mysql-query.php

            $subrsl=mysql_query($subqry);
            $subresutls=mysql_fetch_array($subrsl);
            $project_id = $subresutls['project_id'];                

            // can i pass query result in query string
            echo "<a href=getsubdata.php?val='$val'"."&val2='$project_id'"."&wf='$wf'>";
  • please dont use mysql_* functions, use mysqli 请不要使用mysql_ *函数,请使用mysqli

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM