führen Sie mehrere sql-Abfragen, die beim klicken auf einen submit-button auf PHP-Seite

Ich habe eine PHP-Seite, die beim klicken auf die submit-Schaltfläche Prozess ein paar MySQL-Abfragen.

in MySQL PHPMyAdmin die Abfrage funktioniert 100% und beide Abfragen ausführen. Allerdings, wenn mein PHP-Code, der die Abfragen nicht ausführen.

Jede Hilfe würde geschätzt, ich Wette, das ist eine einfache eine für anständige PHP-Programmierer.

Vielen Dank im Voraus Ryan.

Mein Code ist:

<?php
    mysql_connect("localhost", "hulamin_hulamin", "Hulamin2011")or die("cannot connect");    
    mysql_select_db("hulamin_loc")or die("cannot select DB");
    $sql="SELECT `dispatcharea`,`customer`,`casenumber`,`weight` from loaddetails where loadid = 0 order by dispatcharea";
    $result=mysql_query($sql);
    $count=mysql_num_rows($result);
?>
<html>
<head>
<title>
Plan Local PMB Delivery - Step 2
</title>
</head>
<html>


<table border=0>
    <tr>
        <td>
            <form name="form1" method="post">
                <table border=1>
                    <tr>
                        <td width=150>Dispatch Area</td>                        
                        <td width=300>Customer</td>  
                        <td width=150>Case Number</td>
                        <td width=100>Weight</td> 
                    </tr>
<?php
    while($rows=mysql_fetch_array($result)){
?>
                    <tr>
                        <td><?php echo $rows['dispatcharea']; ?></td>
                        <td><?php echo $rows['customer']; ?></td>
                        <td><?php echo $rows['casenumber']; ?></td>
                        <td><?php echo $rows['weight']; ?></td>
                    </tr>    

<?php
  }
?>      
</table>            
    <input name="Next" type="submit" id="Next" value="Next">                

<?php
if($_REQUEST['Next']=='Next') {
    {
        $sql="update loaddetails set loadid= (select max(loadid)+1 from loadcounterid) where loadid=0; update loadcounterid set loadid= (select max(loadid) from loaddetails) where loadid>0;";

        $final=mysql_query($sql);
        if($final)
        {
            echo "<meta http-equiv=\"refresh\" content=\"0;URL=planlocalpmbstep3.php\">";
        }
    } 
}

?>
</table>

</form>
</td>
</tr>
</table>

Nochmals vielen Dank,
Ryan

  • warum nicht Sie laufen die zwei Abfragen in zwei getrennte Aufrufe von mysql_query?
  • Hu @mishu, können Sie adivse mich, wie dies auf den vorhandenen code? wie kann ich hav zwei Aktionen bei einem Klick? Dank
InformationsquelleAutor Smudger | 2011-10-05
Schreibe einen Kommentar