me da error.
tengo esto:
Código:
function check_template($id_theme){
mysql_query("
DELIMITER $$
DROP FUNCTION IF EXISTS check_template$$
CREATE FUNTION check_template(id INT) RETURNS INTEGER
READS SQL DATA
BEGIN
DECLARE tema INT DEFAULT 0;
SELECT predeterminado INTO tema FROM themes WHERE id_theme=id;
RETURN tema;
END$$
DELIMITER ;
");
$resp = mysql_query("SELECT check_template(".$id_theme.") tt");
$row = mysql_fetch_array($resp);
echo $row['tt'];
}
hasta ahora lo relacionado a eso sin funcon es esto:
Código:
/*
$resp = mysql_query("SELECT COUNT(id_theme) total_themes FROM themes where id_theme=".$id_theme." AND predeterminado='1' LIMIT 1");
$row = mysql_fetch_array($resp);
if($row['total_themes']==1){
mysql_query("UPDATE themes SET predeterminado='1' where id_theme=1");
}
*/
pero quiero hacerlo con función. no se en qué me está dando error o si lo estoy llamando mal... hice lo del mysql_fetch_array para ver lo que me retornaba :/