First of all i'd like to say hello to everybody.
I've been working upon a script and i seem to be facing a problem with a mysql_query.
Here it goes:
I have 2 tables on my data base and there are some html forms through which tha data is entered in the tables. Also i got one html script as a search, where there are some radio buttons, with the same name and different value that allows the user to pick for which field he's going to give the critiria of searching.
On the php script that handles thw date i have written the above:
<html>
<?PHP
$critiria=$_POST;
$search=$_POST;
$con=mysql_connect('localhost','root','');
mysql_select_db('test',$con);
if($critiria=="epitheto_iatrou"){
$sql="SELECT * FROM doctors WHERE epitheto='$critiria'";
$result=mysql_query($sql,$con) or die(mysql_error());
while ($newarray=mysql_fetch_array($result)){
echo "Epitheto: $newarray[epitheto] <br>";
echo "Eidikotita: $newarray[eidikotita]<br>";
echo "Misthos: $newarray[misthos]<br>";
}
}
else if($critiria=="eidikotita"){
$sql="SELECT * FROM doctors WHERE eidikotita='$eidikotita'";
$result=mysql_query($sql,$con) or die(mysql_error());
while ($newarray=mysql_fetch_array($result)){
echo "Epitheto: $newarray[epitheto] <br>";
echo "Eidikotita: $newarray[eidikotita]<br>";
echo "Misthos: $newarray[misthos]<br>";
}
}
else if($critiria=="epitheto_patient"){
$sql="SELECT * FROM patients WHERE epitheto='$critiria'";
$result=mysql_query($sql,$con) or die(mysql_error());
while ($newarray=mysql_fetch_array($result)){
echo "Epitheto: $newarray[epitheto] <br>";
echo "Onoma: $newarray[onoma]<br>";
echo "id_doctor: $newarray[id_doctor]<br>";
echo "date: $newarray[date]<br>";
echo "poli: $newarray[poli]<br>";
}
}
else if ($critiria='poli'){
$sql="SELECT * FROM patients WHERE poli='$critiria'";
$result=mysql_query($sql,$con) or die(mysql_error());
while ($newarray=mysql_fetch_array($result)){
echo "Epitheto: $newarray[epitheto] <br>";
echo "Onoma: $newarray[onoma]<br>";
echo "id_doctor: $newarray[id_doctor]<br>";
echo "date: $newarray[date]<br>";
echo "poli: $newarray[poli]<br>";
}
}
else if ($critiria='date'){
$sql="SELECT * FROM patients WHERE date='$critiria'";
$result=mysql_query($sql,$con) or die(mysql_error());
while ($newarray=mysql_fetch_array($result)){
echo "Epitheto: $newarray[epitheto] <br>";
echo "Onoma: $newarray[onoma]<br>";
echo "id_doctor: $newarray[id_doctor]<br>";
echo "date: $newarray[date]<br>";
echo "poli: $newarray[poli]<br>";
}
}
?>
</html>
this script returns a blanc page AND without the if sentences, within which the mysql_query if created, the query returns the correct data.
Can you help me out?????
Best regards