Hi everybody,
I've been trying to find out what's wrong with my script, but after checking many posts and tutorials I still don't know what happens.
The script:
//..................update
if(isset($update_record)):
$db=mysql_connect("localhost","login","password");
mysql_select_db("articulos_ebcn",$db);
mysql_query("UPDATE arts_tabla WHERE id='$id2' SET heading='$heading' body='$body'");
echo"<p><h3>Records have been updated</h3>";
mysql_close ($db);
endif;
//...................delete
if(isset($delete_record)):
$db=mysql_connect("localhost","login","password");
mysql_select_db("articulos_ebcn",$db);
mysql_query("DELETE FROM $arts_tabla WHERE id='$id2'");
echo"Records have been deleted";
mysql_close ($db);
endif;
And the vars come from this part of the script:
If(isset($id)):
$db=mysql_connect("localhost","login","password");
mysql_select_db("articulos_ebcn",$db);
$sql="select * from arts_tabla where id like '%$id%'";
$result_busc=mysql_query($sql,$db);
while ($row=mysql_fetch_array($result_busc)){
echo "<TABLE BORDER='0' ALIGN='center' WIDTH='100%' bgcolor='#FFE3B9'><tr><td align='center'>";
printf("<form action='editar_articulos.php?id2=".$id."' method='post'>");
printf("<textarea class=\"caja_admin\" cols=\"120\" name=\"heading\" rows=\"1\">%s</textarea><p>" , $row["heading"]);
printf("<textarea class=\"caja_admin\" cols=\"140\" name=\"body\" rows=\"90\">%s</textarea><p>" , $row["body"]);
printf("Id:<input type='text' class='caja_admin' name='id2' readonly value='".$id."'><p>");
printf("<input type=\"submit\" class=\"boton_actu\" name=\"update_record\" value=\"update_record\">");
printf("<input type=\"submit\" class=\"boton_delete\" name=\"delete_record\" value=\"delete_record\"><p></td></tr>");
//printf("<td class=\"salida_body\" WIDTH=\"75\" align=\"center\">%s</textarea></tr>" , $row["id"]);
printf("<tr><td class=\"salida_body\"> </td></tr>");
echo("</table>");
}
mysql_close ($db);
endif;
It seems to be okay...
I'm working with php4.1.2, mysql3.23.38, Apache HTTP server 1.3
and my database account have all privileges set to yes.
Thank you for your help!!!