Ir para conteúdo
Fórum Script Brasil

naldo_10

Membros
  • Total de itens

    54
  • Registro em

  • Última visita

Tudo que naldo_10 postou

  1. não aparece nada , mas é que isso num é erro a pagina lista os usuarios perfeitamento mas aprece essa notificação notice: undefined index where quero saber como definir essse where
  2. continua assim amigo Notice: Undefined variable: f o select ta problematico ajua eu ai o input da date deu certinho brigado
  3. Notice: Undefined index: where in C:\wamp\www\cursos\prophp\projeto\admin\users\usuarios.php on line 66 qual erro aqui ? $readUser = read('up_users',"WHERE id != '$userId' {$_SESSION['where']} LIMIT $inicio,$maximo"); readPaginator('up_users',"WHERE id != '$userId' {$_SESSION['where']}", $maximo, $link, $pag); CODIGO COMPLETO: <?php if (!function_exists('getUser')): header('Location: ../index2.php'); endif; ?> <?php if ( getUser($_SESSION['autUser']['id'], '1') ): ?> <?php $userId = $_SESSION['autUser']['id']; if(isset($_POST['sendFiltro'])){ $search = $_POST['search']; if(!empty($search) && $search != 'nome:'){ $_SESSION['where'] = "AND nome LIKE '%$search%'"; header('Location: index2.php?exe=users/usuarios'); }else{ unset ($_SESSION['where']); header('Location: index2.php?exe=users/usuarios'); } } ?> <div class="bloco user" style="display:block"> <div class="titulo">Usuários: <form name="filtro" action="" method="post"> <label> <input type="text" name="search" class="radius" size="30" value="Nome:" onclick="if(this.value=='Nome:')this.value=''" onblur="if(this.value=='')this.value='Nome:'" /> </label> <input type="submit" value="filtrar resultados" name="sendFiltro" class="btn" /> </form> </div> <?php if(!empty($_GET['deluser'])){ $delUserId = $_GET['deluser']; $readDelUser = read('up_users',"WHERE id = '$delUserId'"); if(!$readDelUser){ echo '<span class="ms no">usuario não existe !</span>'; }else{ foreach($readDelUser as $delUser); if($delUser['id'] == $userId) { echo '<span class="ms no">erro voce não pode remover seu perfil!</span>'; }elseif($delUser['nivel'] == '1'){ echo '<span class="ms no">erro voce não pode remover administrador!</span>'; }else{ echo '<span class="ms al">atenção voce esta excluindo o usuario <strong>'.strtoupper($delUser['nome']).'</strong>. [ <a href="index2.php?exe=users/usuarios" title="não">não</a> ] , [ <a href="index2.php?exe=users/usuarios&delusertrue='.$delUser['id'].'" title="sim">sim</a> ]</span>'; } } } if(!empty($_GET['delusertrue'])){ $delUserTrue = $_GET['delusertrue']; delete('up_users',"id = '$delUserTrue'"); header('Location: index2.php?exe=users/usuarios'); } $pag = (empty($_GET['pag']) ? '1' : $_GET['pag']); $maximo = 2; $inicio = ($pag * $maximo) - $maximo; $readUser = read('up_users',"WHERE id != '$userId' {$_SESSION['where']} ORDER BY nivel ASC, nome ASC LIMIT $inicio,$maximo"); if(!$readUser){ echo '<span class="ms in">não existem usuarios!</span>'; }else{ echo'<table width="560" border="0" class="tbdados" style="float:left;" cellspacing="0" cellpadding="0"> <tr class="ses"> <td align="center">#id</td> <td>nome:</td> <td>email:</td> <td align="center">nível:</td> <td align="center" colspan="3">ações:</td> </tr>'; foreach($readUser as $user): $nivel = ($user['nivel'] == '1' ? 'Admin' : ($user['nivel'] == '2' ? 'Editor' : ($user['nivel'] == '3' ? 'Premium' : 'Leitor'))); echo'<tr>'; echo'<td align="center"><title="usuário">'.$user['id'].'</td>'; echo'<td>'.$user['nome'].'</td>'; echo'<td>'.$user['email'].'</td>'; echo'<td align="center">'.$nivel.'</td>'; echo' <td align="center"><a href="index2.php?exe=users/usuarios-edit&userid='.$user['id'].'" title="editar"><img src="ico/edit.png" alt="editar" title="editar" /></a></td>'; echo'<td align="center"><a href="index2.php?exe=users/usuarios&deluser='.$user['id'].'" title="excluir"><img src="ico/no.png" alt="editar" title="excluir" /></a></td>'; echo'</tr>'; endforeach; echo'</table>'; $link = 'index2.php?exe=posts/posts&pag='; readPaginator('up_users',"{$_SESSION['where']} ORDER BY nivel ASC", $maximo, $link, $pag); } ?> </div><!-- /bloco user --> <?php /** * Ele não tem permissão */ else: echo '<span class="ms al">Desculpe,voce não tem permissão para gerenciar paginas!</span>'; endif; ?> </body> </html>
  4. assim com ese abaixo esta validado <input type="text" name="celular" class="formFone "value="<?php echo isset( $f['celular'] ) ? $f['celular'] : ""; ?>" /> queria saber como validar esses dois <option <?php if($f['nivel'] && $f['nivel'] == '4') echo 'selected="selected"';?>value="4">leitor</option> <input type="text" name="cadData" class="formDate" value="<?php if($f['date']) { echo $f['date']; }else{ echo date('d/m/y H:i:s'); }?>" /> =========codigo completo============= <?php if(function_exists(getUser)){ if(!getUser($_SESSION['autUser']['id'],'1')){ echo '<span class="ms al">Desculpe,voce não tem permissão para gerenciar usuarios!</span>'; }else{ ?> <div class="bloco form" style="display:block"> <div class="titulo">cadastrar usuario: <a href="index2.php?exe=users/usuarios" title="criar nova categoria" class="btn" style="float:right;">listar artigos</a> </div> <?php if(isset($_POST['sendForm'])){ $f['nome'] = strip_tags(trim(mysql_real_escape_string($_POST['nome']))); $f['cpf'] = strip_tags(trim(mysql_real_escape_string($_POST['cpf']))); $f['email'] = strip_tags(trim(mysql_real_escape_string($_POST['email']))); $f['code'] = strip_tags(trim(mysql_real_escape_string($_POST['senha']))); $f['senha'] = md5($f['code']); $f['rua'] = strip_tags(trim(mysql_real_escape_string($_POST['rua']))); $f['cidade'] = strip_tags(trim(mysql_real_escape_string($_POST['cidade']))); $f['cep'] = strip_tags(trim(mysql_real_escape_string($_POST['cep']))); $f['telefone'] = strip_tags(trim(mysql_real_escape_string($_POST['telefone']))); $f['celular'] = strip_tags(trim(mysql_real_escape_string($_POST['celular']))); $f['nivel'] = strip_tags(trim(mysql_real_escape_string($_POST['nivel']))); $f['statusS'] = strip_tags(trim(mysql_real_escape_string($_POST['status']))); $f['status'] = ($f['statusS'] == '1' ? $f['statusS'] : '0'); $f['date'] = strip_tags(trim(mysql_real_escape_string($_POST['cadData']))); $f['cadData'] = formDate($f['date']); // $f['avatar] = strip_tags(trim(mysql_real_escape_string($_POST['avatar']))); if(in_array('',$f)){ echo '<span class="ms in">voce deixou campos em branco!</span>'; } elseif(!valMail($f['email'])){ echo '<span class="ms al">email informado nãotem formato valido!</span>'; } elseif(strlen($f['code']) < 8 || strlen($f['code']) > 12){ echo '<span class="ms no">senha deve ter 8 e 12 caracteres</span>'; }else{ $readUserMail = read('up_users',"WHERE email = '$f[email]'"); $readUserCpf = read('up_users',"WHERE cpf = '$f[cpf]'"); if($readUserMail ){ echo '<span class="ms al">erro voce não pode cadastrar 2 usuario com mesmo email!</span>'; } elseif($readUserCpf){ echo '<span class="ms al">erro voce não pode cadastrar 2 usuario com mesmo cpf!</span>'; }else{ if(!empty($_FILES['avatar']['tmp_name'])){ $imagem = $_FILES['avatar']; $pasta = '../uploads/avatars/'; $tmp = $imagem['tmp_name']; $ext = substr($imagem['name'],-3); $ext = md5(time()).'.'.$ext; $f['avatar'] = $nome; uploadImage($tmp, $nome, '200', $pasta); } unset($f['date']); unset($f['statusS']); create('up_users',$f); echo '<span class="ms ok">usuario cadastrado com suscesso</span>'; unset($f); } } } ?> <form name="formulario" action="" method="post" enctype="multipart/form-data"> <label class="line"> <span class="data">nome:</span> <input type="text" name="nome" value="<?php echo isset( $f['nome'] ) ? $f['nome'] : ""; ?>" /> </label> <label class="line"> <span class="data">cpf:</span> <input type="text" name="cpf" value="<?php echo isset( $f['cpf'] ) ? $f['cpf'] : ""; ?>" /> </label> <label class="line"> <span class="data">email:</span> <input type="text" name="email" value="<?php echo isset( $f['email'] ) ? $f['email'] : ""; ?>" /> </label> <label class="line"> <span class="data">senha:</span> <input type="password" name="senha" value="<?php echo isset( $f['senha'] ) ? $f['senha'] : ""; ?>" /> </label> <label class="line"> <span class="data">rua, numero:</span> <input type="text" name="rua" value="<?php echo isset( $f['rua'] ) ? $f['rua'] : ""; ?>" /> </label> <label class="line"> <span class="data">cidade uf:</span> <input type="text" name="cidade" value="<?php echo isset( $f['cidade'] ) ? $f['cidade'] : ""; ?>" /> </label> <label class="line"> <span class="data">cep:</span> <input type="text" name="cep"class="formCep " value="<?php echo isset( $f['cep'] ) ? $f['cep'] : ""; ?>" /> </label> <label class="line"> <span class="data">telefone:</span> <input type="text" name="telefone" class="formFone" value="<?php echo isset( $f['telefone'] ) ? $f['telefone'] : ""; ?>" /> </label> <label class="line"> <span class="data">celular:</span> <input type="text" name="celular" class="formFone "value="<?php echo isset( $f['celular'] ) ? $f['celular'] : ""; ?>" /> </label> <label class="line"> <span class="data">Avatar:</span> <input type="file" class="fileinput" name="avatar" size="60" style="cursor:pointer; background:#FFF;" /> </label> <label class="line"> <select name="nivel"> <option value="">Selecione nivel deste usuario &nbsp;&nbsp;</option> <option <?php if($f['nivel'] && $f['nivel'] == '4') echo 'selected="selected"';?>value="4">leitor&nbsp;</option> <option <?php if($f['nivel'] && $f['nivel'] == '3') echo 'selected="selected"';?>value="3">leitor&nbsp;</option> <option <?php if($f['nivel'] && $f['nivel'] == '2') echo 'selected="selected"';?>value="2">leitor&nbsp;</option> <option <?php if($f['nivel'] && $f['nivel'] == '1') echo 'selected="selected"';?>value="1">leitor&nbsp;</option> </select> </label> <label class="line"> <select name="status"> <option <?php if($f['statusS'] && $f['statusS'] == '1') echo 'selected="selected"';?>value="1">ativo&nbsp;</option> <option <?php if($f['statusS'] && $f['statusS'] == '1') echo 'selected="selected"';?>value="-1">inativo&nbsp;</option> </select> </label> <label class="line"> <span class="data">data cadastro:</span> <input type="text" name="cadData" class="formDate" value="<?php if($f['date']) { echo $f['date']; }else{ echo date('d/m/y H:i:s'); }?>" /> </label> <input type="submit" value="cadastrar novo usuario" name="sendForm" class="btn" /> </form> </div><!-- /bloco form --> <?php } }else{ header('Location: ../index2.php'); } ?> </body> </html>
  5. acho que sim CAR_QUANTIDADE` int(11) DEFAULT NULL, tem como você me explicar como mudar isso moço?
  6. Esse codigo só deixa adicionar o produto uma vez no carrinho teria como muda-lo para que ele venha somar e alterar quantidade no carrinho e deixe adicionar omesmo produto mais de uma vez ao clicar ? function incluir_no_carrinho($codigo_produto) { $sql_produto = "select * from tbl_produto where PROD_CODIGO = ".$codigo_produto; $this->resultado_prod = $this->con->banco->Execute($sql_produto); $this->registro_prod = $this->resultado_prod->FetchNextObject(); $sql_carrinho = "insert into tbl_carrinho (PROD_CODIGO, CAR_SESSAO, CAR_QUANTIDADE, CAR_VALOR, CAR_DATA) values (".$codigo_produto.",'".session_id()."',1,".$this->registro_prod->PROD_VALOR.",'".date('Y-m-d')."')"; if($this->resultado_car = $this->con->banco->Execute($sql_carrinho)) { alerta('produto inserido no carrinho com sucesso'); return true; } else { alerta('erro ao tentar inserir no carrinho'); return false; } } -- -- Estrutura da tabela `tbl_carrinho` -- CREATE TABLE IF NOT EXISTS `tbl_carrinho` ( `PROD_CODIGO` int(11) NOT NULL, `CAR_SESSAO` varchar(60) NOT NULL, `CAR_QUANTIDADE` int(11) DEFAULT NULL, `CAR_VALOR` decimal(15,2) DEFAULT NULL, `CAR_DATA` date DEFAULT NULL, PRIMARY KEY (`PROD_CODIGO`,`CAR_SESSAO`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; --
  7. construi uma loja codigo simples para boleto e pagseguro posso utilizar esse codigo na net p/q sera apenas pagamento boleto e pagseguro e loja pequena , ou sera que tem avançado e seguro? E o que pode acontecer se o codigo do site for simples?
  8. exibe .php seria uma popup 600largura e 400 altura echo '<div class="categoria"><a href="exibe.php?id='.$mostrar["id"].'"><img src=mulheres/'.$mostrar["foto].'" width="120" height="90" class="thumbnail" /></a></div>';
  9. eu queria que esses 2 tipos de echos tivessse image porque quero fazer display de image dai teria que por o <img src no echo com link para pagina detalhes.php passando a id para pagina detalhes.php echo $row['foto'].'<br />'; echo "$page_result[foto] <br />";
  10. tenho aqui 2 selects um para categoria mostra todos produtos e outro para subcategoria já coloquei o LIMIT mas não consigo colocar outro select e fazer funcionar já que vai paginar categoria e subcategoria ajuda por favor <?php $pag = "$_GET[pag]"; if($pag >= '1'){ $pag = $pag; }else{ $pag = '1'; } $maximo = '2'; //RESULTADOS POR PÁGINA $inicio = ($pag*$maximo) - $maximo; $sql = "SELECT * FROM categoria WHERE id_categoria = '$id_cat'"; $qry = mysql_query($sql); $linha = mysql_fetch_array($qry); echo "<div class=\"titulo\"> $linha[categoria]"; if ($id_subcat != ""){ $sql = "SELECT * FROM subcategoria WHERE id_subcategoria = '$id_subcat'"; $qry = mysql_query($sql); $linha = mysql_fetch_array($qry); echo " - $linha[subcategoria] </div>"; } ?> <br/> <?php if ($id_subcat != "") { $sql_prod = "SELECT s.*, p.* FROM subcategoria s, produto p WHERE s.id_subcategoria = p.id_subcategoria and p.id_subcategoria = '$id_subcat' LIMIT $inicio, $maximo"; } else $sql_prod = "SELECT c.*, p. * FROM categoria c, produto p WHERE c.id_categoria = p.id_categoria and p.id_categoria = '$id_cat' LIMIT $inicio, $maximo"; $qry_prod = mysql_query($sql_prod); $qtde_registro = mysql_num_rows($qry_prod);?> <div class="titulo"> Quantidade dos produtos: <?php echo $qtde_registro ?> </div> <?php while ($array_galeria = mysql_fetch_array($qry_prod)) { ?> <div class="categoria"> <a href="index.php?topicos=nav/single&amp;tópico=<?php echo $id;?>"><img src="fotos/<? echo $array_galeria[foto];?>" width="150" height="150" border="0" /></a> <p><?php echo $array_galeria[produto]; ?> </div> <?php } ?> <?php $paginas = ceil($total/$maximo); $links = '5'; //QUANTIDADE DE LINKS NO PAGINATOR echo "<a href=\"index.php?topicos=nav/search&amp;pesquisa=$pesquisa&amp;pag=1\">Primeira Página</a>&nbsp;&nbsp;&nbsp;"; for ($i = $pag-$links; $i <= $pag-1; $i++){ if ($i <= 0){ }else{ echo"<a href=\"index.php?topicos=nav/search&amp;pesquisa=$pesquisa&amp;pag=$i\">$i</a>&nbsp;&nbsp;&nbsp;"; } }echo "$pag &nbsp;&nbsp;&nbsp;"; for($i = $pag +1; $i <= $pag+$links; $i++){ if($i > $paginas){ }else{ echo "<a href=\"index.php?topicos=nav/search&amp;pesquisa=$pesquisa&amp;pag=$i\">$i</a>&nbsp;&nbsp;&nbsp;"; } } echo "<a href=\"index.php?topicos=nav/search&amp;pesquisa=$pesquisa&amp;pag=$paginas\">Última página</a>&nbsp;&nbsp;&nbsp;"; ?> </div><!--paginator--> </div> <!--page--> </div><!--page content-->
  11. naldo_10

    montar select com LIMIT

    EU ESQUECI DO = '$id_cat'"; $sql_prod = "SELECT c.*, p. * FROM categoria c, produto p WHERE c.id_categoria = p.id_categoria and p.id_categoria = '$id_cat'"; EU ESQUECI DO = '$id_cat'"; $sql_prod = "SELECT c.*, p. * FROM categoria c, produto p WHERE c.id_categoria = p.id_categoria and p.id_categoria = '$id_cat'";
  12. como ficaria esse sql abaixo se eu quisessse estabelecer LIMIT usando essas variaveis $maximo $inicio aqui abaixo: $maximo = '4'; //RESULTADOS POR PÁGINA $inicio = ($pag*$maximo) - $maximo; ?> $sql_prod = "SELECT c.*, p. * FROM categoria c, produto p WHERE c.id_categoria = p.id_categoria and p.id_categoria = '$id_cat'";
  13. Como insiro uma classe nesse link: echo "<a href = \" index.php?link=2&id_cat=$linha_sub[id_categoria]&id_subcat=$linha_sub[id_subcategoria]\">- $linha_sub[subcategoria]($quantidade)</a> ?
  14. <table border="0" align="center" cellpadding="1" cellspacing="0"> <? // Agora vamos montar o c&oacute;digo. Pegue o valor total de resultados: $total = mysql_num_rows($limite); // Defina o n&uacute;mero de colunas que voc&ecirc; deseja exibir: $colunas = "3"; //$colunas = "$qts_colunas"; // Agora vamos ao "truque": if ($total>0) { for ($i = 0; $i < $total; $i++) { if (($i%$colunas)==0) { $colspan = $colunas+$colunas+$colunas; ?> <tr> <? }?> <? $dados= mysql_fetch_array($limite) ; $data = explode("-", $dados[data]); $novadata = "$data[2]/$data[1]/$data[0]"; ?> <td align=center" valign="top"> <table width="100%" border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="#999999"> <tr> <td width="60"><a href="janela.php?id=<?php echo $dados['id]; ?> "><img src="mulheres/<?php echo $dados['foto'];?>" width="120" height="90" /></a></td> </tr> <tr> <td bgcolor="#0099CC"><?php echo $dados[nome]; ?></td> </tr> </table></td> <? }?> </TR> <? }?> </table>
  15. queria saber com construir isso no css tipo div id com 600px eas class left center e right com 200px cada uma
  16. como eu faria um display de 3 colunas sem table numa div sem usar table display de image
  17. Parse error: syntax error, unexpected T_STRING in C:\SERVER\www\source\admin\library\config.php on line 17 1. <?php 2. ini_set('display_errors', 'On'); 3. //ob_start("ob_gzhandler"); 4. error_reporting(E_ALL); 5. 6. // start the session 7. session_start(); 8. 9. // database connection config 10. $dbHost = 'localhost'; 11. $dbUser = 'mark1471_michton'; 12. $dbPass = 'nottelling; 13. $dbName = 'mark1471_plaincart'; 14. 15. // setting up the web root and server root for 16. // this shopping cart application 17. $thisFile = str_replace('\\', '/', __FILE__); 18. $docRoot = $_SERVER['DOCUMENT_ROOT']; 19. 20. $webRoot = str_replace(array($docRoot, 'library/config.php'), '', $thisFile); 21. $srvRoot = str_replace('library/config.php', '', $thisFile); 22. 23. define('WEB_ROOT', $webRoot); 24. define('SRV_ROOT', $srvRoot); 25. 26. // these are the directories where we will store all 27. // category and product images 28. define('CATEGORY_IMAGE_DIR', 'images/category/'); 29. define('PRODUCT_IMAGE_DIR', 'images/product/'); 30. 31. // some size limitation for the category 32. // and product images 33. 34. // all category image width must not 35. // exceed 220 pixels 36. define('MAX_CATEGORY_IMAGE_WIDTH', 110); 37. 38. // do we need to limit the product image width? 39. // setting this value to 'true' is recommended 40. define('LIMIT_PRODUCT_WIDTH', true); 41. 42. // maximum width for all product image 43. define('MAX_PRODUCT_IMAGE_WIDTH', 300); 44. 45. // the width for product thumbnail 46. define('THUMBNAIL_WIDTH', 110); 47. 48. if (!get_magic_quotes_gpc()) { 49. if (isset($_POST)) { 50. foreach ($_POST as $key => $value) { 51. $_POST[$key] = trim(addslashes($value)); 52. } 53. } 54. 55. if (isset($_GET)) { 56. foreach ($_GET as $key => $value) { 57. $_GET[$key] = trim(addslashes($value)); 58. } 59. } 60. } 61. 62. // since all page will require a database access 63. // and the common library is also used by all 64. // it's logical to load these library here 65. require_once 'database.php'; 66. require_once 'common.php'; 67. 68. // get the shop configuration ( name, addres, etc ), all page need it 69. $shopConfig = getShopConfig(); 70. ?>
  18. essa é a pagina que visualiza a image agora gostaria de dar um next e prev na id é mais ou menos isso que ta aí abaixo pessoal ? p/q ela não da errro mas os botoes anterior e proximo não funciona. <? $host = "localhost"; $usuario = "root"; $senha = ""; $db= mysql_connect($host,$usuario,$senha) or die ("não foi posssivel conectar ao servidor"); mysql_select_db("banco",$db) or die ("não foi possivel conectar "); $id = $_GET[id]; $pg=$_GET[pg]; $page=$_GET ; if(!$page){ $page = "1"; } $sql = mysql_query("SELECT * FROM gallery where id=$id'"); $dados= mysql_fetch_array($sql); ?> <img src="mulheres/<?php echo $dados['foto];?>" width="450" height="350" /> <table border="0" align="center" cellpadding="0" cellspacing="0"> <TR> <TD width="100" align="right" valign="top"> <? if($page > 1){ $anterior = $page -1; $url = "?pg=$pg&page=$anterior"; echo "<a href='$url'>« Anterior</a>&nbsp;|"; } else { echo "<font color='$corcelula2'>« Anterior</font>&nbsp;|"; } ?> </TD> <TD align="center"> <? for($x=1; $x<=$tp; $x++){ $url = "?pg=$pg&page=$x"; if ($x==$page) { echo "<font color='$coronmouse'><b>$x</b></font>|"; } else { echo "<a href='$url'>$x</a>|"; } } ?> </TD> <TD width="100" align="left" valign="top"> <? if($tp > $page){ $proxima = $page +1; $url = "?pg=$pg&page=$proxima"; echo "&nbsp;<a href='$url'>Próxima »</a>"; } else { echo "&nbsp;<font color='$corcelula2'>Próxima »</font>"; } ?> </TD> </TR> </table>
  19. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\WEB\www\Comunidadeweb\categorias.php on line 67 <?php include "conexao.php"; $id_cat = $_GET["id_cat"]; $id_subcat = $_GET["id_subcat"]; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; } --> </style></head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top"><?php $sql = "SELECT * FROM categoria WHERE id_categoria = '$id_cat'"; $qry = mysql_query($sql); $linha = mysql_fetch_array($qry); echo "<b> $linha[categoria] </b>"; if ($id_subcat !=""){ $sql = "SELECT * FROM subcategoria WHERE id_subcategoria = '$id_subcat'"; $qry = mysql_query($sql); $linha = mysql_fetch_array($qry); echo "<b> - $linha[subcategoria] </b>"; }?> <img src width="100%" height="5"/> <br/> <?php if ($id_subcat !="") { $sql_prod = "SELECT s.*,p.* FROM subcategoria s, produto p WHERE s. id_subcategoria = p.id_subcategoria and p.id_subcategoria = '$id_subcat'"; } else { $sql_prod = "SELECT c.*,p.* FROM categoria c, produto p WHERE c. id_categoria = p.id_categoria and p.id_produto = '$id_cat'"; } $qry_prod = mysql_query($sql_prod); $qtde_registro = mysql_num_rows($qry_prod); $i = 0; //inicio paginação if ($pagina=="") { $pagina=1; } $maximo= 2; $inicio = $pagina - 1; $inicio = $maximo*$inicio; $novo_sql = $sql_prod." ORDER BY p.id_produto DESC LIMIT $inicio, $maximo"; $cunsulta = mysql_query($novo_sql); $produto_por_pagina = mysql_num_rows($consulta); //fim paginação ?> Quantidade dos produtos: <?php echo $qtde_registro ?> </p> <img src width="100%" height="5"/> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <?php $sql_geral = mysql_query($novo_sql); while ($i < $produto_por_pagina) { ?> <td width="50%"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="2" valign="top"><?php echo "<img src = admin/fotos/".@mysql_result($sql_geral,$I,foto)." width= 100 height= 80 border= 0 />"; ?><br><?php echo @mysql_result($sql_geral,0,produto); ?> </td> </tr> <tr> <td width="27%"><form id="form1" name="form1" method="post" action=""> <img src="imagens/comprar.jpg" width="73" height="17" /> </form> </td> <td width="73%"><img src="imagens/detalhes.jpg" width="73" height="17" /></td> </tr> </table></td> <?php $i++; if ($i%2==0) echo "</tr>"; }?> </tr> </table> <?php //serve para voltar pagina $menos = $pagina-1; $mais = $pagina+1; $p_ini = $mais-1; $p_ini = $maximo*$p_ini; $pg_sql = $sql." LIMIT $p_ini, $maximo"; $consulta_pag = mysql_query($pg_sql); $p_total = mysql_num_rows($consulta_pag); $p=1; $pgs = $qtde_registro/$maximo; $formatado = number_format($pgs); if ($formatado <$pgs) { $formatado = $formatado+1; } echo "<p align=right> "; while ($p<= $formatado) { if ($pagina == $p) { echo "<b>$p</b> "; } else { echo "<a href = \"index.php?link=2&id_cat=&id_cat&id_subcat=id_subcat&pagina=$p\">$p</a><font color = '#3366cc'>|</font>"; } $p++; } ?> </td> </tr> </table> </body> </html>
  20. tenho a outra pagina que tem 1 botão para alterar e excluir quando clico em um deles no select aparece a categoria e no text_subcategoria aparece em qual subcategoria ele ta para a pessoa poder comfirmar <?php include "conexao.php"; ?> <?php $acao = $_GET["acao"]; $id = $_GET["id"]; if ($acao != "") { $sql = "SELECT C.*, S.* FROM categoria C, subcategoria S WHERE c.id_categoria = S.id_categoria and id_subcategoria = '$id'"; $qry = mysql_query ($sql); $linha = mysql_fetch_array($qry); $subcategoria = $linha[subcategoria]; $id_categoria = $linha[id_categoria]; } ?> <title>Untitled Document</title> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><div align="center">Cadastro de subcategorias </div></td> </tr> <tr> <td><form id="form1" name="form1" method="post" action="op_subcategoria.php"> <table width="324" border="1" align="center" cellpadding="0" cellspacing="0"> <tr> <td>Categoria</td> <td><label> <select name="id_categoria" id="id_categoria"> <option>seleciona categoria </option> <?php $sql = "SELECT * FROM categoria ORDER BY categoria"; $qry = mysql_query($sql); while ($linha = mysql_fetch_array(sqry)){ $valor = $linha[id_categoria]; if ($id_categoria = $valor) { $selecionado = "selected"; } else { $selecionado =""; } echo "<option value = \"$valor\" $selecionado > $linha[categoria] </option>"; } ?> </select> </label></td> </tr> <tr> <td width="67">SubCategoria</td> <td width="251"><label> <input name="txt_subcategoria" type="text" id="txt_subcategoria" value="<?php echo $linha[subcategoria]; ?>" size="35" /> </label></td> </tr> <tr> <td>&nbsp;</td> <td><label> <div align="center"> <input type="submit" name="Submit" value="<?php if($acao !="") {echo $acao;} else { echo "Inserir";} ?>" /> <input name="acao" type="hidden" id="acao" value="<?php if($acao !="") {echo $acao;} else { echo "Inserir";}?>" /> <input name="id" type="hidden" id="id" value="<?php echo $id; ?>" /> <input name="id_categoria" type="hidden" id="id_categoria" value="<?php echo id_categoria;?>" /> </div> </label></td> </tr> </table> </form> </td> </tr> <tr> <td>&nbsp;</td> </tr> </table> </body> </html>
  21. <?php require ('conexao.php'); $sql = mysql_query("SELECT * FROM gallery"); ?> <table width="128" border="1" align="center" cellpadding="1" cellspacing="1" bordercolor="#333333"> <?php $total = mysql_num_rows($sql); $colunas = 4; if ($total>0) { for ($i = 0; $i < $total; $i++) { if (($i%$colunas)==0) { ?> <tr> <?php }?> <?php $dados= mysql_fetch_array($sql) ; $nome = $dados['nome']; ?><td width=206" bordercolor="2" cellpadding="1" cellspacing="1"> <?php if($dados['nome] != ""){?> <?php }?> <a href="produto.php?id=<?php echo $dados['id']; ?> "><img src=imagens/uploads/<?php echo $dados['foto]; ?>.jpg"></a></tr> <?php }} ?> </tr> </table>
  22. e como ficaria se eu colocar um ( echo ) no lugar de print ? ---------------- e se for para colocar uma image aqui como ficaria ? nesse print print"<td align=center>"; print "$resul"; // retorna o resultado. print"</td>"; ------------------------------
  23. e como ficaria se eu colocar um ( echo ) no lugar de print ?
×
×
  • Criar Novo...