Ich habe zwei Tabellen pre_application und Bewerber und ich möchte pre_application Tabelle für Passwort und Bewerber Tabelle für die Anwendung Stift und wenn sie erfolgreich die Antragsteller abfragen angemeldet sein sollte Unten ist mein Code:.php PDO Abfrage zwei Tabellen mit den Unterschieden
if(isset($_POST['submit']) || $_SERVER['REQUEST_METHOD']=='POST'){
try{
$pin=$_POST['pin'];
$pass=$_POST['password'];
$stm=$dbh->query("SELECT password FROM pre_application WHERE password='$pass' UNION SELECT app_no FROM applicants WHERE app_no='$pin'");
foreach($stm as $row);
$appass=$row['password'];
$appin=$row['app_no'];
$name=$row['name'];
if($stm) {
header('location:approfile.php?applicant=$appass');
} else {
echo "<script> alert('Invalid Application Number or Password')</script>";
exist();
}
} catch(Exception $e){
echo $e->getMessage();
}
}?>
Jemand sollte bitte helfen Sie auf dem richtigen Syntax
'foreach ($ stm als $ row);' das stoppt genau dort. RTM http://php.net/manual/en/control-structures.foreach.php –
'' location: approfile.php? Antragsteller = $ appass'' Variablen werden nicht in einfache Anführungszeichen zerlegt und die POST-Arrays sind unbekannt . –
Mein Problem ist auf die Abfrage-Syntax – apollos