I have a project developed with PHP and mySQL, and I have a query that doesn't work in the PHP code, but when i try the same query on PHPmyAdmin it works without problems (it find results).
The code is the next:
$sqlD="SELECT Rut FROM tbl110_dotacion
WHERE Rut='$rut' AND FecTurno='$fecTurno'";
$requestD=mysqli_query($connect,$sqlD);
echo $sqlD,'--->';
while($rowx=mysqli_fetch_array($requestD)){
$RUTS=$rowx['Rut'];
echo $RUTS,'<br>';
}
The code should print the "rut" variable.
this is the connection, above the query
$server="localhost";
$user="andes";
$pass="password";
$DB="andes";
$connect=mysqli_connect($server, $user, $pass, $DB);
Table structure:
CREATE TABLE tbl110_dotacion`
( FecTurno varchar(10) DEFAULT NULL,
Rut varchar(11) DEFAULT NULL,
CodTurno varchar(5) DEFAULT NULL,
Ausencia varchar(9) DEFAULT NULL,
Atraso varchar(9) DEFAULT NULL,
Accidente varchar(9) DEFAULT NULL,
Enfermedad varchar(9) DEFAULT NULL,
HHEE varchar(9) DEFAULT NULL,
Policlinico varchar(5) DEFAULT NULL,
Ausentismo_RRHH varchar(5) DEFAULT NULL,
CodCargo varchar(5) DEFAULT NULL,
No_Colacion varchar(9) DEFAULT NULL,
seleccion varchar(5) DEFAULT NULL )
ENGINE=InnoDB DEFAULT CHARSET=utf8;