Jump to content
Fórum Script Brasil
  • 0

Não exclui registro


Michel Orth

Question

opa... galera programo em java php não entendo nada... to comm uma tela aki que quando mando exclui um registro ele não exclui nem me da erro algum... alguém pode me ajudar

<?
   
    include "../lib/config.inc.php";
    include "../lib/func.inc.php";
    include "../lib/classes.inc.php";
    require_once '../lang/'.$idioma.'.php';
    header("Content-type: text/html; charset=ISO-8859-1", true);
    if(!checklog()) {
        echo '&lt;script>Ajax("wallpapers/index", "conteudo", "");</script>';
        die();
    }
    if(!verifica_nivel('laboratorios', 'L')) {
        echo $LANG['general']['you_tried_to_access_a_restricted_area'];
        die();
    }
        
    if($_GET[confirm_del] == "delete") {
        mysql_query("DELETE FROM `laboratorios` WHERE `codigo` = '".$_GET[codigo]."'") or die(mysql_error());
    }
?>
<div class="conteudo" id="conteudo_central">
  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="conteudo">
    <tr>
      <td width="48%">   <img src="laboratorio/img/laboratorio.png" alt="<?=$LANG['laboratory']['manage_laboratories']?>"> <span class="h3"><?=$LANG['laboratory']['manage_laboratories']?> </span></td>
      <td width="21%" valign="bottom">
        <table width="100%" border="0">
            <tr>
              <td colspan="2">
             <?=$LANG['laboratory']['search_for']?>
            </td>
          </tr>
          <tr>
            <td>
                <select name="campo" id="campo" class="forms">
                  <option value="nomefantasia"><?=$LANG['laboratory']['name']?></option>
                  <option value="cidade"><?=$LANG['laboratory']['city']?></option>
                </select>
              </td>
              <td>
                <input name="procurar" id="procurar" type="text" class="forms" size="20" maxlength="40" onkeyup="java script:Ajax('laboratorio/pesquisa', 'pesquisa', 'pesquisa='%2Bthis.value%2B'&campo='%2BgetElementById('campo').options[getElementById('campo').selectedIndex].value)">
              </td>
            </tr>
          </table>
      </td>
      <td width="27%" align="right" valign="bottom"><?=((verifica_nivel('laboratorios', 'I'))?'<img src="imagens/icones/novo.gif" alt="Incluir" width="19" height="22" border="0"><a href="java script:Ajax(\'laboratorio/incluir\', \'conteudo\', \'\')">'.$LANG['laboratory']['include_new_laboratory'].'</a>':'')?></td>
      <td width="2%" valign="bottom"> </td>
      <td width="2%" valign="bottom"> </td>
    </tr>
  </table>
<div class="conteudo" id="table dados"><br>
  <table width="750" border="0" align="center" cellpadding="0" cellspacing="0" class="tabela_titulo">
    <tr>
      <td bgcolor="#009BE6" colspan="5"> </td>
    </tr>
    <tr>
      <td width="360" align="left"><?=$LANG['laboratory']['company']?></td>
      <td width="160" align="left"><?=$LANG['laboratory']['city_state']?></td>
      <td width="105" align="left"><?=$LANG['laboratory']['telephone']?></td>
      <td width="59" align="center"><?=$LANG['laboratory']['edit_view']?></td>
      <td width="66" align="center"><?=$LANG['laboratory']['delete']?></td>
    </tr>
  </table>  
  <div id="pesquisa"></div>
  &lt;script>
  document.getElementById('procurar').focus();
  Ajax('laboratorio/pesquisa', 'pesquisa', 'pesquisa=&campo=nomefantasia');
  </script>
</div>

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Nesta linha

if($_GET[confirm_del] == "delete") {
        mysql_query("DELETE FROM `laboratorios` WHERE `codigo` = '".$_GET[codigo]."'") or die(mysql_error());
    }
Depois de (mysql_error()); acrescente; echo $_GET[codigo]; se não aparecer nada é que você não está recebendo o código como parametro, ai será necessário você resgatá-lo, tipo;
$cod = $GET[codigo]; //obs. deveria ter uma aspas simples ['codigo'] ai você faz;
"DELETE FROM LABORATORIOS WHERE CODIGO = $COD";

Tenta ae.

Abs.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...