Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by Silence~

  1. I'm having trouble with getting the image in the right order. I'm trying to filter images gotten from the database based on the button link. I got the reference from http://www.evoluted.net/thinktank/web-development/jquery-filtering. I have about 20+- buttons and for each button, I am getting all the picture that is being under that filter button through database. (Not sure where to post this, but I think it's more suited to be under css). Basically, I have gotten the css all wrong (my css is basic too ><), so I hope you could help me(where i have gone wrong) and give some pointers. Her
  2. ...There's no errors, it works fine now. Somehow my data got deleted away in my database.. :| So, it was actually my data that is not there in the first place? But it was there when i tried yesterday ><
  3. I'm not sure what you mean by this, I put var_dump($database) and var_dump($statement) and this is the results: object(PDOStatement)#2 (1) { ["queryString"]=> string(99) "SELECT * FROM userProfile WHERE user_id in ( select id from users where id = 1)" }
  4. Hmm it still give the same dump: object(PDO)#1 (0) { } ;-; I'm confused why though
  5. Nope I didn't. I get the error message beside the one I stated above: if (!$row = $statement->fetch(PDO::FETCH_ASSOC)) { print_r ("No Data to show. Please add in your profile. Navigate your way through the left side of the page where the navigations are.");} Oh okay, thanks for the explanation
  6. My database file looks like this: try {$user = ""; //taken out just in case$pass = "";$database = new PDO('mysql:host=localhost;dbname=final_year_project_1;charset=utf8', $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => false,PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));}catch (PDOException $ex) { echo 'Connection failed: ' . $ex->getMessage();} When you mean open the connection, i just have to require the file right? Must I put it in the try catch?(because I already put it in the database file?) or like put the search code and the select code together? I cl
  7. Ah yes, thank you! This was one of the cause >< But why would that affect though? I thought by requiring the database connection again, it should be okay?Anyways, it gives this: object(PDO)#1 (0) { } for the vardump. I have data inside though?
  8. Tried it and it says null. Does that mean my database connection being null or my query being null? It works though if i didn't put the search code in.. o.o
  9. I'm receiving this error 'Call to a member function prepare() on null' if I were to put this search code into the page. It works fine if i were to put at other pages(for inserting to database).Here's my search code that I've put before the html tags: <?php//echo '<pre>';//echo $_POST;//echo '</pre>';//declare the form name//$searchForm = htmlentities($_SERVER['PHP_SELF']);try { //inserts database connections require('Connections/database.php'); if (($_SERVER['REQUEST_METHOD'] == 'POST') && isset($_POST['search'])) { // array to hold errors $errorsSearch = array(); //
  10. My apologies. It actually does show the errors, just that it was hiding under my navigation bar. I sorted it out already. Thank you for all the help I need ^^ [is there any way I can mark this as answered?]
  11. Okay, I found out the solution to that error.. I utterly embarrassed myself for not looking through thoroughly >< With the help of this post : http://w3schools.invisionzone.com/index.php?showtopic=47997&p=265892 , I realised I had moved my coding to the starting of html form and that what caused the error since the header location must be located before the html tag. Thanking Ingolme indirectly (Thanks a bunch ) . Anyways, I still can't validate if the file is not image. It won't show the $errors[] either. >< I'm not sure where i go wrong o,o
  12. I'm not sure if i understand it correctly. This is what I've added in : //Allowed typpes to pass through validation $allowedTypes = array('image/jpg', 'image/jpeg', 'imagae/jpe', 'image/png', 'image/gif'); $allowedExtensions = array('jpg', 'jpeg', 'jpe' , 'png', 'gif'); //$ext = explode(".", $filename); // $extension = strtolower(end($ext)); //gets the info of ther file, in this case, extension $extension = pathinfo($filename, PATHINFO_EXTENSION); //return the file mime type $finfo = new finfo(FILEINFO_MIME_TYPE); //check th file for the information (tmp or name) $mimetype = $finf
  13. I did another try(before you posted this) and I'm stuck at the same place where they would not detect the extension. Here's my tries : //First Try//tried with 'jpg','png' and 'gif' for both too$allowedTypes = array('image/jpg', 'image/png', 'image/gif'); $ext = explode(".", $filename);$extension = strtolower(end($ext));$finfo = new finfo(FILEINFO_MIME_TYPE);$mimetype = $finfo->file($filetmp);var_dump($mimetype);if (!in_array($mimetype, $allowedTypes) || !in_array($extension, $allowedTypes)) { $errors[] = ('File uploaded does not meet the types criteria(PNG/JPG/GIF). Please check.');}el
  14. So, I tried coding for the image uploading and I have some difficulty on the MIME type. If I did not declare anything of that, I am able to insert to the database(the directory and the name of the file) but the picture would not be inserted to the folder. This are my code: //Declare variables and start validation $fileMaxSize = $_POST['MAX_FILE_SIZE']; $filename = $_FILES['userfile']['name']; $filetype = $_FILES['userfile']['type']; $filesize = $_FILES['userfile']['size']; $filetmp = $_FILES['userfile']['tmp_name']; $fileError = $_FILES['userfile']['error']; $uploaddir = '/profilePi
  15. Ah, well this was just a testing out from the previous posts that's been suggested to use >< I have taken that down now and use justsomeguy's example in use. Thank you dsonesuk and justsomeguy! I didn't realised that the "[]" in the form plays the part too >< I managed to get them insert to the database now ^^ I shall now work on the images, I will have to post that later after trying it out
  16. This is what I have tried using the case statement: switch ($data['specialization'] == true) { case 'specialization_1': $data['specialization']= print_r($data['specialization'],true); //$data['specialization']= print_r($_POST['specialization'], true); //declare skillset // $skillset = extract($data['ISgrp1'].",".$data['ISgrp2'].",".$data['ISgrp3'].",".$data['ISgrp4'].",".$data['ISgrp5']); //$skillset = print_r($_POST['ISgrp1'].",".$_POST['ISgrp2'].",".$_POST['ISgrp3'].",".$_POST['ISgrp4'].",".$_POST['ISgrp5']); $skillset = implode(",", $_POST['ISgrp1'] .$_POST['ISgrp1']. $_POST['ISgr
  17. Okay, I somewhat get what you mean by this but I don't think this is what I have in mind. I have about 12 radio groups and I thought using $_POST['radiobutton_groupname'] would already take in the value?(i declare this inside $data['radiobutton_groupname'] = $_POST['radiobutton_groupname']) I'm not sure why I would have to create this array when it will automatically get the value. But if this is the only way, i will post my codes later after i try implementing this. My codes before the insert query you see below(this is also what i meant by the $_POST['radiobutton_groupname']): if ($_SE
  18. I'm not sure if I understand but this is so I do not need to "checked" every one radio button of the group, am I right? $data is actually an array for all my inputs to put through. It's just to trim all inputs actually. $data = array();//array_map('trim',$_POST); array_walk_recursive($data,'trim'); $Skillset is a new variable that I declare where I want to assign to the selected radio group set, meaning if I chose specialization "IS", the radio buttons that are based on "IS" is the one I wanted to store in the database. I would like to clarify something though: radio buttons wil
  19. I actually used the '==' but they do not take in the value(?), the word "array" is inserted into my database and not the value. Same for the '===' although I do not think the type matters in this case since they are a radio button group ><
  20. I have a hard time trying to make my radio buttons work. I know that radio buttons are a special case whereby if the user did not click on them, the value will not be taken in. Thus, i have made all my radio buttons to be set per group. However, i can't seem to get the validating right. This is my current validating code as of now: if ((isset($data['specialization']) && $data['specialization'] = "specialization_1")) { $data['specialization'] = "IS"; $skillset =($data['ISgrp1'].",".$data['ISgrp2'].",".$data['ISgrp3'].",".$data['ISgrp4'].",".$data['ISgrp5']); } if ((isset($data['
  • Create New...