Hey guys,
I know that the query is not good, but i CANT see the problem.
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\XAMPP\xampp\htdocs\betania\modify.php on line 8
Could you please help me out?
<?php
include "connection.php";
if(!isset($_POST[submit])) {
$q = mysql_query("SELECT * FROM inscrieri WHERE id =".$_GET['id']."");
$result = mysql_query($q);
$person = mysql_fetch_array($result, MYSQL_ASSOC);
} else {
}
?>
<html>
<head>
<title>Modificare participant - Lunca Bradului 2010</title>
<style type="text/css">
#loginform {
border: 2px solid #500;
background-color: #90A4CA;
width: 300px;
text-align: left;
}
#loginform form {
margin: 5px;
}
#loginform label {
width: 100px;
float: left;
display: block;
clear: both;
}
#loginform label, input {
margin-bottom: 5px;
}
#loginform input {
background-color: #FFCC00;
border: 1px solid #CCC;
}
</style>
</head>
<body>
<center>
<div id="loginform">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<label>Nume:</label>
<input type="text" name="inputNume" id="nume" value="<?php echo $person[nume]; ?>">
<label>Prenume:</label>
<input type="text" name="inputPrenume" id="prenume" value="<?php echo $person[prenume]; ?>">
<label>Telefon:</label>
<input type="text" name="inputTelefon" id="telefon" value="<?php echo $person[telefon]; ?>">
<label>Email:</label>
<input type="text" name="inputMail" id="mail" value="<?php echo $person[mail]; ?>">
<label>Varsta:</label>
<input type="text" name="inputVarsta" id="varsta" value="<?php echo $person[varsta]; ?>">
<input type="hidden" name="id" value="<?php $_GET[id]; ?>"
<input type="submit" value="Modifica"/>
</form>
</div>
</center>
</body>
</html>
<?php
if(isset($_POST['submit'])) {
$update = "UPDATE inscrieri SET nume='$_POST[inputNume]', prenume='$_POST[inputPrenume]', telefon='$_POST[inputTelefon]', mail='$_POST[inputMail]', varsta='$_POST[inputVarsta]' WHERE id = $_POST[id]";
mysql_query($update) or die (mysql_error());
echo "Participantul a fost modificat!";
header("Location: index.php");
} else {
}
?>