简体   繁体   中英

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.

        $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 ? 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

mysql_query Return Values,

For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error.

For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success or FALSE on error.

The returned result resource should be passed to mysql_fetch_array(), and other functions for dealing with result tables, to access the returned data.

http://php.net/manual/en/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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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