Eingangstextwert holt keine Daten aus der Datenbank in PHP
Wenn ich auf dem Absenden-Button klicken, Daten aus der Datenbank angezeigt werden sollen, sondern eine leere Tabelle angezeigt wird. Ich weiß nicht, was falsch ist. Es funktioniert gut, wenn ich SQL auf dem SQL-Server ausführe, aber hier werden die Ergebnisse nicht abgerufen und angezeigt.
Dies ist das erwartete Ergebnis angezeigt werden .. pls kann mir jemand helfen ??
<body>
<form id="FromID" name="FromID" method="post">
<br><br>
<div align="center" style="font-family:Rockwell,Courier Bold,sans-serif; font-size:22px;font-weight:bold;">SMS Status </div>
<br><br>
<table style="border: 1px solid black" border="1" cellpadding="0" cellspacing="0" align="center" width="25%" class="style">
<tr>
<td>Group Name</td>
<td><input type="text" name="grp" id="grp"></td>
</tr>
<tr>
<td>Subscribtion Number</td>
<td><input type="text" name="num" id="num"></td>
</tr>
<tr>
<td colspan ="2" align="center">
<input type="submit" name="Submit" id="Submit" value="Submit" />
</td>
</tr>
</table>
<br>
<?php
if(isset($_POST['Submit']))
{
$group=$_POST['grp'];
$subscribe=$_POST['num'];
if(!empty($group) && !empty($subscribe))
{
$q= "select send_date_d,grp_name_vc,subr_no_i,send_type_vc,result_vc,brn_id_vc,subr_mobile_vc,subr_name_vc from tblsmsstatus
where grp_name_vc='$group' and subr_no_i='$subscribe'";
}
else
{
echo "Enter valid Group Name and Subscribtion number";
}
$result = mysql_query($q);
echo $q;
echo "<table class='TFtable' border ='1' align ='center' cellpadding='1' cellspacing='1' width='800' bgcolor='#FFFFFF' style='border:1px solid #0080FF;' >";
echo "<tr><th style='background:#58ACFA;'>S.No</th>
<th style='background:#58ACFA;'>Date</th>
<th style='background:#58ACFA;'>Name</th>
<th style='background:#58ACFA;'>Group Name</th>
<th style='background:#58ACFA;'>Subscribtion Number</th>
<th style='background:#58ACFA;'>Send Type</th>
<th style='background:#58ACFA;'>Result</th>
<th style='background:#58ACFA;'>Branch</th>
<th style='background:#58ACFA;'>Mobile</th><tr>";
$i=1;
while($row=mssql_fetch_assoc($result))
{
?>
<tr bgcolor="#CEF6F5">
<td align="center" style="padding-right:px;text-decoration:none;">
<?php echo $i;?>
</td>
<td align="center" style="padding-left:10px;text-decoration:none;">
<?php echo $row['send_date_d'];?>
</td>
<td align="center" style="padding-left:10px;text-decoration:none;">
<?php echo $row['subr_name_vc'];?>
</td>
<td align="center" style="padding-left:10px;text-decoration:none;">
<?php echo $row['grp_name_vc'];?>
</td>
<td align="center" style="padding-left:10px;text-decoration:none;">
<?php echo $row['subr_no_i'];?>
</td>
<td align="center" style="padding-left:10px;text-decoration:none;">
<?php echo $row['send_type_vc'];?>
</td>
<td align="center" style="padding-left:10px;text-decoration:none;">
<?php echo $row['result_vc'];?>
</td>
<td align="center" style="padding-left:10px;text-decoration:none;">
<?php echo $row['brn_id_vc'];?>
</td>
<td align="center" style="padding-left:10px;text-decoration:none;">
<?php echo $row['subr_mobile_vc'];?>
</td>
</tr>
<?php
$i++;
}
}
?>
</table>
</form>
</body>
`
Typo bei 'mssql_fetch_assoc' Es wäre' mysql_fetch_assoc' – Saty
nicht eigentlich mssql_fetch_assoc bin mit ... bedeutet SQL Server –
Dann 'mysql_query' ?? – Saty