Hola, estoy muy pez en esto, a pesar de que he visto varios vídeos y he leído varias páginas no lo tengo del todo claro, de todas formas he intentado hacerlo pero algo he hecho mal, no está funcionando además estoy recibiendo este error:
Warning: mysql_free_result() expects parameter 1 to be resource, null given in blocks.php on line 26
Estoy editando tanto el código form como el php en el mismo archivo (blocks.php) porque ya estoy acumulando demasiados archivos externos.
¿Alguien sabría decirme que he puesto mal? Muchas gracias.
Hay una tabla llamada blocks y lo que quiero es cambiar el valor de 'active' mediante un radiobutton yes/no que insertaría 1/0 depende de lo elegido:
Código:
id title content_file content_html language sort_order active
1 Next Events next_events english 1 1
2 Last Race last_race english 2 1
3 Standings standings english 3 1
Código PHP:
<? if(!defined("CONFIG")) exit();
if(!isset($login)) { show_error("You do not have administrator rights\n"); return; }
require_once("session_start.php");
?>
<!--Next events block-->
<h1>Next events</h1>
<form action="blocks.php" method="post">
Activate:
<input type="radio" name="active_next" <?php if (isset($active_next) && $active_next=="1") echo "checked";?> value="1">Yes
<input type="radio" name="active_next" <?php if (isset($active_next) && $active_next=="0") echo "checked";?> value="0">No
</b> </b> <input type="submit" name="submit_next" value="Set">
<br><br>
</form>
<?PHP
mysqlconnect();
if (isset($_POST['submit_next'])){
$query_next = "UPDATE blocks SET active='$active_next' WHERE content_file='$next_events'";
$result_next = mysql_query($query_next);
if(!$result_next) error("MySQL Error: " . mysql_error() . "\n");
return_do(".?page=blocks", "activated succesfully modified\n$msg");}
mysql_free_result($result_next)
?>