<?php require_once('Connections/cnx.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_cnx, $cnx);
$query_rsPaises = "SELECT * FROM paises ORDER BY paisES ASC";
$rsPaises = mysql_query($query_rsPaises, $cnx) or die(mysql_error());
$row_rsPaises = mysql_fetch_assoc($rsPaises);
$totalRows_rsPaises = mysql_num_rows($rsPaises);
mysql_select_db($database_cnx, $cnx);
$query_rsUsuario = "SELECT * FROM empleados ORDER BY empleadoID DESC limit 0,1";
$rsUsuario = mysql_query($query_rsUsuario, $cnx) or die(mysql_error());
$row_rsUsuario = mysql_fetch_assoc($rsUsuario);
$totalRows_rsUsuario = mysql_num_rows($rsUsuario);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<select name="pais" id="pais">
<?php
do {
?>
<option value="<?php echo $row_rsPaises['paisID']?>"<?php if (!(strcmp($row_rsPaises['paisID'], $row_rsUsuario['paisID']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsPaises['paisES']?></option>
<?php
} while ($row_rsPaises = mysql_fetch_assoc($rsPaises));
$rows = mysql_num_rows($rsPaises);
if($rows > 0) {
mysql_data_seek($rsPaises, 0);
$row_rsPaises = mysql_fetch_assoc($rsPaises);
}
?>
</select>
</form>
</body>
</html>
<?php
mysql_free_result($rsPaises);
mysql_free_result($rsUsuario);
?>