This weekend I formatted and reinstalled my computer: today when I try to continue working on some php pages I've been programming last weeks, when I execute the php code on the localhost server I get an:
"Notice: Undefined variable: consulta in D:\WEBS\WP\lbodas.php on line 42 1 de enero de 1970"
It's happening on all the php pages that perform an SQL query (wich worked perfectly before the reinstall).
I must be missing some configuration tweak (on php.ini, httpd.conf or some other apache configuration file), can somebody point me out what I'm missing?
Thanks in advance
Here is the code I'm using. To conect to the DDBB:
$bd_host='localhost';
$bd_login='MYLOGIN';
$bd_clave='MYPASSWORD';
$bd_nombre='MYDATABASE';
connecttodb($bd_host,$bd_nombre,$bd_login,$bd_clave);
function connecttodb($bd_host,$bd_nombre,$dbuser,$bd_clave)
{
global $conn;
$conn=mysql_connect ("$bd_host","$dbuser","$bd_clave");
mysql_query("SET NAMES 'utf8'");
if(!$conn){die("CONNECTION ERROR");}
//mysql_query("SET NAMES 'utf8'");
mysql_select_db("$bd_nombre",$conn) or die ("CONNECTION ERROR".mysql_error());
}
And one of the sql queries that used to work but after the reinstall doesn't work:
$sql = "SELECT * FROM cat_prov ORDER BY categoria ASC";
$rs_result = mysql_query ($sql, $conn);
while ($row = mysql_fetch_assoc($rs_result)) {
$categoria=$row["categoria"];
$notas=$row["notas"];
}
It's saying that the $row variable, wich holds the array with the results of the sql query, hasn't been defined... but two days ago, before the server OS reinstall I didn't have to define variables!!