Jump to content

Joepiooo1988

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Joepiooo1988's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, Thanks for your reply. Can you give me an example how you would use DISTINCT with my code because everything I tried did not work...
  2. Is there nobody that can help me with this problem? I tried DISTINCT but that did not work very well
  3. Hello, I need help with some code because I cant figure it out on my own:( This is my Class: <?php include_once "connect.class.php"; class merken extends connect { private $merkenlijst; public function getMerken($database, $id = NULL) { $sql = "SELECT * FROM ".$database."_merken"; if(!empty($id)) { $sql .= " WHERE merk_code=:id LIMIT 1"; } else { $sql .= " ORDER BY merk_naam ASC"; } try { $stmt = $this->db->prepare($sql); if(!empty($id)){ $stmt->bindParam(":id", $id, PDO::PARAM_STR); } $stmt->execute(); $this->merkenlijst = $stmt->fetchAll(PDO::FETCH_OBJ); $stmt->closeCursor(); return $this->merkenlijst; } catch (Exception $e) { die ( $e->getMessage() ); } } public function __construct($dbo = NULL) { parent::__construct($dbo); } } ?> And this is my code for the output: <?php include_once "class/merken.class.php"; $merkclass = new merken($dbo); ?> <br /> <div class="bandwielkolom"> <form action="index.php?lang=nl&p=<?php echo $_GET['p']; ?>#keuze" method="post"> <table class="bandentabel"> <tr> <th colspan="2">Zoek op merk<a name="wiel"></a></th> </tr> <tr> <td>Merk:</td> <td> <select name="wiel_merk"> <option value="0">- Merk -</option> <?php $merken = $merkclass->getMerken($website); foreach($merken as $merk) { echo "\t\t\t\t\t\t\t\t\t\t\t<option value=\"".$merk->merk_code."\""; if(isset($_GET['search']) && $_GET['search'] == "wiel" && isset($_GET['merk']) && $_GET['merk'] == $merk->merk_code || isset($_POST['wiel_submit']) && $_POST['wiel_merk'] == $merk->merk_code) { echo " selected=\"selected\""; } echo ">".$merk->merk_naam."</option>\n"; } ?> </select> </td> </tr> <tr> <td> </td> <td><input type="submit" name="wiel_submit" value="Zoek" /></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td colspan="2"> </td> </tr> </table> </form> </div> <div class="clearboth"></div> <br /> <?php if(isset($_POST['wiel_submit']) && $_POST['wiel_submit'] == "Zoek" || isset($_GET['merk'])) { $merk = NULL; if(isset($_POST['wiel_submit']) && $_POST['wiel_submit'] == "Zoek") { $merk = $_POST['wiel_merk']; } $merken = $merkclass->getMerken($website, $merk); ?> <img src="http://www.etyre.net/preview/bnet/logos/<?php echo str_replace(".png", "_150.png", $merken[0]->merk_logo); ?>" width="150" class="logo" alt="<?php echo $merken[0]->merk_naam; ?>"/> <div id="merken"> <li><span class="title">Foto <?php echo $merken[0]->wiel_foto; ?></span> <a href="http://www.inter-tyre.nl/inter-tyre/images/w3/<?php echo $merken[0]->wiel_foto; ?>" class="preview" title="Fotonummer: <?php echo $merken[0]->wiel_foto; ?>"> <img src="http://www.inter-tyre.nl/inter-tyre/images/w2/<?php echo $merken[0]->wiel_foto; ?>" alt="Fotonummer: <?php echo $merken[0]->wiel_foto; ?>" class="wheelImg"/> </a> <div class="clearboth"></div> </div> <?php } ?> What I try to accomplish is the following: I got a option selectfield and you can select different brands. After you submit you get the name and logo of the brand and the wheel that has that brand. Now I only have 11 different brands with a wheel but I got more wheels with the same brand and I want to show all the wheels that belong to the brand you selected. Here is how my database looks like: http://imageshack.us/photo/my-images/685/databaseh.png So lets say I put in another Rosso with a different picture. When I select Rosso and click submit I get 2 wheels of Rosso. The only thing that is happening now is that in my selectbox I can choose Rosse 2 times! And when I add another Rosso wheel I can choose 3 times. Same is with merk_logo that is there 3 times... Can somebody help me with the code I got this far and help me getting this thing to work like a charm? I know I am very close but just need to fix this... Thanks
  4. Hello, I have a CMS system and when I add text something like this: 15" Wheel. He insert it correct in the database but after he insterted it he updates automatic and then the only thing I see is : 15. The rest is gone... Can somebody help me out? Here is my code <td>Maat</td> <td><input type="text" name="aanbieding_maat" value="<?php echo ((is_array($aanbiedingen)) ? $aanbiedingen[0]->aanbieding_maat : ""); ?>"/></td> </tr> The insert is good but he doesnt read the ".... Tnx for any help
  5. Yes active = 1 and inactive = 0... Ok, so I have to create a new table like "text_publish_date" in my database?
  6. Hi all, Recently, I have spent time on making an active / inactive class for a CMS system that I am making with a friend. Works fine now but now suddenly we were thinking of making a function to add that you can enter a date that he becomes active. So I want a text that will be active tomorrow. When I set the date to 25-05-2012 it will be active on that date. Now I honestly do not exactly know where to start and finding a good tutorial for something similar is hard. Does anyone can help me out a bit with this? thanks Joep
  7. Hello, I'm working on a Class with my CMS and can't get it to work properly. It is the textClass of my cms. You can add and delete text on the website but I want to add an active or non active option. This is de code I got now but it isnt working and I cant find te problem. The radio button in my cms wich shows active or non active works fine and when i change it to non active it changes in the database to 0 so the problem isnt there I think. Can anybody help me out? Tnx:) public function getTeksten($database, $taal, $actief = NULL, $bladzijde = NULL, $id = NULL) { $sql = "SELECT * FROM ".$database."_teksten WHERE tekst_taal=:taal"; if(!empty($id)) { if(is_numeric($id)) { $sql .= " AND tekst_ID=:id"; } if(!empty($actief) && $actief == 1) { $sql .= " WHERE tekst_actief='1'"; } } else if(!empty($bladzijde)) { if(is_numeric($bladzijde)) { $sql .= " AND tekst_bladzijde=:bladzijde"; } else { return NULL; } } $sql .= " ORDER BY tekst_volgorde ASC"; try { $stmt = $this->db->prepare($sql); $stmt->bindParam(":taal", $taal, PDO::PARAM_STR); if(!empty($id) && is_numeric($id)) { $stmt->bindParam(":id", $id, PDO::PARAM_INT); } else if(!empty($bladzijde) && is_numeric($bladzijde)) { $stmt->bindParam(":bladzijde", $bladzijde, PDO::PARAM_INT); } $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_OBJ); $stmt->closeCursor(); return $result; } catch(Exception $e) { die($e->getMessage()); } } I have to text items on my homepage and turned one to non active but what happened now is that is show all of my text items on my homepage. Cant find the problem:( Someone that can help me out here?
×
×
  • 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.