Jump to content

Ezkiel

New Members
  • Posts

    9
  • Joined

  • Last visited

Ezkiel's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I want something like this http://postimage.org/image/6lq1a8xa1/
  2. Ginerrjm, yes, you are correct. I'm so stupid... echo "<input type='radio' value='" .$link_diametro ."' >" . $pro_diametro . "</option>";
  3. I declared $con in the begin of the index from other page (include etc etc). $con = mysqli_connect ("localhost","root","xxxx","xxxxx"); I don't need do this? I can do something like this? $get_cat_pro = "SELECT * FROM produtos where cat='$cat' "; $run_cat_pro = mysqli_query ($con, $get_cat_pro); echo"Diâmetro <select name='diametro' onchange='location= this.value;'>"; while($row_cat_pro=mysqli_fetch_array($run_cat_pro)){ $pro_diametro = $row_cat_pro['diametro'] ; $link_diametro= "index.php?diametro=$pro_diametro"; $pro_espess_segmento = $row_cat_pro['espess_segmento'] ; $link_espess_segmento= "index.php?espess_segmento=$pro_diametro"; echo "<input type='radio' value='" .$link_diametro ."' >" . $pro_diametro . "</option>"; } echo "</br>"; echo "<option value='" .$link_espess_segmento ."' >" . $pro_espess_segmento . "</option>"; } echo "</select>"; I will read more about PDO
  4. Hi everyone, When I choose one of the value, I want this shown in the url. example: index.php?espess_segmento=450 . But display the values of "diametro" available in the table where the espess_segmento=450. After this I want can choose the values of "diametro" and appear in url something like this: index.php?espess_segmento=450&diametro=3. This the code I write: <?php function getCats1 () { global $con; $get_cats = "select * from categorias"; $run_cats = mysqli_query ($con, $get_cats); while($row_cats= mysqli_fetch_array ($run_cats)) { $cat_id = $row_cats['cat_id']; $cat_title = $row_cats['cat_title']; } if(isset($_GET['cat'])){ $cat= $_GET['cat']; global $con; //Diamentro $get_cat_pro = "SELECT * FROM produtos where cat='$cat' "; $run_cat_pro = mysqli_query ($con, $get_cat_pro); echo"Diâmetro <select name='diametro' onchange='location= this.value;'>"; while($row_cat_pro=mysqli_fetch_array($run_cat_pro)){ $pro_diametro = $row_cat_pro['diametro'] ; $link_diametro= "index.php?diametro=$pro_diametro"; echo "<input type='radio' value='" .$link_diametro ."' >" . $pro_diametro . "</option>"; } echo "</br>"; //Espess_segmento $get_cat_pro2 = "SELECT * FROM produtos where cat='$cat' "; $run_cat_pro2 = mysqli_query ($con, $get_cat_pro2); echo"Espessura de Segmento <select name='espess_segmento' onchange='location= this.value;'>"; while($row_cat_pro2=mysqli_fetch_array($run_cat_pro2)){ $pro_espess_segmento = $row_cat_pro2['espess_segmento'] ; $link_espess_segmento= "index.php?espess_segmento=$pro_diametro"; echo "<option value='" .$link_espess_segmento ."' >" . $pro_espess_segmento . "</option>"; } echo "</select>"; } } ?> What I need do? Thanks for the attention!
  5. appear this "function.mysqli-query doesn't exist. Closest matches:" but the code is "mysqli_query"
  6. I re-write the code in mysqli inspired by I saw in php.net... but appear a new type of error : "function.mysqli-query doesn't exist. Closest matches:"
  7. Hi everyone, I can’t understand what happens… When I try my site in WAMP, I have the follow errors: Deprecated: mysql_query(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO (…) Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in (…) The same happened with the connect to mysql, but I solved using mysqli extension. But in this case is totally diferente. When I use the mysqli_query or mysqli_num_rows that are the alternatives presented I receive again other error, in PHP Manual says: "function.mysqli-query doesn't exist. Closest matches:" Someone know solve this problem??? When I use MySQL <?php session_start(); if (isset($_SESSION["manager"])){ header("location:index.php"); exit(); } ?> <?php if(isset($_POST["username"])&&isset($_POST["password"])){ $manager=preg_replace('#[^A-Za-z0-9]#i','',$_POST["username"]); $password=preg_replace('#[^A-Za-z0-9]#i','',$_POST["password"]); $cnn= include "../lojascript/connect_mysql.php"; $sql=mysql_query($cnn, "SELECT id FROM admin WHERE username='$manager' AND password='$password' LIMIT 1"); $existCount=mysql_num_rows($sql); if ($existCount==1){ while ($row = mysqli_fetch_array($sql)){ $id=$row["id"]; } $_SESSION["id"]=$id; $_SESSION["manager"]=$manager; $_SESSION["password"]=$password; header("location:index.php"); exit(); }else { echo 'Informação incorrecta <a href="index.php"> Click here</a>'; exit(); } } ?> When I use MySQLi <?php session_start(); if (isset($_SESSION["manager"])){ header("location:index.php"); exit(); } ?> <?php if(isset($_POST["username"])&&isset($_POST["password"])){ $manager=preg_replace('#[^A-Za-z0-9]#i','',$_POST["username"]); $password=preg_replace('#[^A-Za-z0-9]#i','',$_POST["password"]); $cnn = include "../lojascript/connect_mysql.php"; $query= "SELECT id FROM admin WHERE username='$manager' AND password='$password' LIMIT 1"; $result= mysqli_query($cnn,$query) or die(mysqli_error()); $num_row = mysqli_num_rows($result); if ($num_row==1) { while ($row = mysqli_fetch_array($result)){ $_SESSION["id"]=$row["id"]; } $_SESSION["id"]=$id; $_SESSION["manager"]=$manager; $_SESSION["password"]=$password; header("location:index.php"); exit(); }else { echo 'Informação incorrecta <a href="index.php"> Click here</a>'; exit(); } } ?>
  8. Hi, I don't know how create Form Select with the characteristics presented in the image attached. The "Search" is for search the options in the first window, and we choose the options we want pushing the sum symbol button for the other window (right). How I do?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.