Karyna Posted October 24, 2012 Share Posted October 24, 2012 im designin an "e-bay" like site and i need to do a page where administrator can activate or deactivate some pods.. so far im doing ok.. but have soe trouble with that page.. heres y code... the administrator writes de code of the post and click the button to search 4 it.. it fouds and then click a 2nd button to activate it means write an "1" in a field called "activo"... BUT IT DOESNT... <?php if(isset($_POST['button_a'])){ $lacla = $_POST['anucod']; mysql_query("UPDATE anuncios SET activo=1 WHERE clave='$lacla'") or die(mysql_error()); } ?> <?php if(isset($_POST['button'])){ $lacla = $_POST['anucod']; $lacla2=trim('$lacla'); mysql_select_db($database_clasif, $clasif); $cuerye="select * from anuncios where clave='$lacla'"; $result = mysql_query($cuerye) or die(mysql_error()); $row_anuncios = mysql_fetch_assoc($result); $totalRows_anuncios = mysql_num_rows($result); if (mysql_num_rows($result) > 0) { //User exists ?> <form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p> <input type="text" name="anucod" id="anucod" /> <input type="submit" name="button_a" id="button_a" value="ACTIVATE POST" /> </p> <?php echo "<br>"; echo "<br>"; echo "<br>"; echo "<br>"; echo "<br>________________________________________________________"; ?> </form> <?php } else { //User does not exist echo '0'; } } ?> <form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p> <input type="text" name="anucod" id="anucod" /> <input type="submit" name="button" id="button" value="enter post code..." /> </p> </form> </body> Link to comment https://forums.phpfreaks.com/topic/269870-help-pls-find-update/ Share on other sites More sharing options...
MDCode Posted October 24, 2012 Share Posted October 24, 2012 Repost your php within the tags And I spot your problem right away...you're not connecting to the database where you need it to update. Link to comment https://forums.phpfreaks.com/topic/269870-help-pls-find-update/#findComment-1387530 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.