Tienes razon, perdona, pero es que es algo tan simple que...
te pongo todo el codigo:
Código PHP:
Ver original$txt_consulta = "CREATE PROCEDURE comprobar()
BEGIN
DECLARE numzona INT;
DECLARE totalnum INT;
DECLARE numero INT;
DECLARE alea INT;
SET numero = (SELECT COUNT(*) FROM principal WHERE zona IS NOT NULL);
IF numero < 800 THEN
SET alea = 1 + FLOOR(RAND()*16);
SELECT zona,n1,n2 FROM principal WHERE zona = alea;
ELSEIF numero = 1600 THEN
SELECT 'Lleno.';
ELSE
SELECT zona, COUNT(*) AS user FROM principal GROUP BY zona ORDER BY user asc LIMIT 1 INTO numzona, totalnum;
SELECT zona,n1,n2 FROM principal WHERE zona = numzona;
END IF;
END;";
$txt_consulta = "CALL comprobar();";
$newname = ...;
$newmail = ...;
FROM registros
WHERE nombre = '$newname' OR email = '$newmail'",$conexion);
El SP funciona por separado, tb el SELECT, pero en este orden no funcionan, dando el warning:
mysql_fetch_array() expects parameter 1 to be resource, boolean ...