User
Pass
2FA
 
 

Mysql Filtre Data

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash -> Programming / Scripting / Database
Author Message1255
LolzyTM

[Mentally Stable]



Status: Offline
(since 08-11-2012 15:22)
Joined: 24 Feb 2011
Posts: 31, Topics: 19
Location: Romania

Reputation: 86.2
Votes: 2

Post Posted: 29-02-2012, 14:56:51 | Translate post to: ... (Click for more languages)

Salut am urmatorul cod:

Code:
<form method="get" action="">
   <select name="categorie">
   <option>nokia</option>
   <option>LG</option>
   <option>sony ericsson</option>
   <option>Philips</option>
   </select>
   <input type="submit" value="Filtreaza!" name="subfil" />
   </form>
   <?
   if(isset($_GET['subfil']))
   {
   $sql = "SELECT * FROM produse WHERE categorie='$categorie'";
   $res = mysql_query($sql) or die("$sql");
 
    while ($row = mysql_fetch_array($res))
        { 
       
            $categorie = $_GET['categorie'];
            $produs= $row["produs"];
            $id = $row["id"];
            $pret = $row["pret"];
            $detalii = $row["detalii"];
           
            echo'<table width="20px" align="center" style="float:left; padding-left:5px; margin-left:28px; margin-bottom:9px; margin-top:20px; margin-right:12px; background-color:#F3F3F3; border:solid 1px #ccc; -webkit-border-radius:8px; -moz-border-radius:8px; -ms-border-radius:8px;">
<th width="100" rowspan="3"><img src="produse/'.$id.'.jpg" width="100" height="100"/></th><td width="120">'. $produs .'
</tr>
<tr>
<td>Pret:&nbsp;'.$pret.'&nbsp; Lei</td>
</tr>
<tr>
<td height="43"><a href="produse.php?produs='.$id.'"><img src="detalii.png" border="0" title="Detalii '.$produs.'"/></a></td>
</tr></table>&nbsp;&nbsp;&nbsp;&nbsp;';
   }
           }
   ?>


Eu am vrut sa fac sa imi filtreze produsele din baza de date daca $categorie = nokia sa imi arate produsele nokia dar nu merge nu se intampla nimic..... daca poate cineva sa imi zica unde am gresit... Ms mult!

0 0
  
Back to top
View user's profile Send private message
nr913
[Banned user]


Banned


Status: Offline
(since 24-10-2013 10:06)
Joined: 24 Apr 2009
Posts: 4224, Topics: 223
Location: România

Reputation: 60.3
Votes: 156

 
Post Posted: 29-02-2012, 15:16:31 | Translate post to: ... (Click for more languages)

Înainte de $sql = "SELECT ... pune $categorie = intval($_GET['categorie']);

Attitude - A little thing that makes a BIG difference
0 0
  
Back to top
View user's profile Send private message
LolzyTM

[Mentally Stable]



Status: Offline
(since 08-11-2012 15:22)
Joined: 24 Feb 2011
Posts: 31, Topics: 19
Location: Romania

Reputation: 86.2
Votes: 2

Post Posted: 29-02-2012, 15:49:24 | Translate post to: ... (Click for more languages)

nr913 wrote:
Înainte de $sql = "SELECT ... pune $categorie = intval($_GET['categorie']);


Nope ...nu merge am incercat -

0 0
  
Back to top
View user's profile Send private message
nr913
[Banned user]


Banned


Status: Offline
(since 24-10-2013 10:06)
Joined: 24 Apr 2009
Posts: 4224, Topics: 223
Location: România

Reputation: 60.3
Votes: 156

 
Post Posted: 29-02-2012, 15:51:00 | Translate post to: ... (Click for more languages)

Ce salvezi în câmpul categorie? Un id sau un string?

Attitude - A little thing that makes a BIG difference
0 0
  
Back to top
View user's profile Send private message
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash -> Programming / Scripting / Database  


The time now is 29-04-2024, 17:13:32
Copyright info

Based on phpBB ro/com
B

 
 
 







I forgot my password


This message appears only once, so
like us now until it's too late ! :D
x