Jump to content

frobak

Members
  • Posts

    96
  • Joined

  • Last visited

Everything posted by frobak

  1. Basically, this is what i want to happen: The posted data is coming from a job that is being posted, so there will be lots of checkboxes with requirements Im then going to check if the candidate has the required skills If there are matching skills, fire off an email to the candidate telling them about the job. Theres 230 checkboxes :'(
  2. Does a TINYINT value of 0 equal NULL when selecting from the cell? I though it would equal false. A little background: I am searching a table for selected checkboxes and then comparing that with posted php data: $sql = "SELECT username FROM candidate_details WHERE acca= '$_POST[acca]' OR msc_bp_mgmt = '$_POST[msc_bp_mgmt]'OR So I want the username pulled out if the cells match. If the checkbox on the form submitted was not selected, '$_POST[acca]' would be null. And then when i compare that to the candidate_details table cell, which has a value of '0' - (zero) - it is still coming up as a match? Is this right? Or is there another data type that actually enters TRUE or FALSE from a checkbox selection? help much appreciated Cheers
  3. Paul, that worked like a charm, Cheers
  4. Hi Yeah the problem is that i need to change the filename of the uploaded file, not the extension, just the filename. or even just append a user id to the beggining of the filename. CV's are being uploaded by users, so i would need to chnage the fielname or I could have many duplicate filenames, people uploading cv.doc for example. pathinfo() doesnt split the extension?
  5. Hi I need to change the name of a file being uploaded by a user. The reason i need this is because there is a strong possibility that duplicate filenames would be logged. This is the code i have currently: $upload_path = 'cv/'; // The place the files will be uploaded to (currently a 'files' directory). $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension). $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename. // Check if we can upload to the specified path, if not DIE and inform the user. if(!is_writable($upload_path)) die('You cannot upload to the specified directory, please CHMOD it to 777.'); // Upload the file to your specified path. if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $filename)); This code works fine to upload the file in the current name. I assume i need to seperate the filename from the file extension, and i can then assign a new variable to the filename. Easier said than done though as Ive tried many combinations of things. Is there a simple way using this script? or will i need to start from scratch? Cheers
  6. heres the code that worked for me. $start_date_pre = $_POST['start_date']; $arrDate = explode("/","$start_date_pre"); $start_date = $arrDate[2] . "/" . $arrDate[1] . "/" . $arrDate[0]; $sql = "INSERT INTO vacancies SET vacancy_id= '$_POST[vacancy_id]', job_title= '$_POST[job_title]', salary= '$_POST[salary]', job_salary_range= '$_POST[job_salary_range]', job_location= '$_POST[job_location]', job_terms= '$_POST[job_terms]', start_date= '$start_date', end_date= '$_POST[end_date]', job_desc= '$_POST[job_desc]'"; Cheers for your help
  7. thanks for your reply. So ive tried using the code you supplied, but im getting errors. Heres the code $start_date_pre = $_POST['start_date']; $arrDate = explode("/","$start_date_pre"); $start_date = "$arrDate[2] . / $arrDate[1] . / . $arrDate[0]"; $sql = "INSERT INTO vacancies SET vacancy_id= '$_POST[vacancy_id]', job_title= '$_POST[job_title]', salary= '$_POST[salary]', job_salary_range= '$_POST[job_salary_range]', job_location= '$_POST[job_location]', job_terms= '$_POST[job_terms]', start_date= $start_date, end_date= '$_POST[end_date]', job_desc= '$_POST[job_desc]'"; Can you see where ive gone wrong?
  8. Hi I need to change a uk date dd/mm/yyyy to mysql format yyyy/mm/dd I have a user form where they enter the date in dd/mm/yyyy string format, i want to take that string, and convert it to mysql format yyyy/mm/dd Possible? Ive searched for ages and havent found a solution that works. Is there an easy solution to this? surely there must be Cheers
  9. ialsoagree, thanks for that. worked like a treat!
  10. so i have a form with an input, and a user will enter the full url into this input, and submit the form. How do i catch the user inputted url and get that into _FILE_?
  11. hang on, sorry. So how would i input the url to be processed by that code? I assume the url is within the "_FILE_", so how do i get it into that? can i assign like a normal variable?
  12. great thanks, ill test and report back.
  13. Hi I need to take the number off of the end of a url and do some processing with it. so for example: www.something.com/something/10001 i will need to seperate them into 2 different variables, for example: $var1 = www.something.com/something/ $var2 = 10001 is this possible? Thanks
  14. Hi Im trying to post to the graph api using curl. This script already obtains access tokens etc. I've managed to post a feed item using this, so this works fine if($_POST['txt']){ //if there is a posted data, then post it in facebook $params = array('access_token'=>$_SESSION['accesstoken'], 'message'=>$_POST['txt'] ); $url = 'https://graph.facebook.com/255500227799817/feed'; $ch = curl_init(); curl_setopt_array($ch, array( CURLOPT_URL => $url, CURLOPT_POSTFIELDS => $params, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_VERBOSE => true )); $result = curl_exec($ch); curl_close($ch); } But i cant post a comment on the feed item using this, but surely it should work the same? The documentation says so? if($_POST['new-comment']){ $fb_post_id = $_POST['new-fb-post-id']; $fb_new_comment = $_POST['new-comment']; //if there is a posted data, then post it in facebook $params = array('access_token'=>$_SESSION['accesstoken'], 'message'=>$_POST['new_comment']); $url = 'https://graph.facebook.com/'.$fb_post_id.'/comments'; $ch = curl_init(); curl_setopt_array($ch, array( CURLOPT_URL => $url, CURLOPT_POSTFIELDS => $params, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_VERBOSE => true )); $result = curl_exec($ch); curl_close($ch); } Any thoughts? cheers
  15. well i get this error: Warning: Invalid argument supplied for foreach() on this line foreach ($feed->actions as $action) { so i need to play around with this line
  16. thanks for your help and paitence. i take it i need to play with that to get it to work?
  17. below is the json of a single one and the printr below. I just need to capture every value, also the actions which look like another array "data": [ { "id": "255500227799817_255522881130885", "from": { "name": "Frobaks Bits", "id": "255500227799817" }, "message": "just another status update", "actions": [ { "name": "Comment", "link": "http://www.facebook.com/255500227799817/posts/255522881130885" }, { "name": "Like", "link": "http://www.facebook.com/255500227799817/posts/255522881130885" } ], "type": "status", "created_time": "2011-07-13T10:57:13+0000", "updated_time": "2011-07-13T10:57:13+0000" }, print_r($feeds["data"]); Array ( [0] => Array ( [id] => 255500227799817_255522881130885 [from] => Array ( [name] => Frobaks Bits [id] => 255500227799817 ) [message] => just another status update [actions] => Array ( [0] => Array ( [name] => Comment [link] => http://www.facebook.com/255500227799817/posts/255522881130885 ) [1] => Array ( [name] => Like [link] => http://www.facebook.com/255500227799817/posts/255522881130885 ) ) [type] => status [created_time] => 2011-07-13T10:57:13+0000 [updated_time] => 2011-07-13T10:57:13+0000 ) [1] => Array ( [id] => 255500227799817_255522584464248 [from] => Array ( [name] => Frobaks Bits [id] => 255500227799817 ) [message] => Nice [picture] => http://photos-c.ak.fbcdn.net/hphotos-ak-ash4/284503_255522561130917_255500227799817_1243705_4977710_s.jpg [link] => http://www.facebook.com/photo.php?fbid=255522561130917&set=a.255522557797584.83739.255500227799817&type=1 [name] => Wall Photos [icon] => http://static.ak.fbcdn.net/rsrc.php/v1/yz/r/StEh3RhPvjk.gif [actions] => Array ( [0] => Array ( [name] => Comment [link] => http://www.facebook.com/255500227799817/posts/255522584464248 ) [1] => Array ( [name] => Like [link] => http://www.facebook.com/255500227799817/posts/255522584464248 ) ) [type] => photo [object_id] => 255522561130917 [created_time] => 2011-07-13T10:56:36+0000 [updated_time] => 2011-07-13T10:56:36+0000 [likes] => Array ( [data] => Array ( [0] => Array ( [name] => Alan Smith [id] => 869830416 ) ) [count] => 1 ) ) [2] => Array ( [id] => 255500227799817_255520917797748 [from] => Array ( [name] => Frobaks Bits [id] => 255500227799817 ) [message] => a [actions] => Array ( [0] => Array ( [name] => Comment [link] => http://www.facebook.com/255500227799817/posts/255520917797748 ) [1] => Array ( [name] => Like [link] => http://www.facebook.com/255500227799817/posts/255520917797748 ) ) [type] => status [created_time] => 2011-07-13T10:51:12+0000 [updated_time] => 2011-07-13T10:51:12+0000 ) )
  18. yes sorry thats what im trying to do, have a third foreach loop inside. but i cant get it to work. i split the first array into $feed(key) and $list(value) and then i split the second array $list into $k(key) and $v(value) but how do i get the 3rd array, because if i follow the logic there i split $v but its the value not the array?? I saw from your post about adding the ['from'] but couldnt get it to work even with just that as a single loop confused!
  19. i totally understand what the code does, thats easy, but the whole problem is extracting it in the same loop as the other arrays
  20. ok fair point. ive been looking at this small script for 2 days but ill get back on it
  21. Hi so how would i incorporate that into the script, would i replace the foreach($feeds['data'] as $feed => $list) { with foreach ($feeds["data"]->from as $whatever) { I cant seem to get it to work?
  22. i Im making a facebook app and i need to access the 3rd level data in a JSON array, ive managed to output the first 2, but then im getting an invalid argument. I want to replicate the wall function The below code outputs the top 2 arrays no problem $feeds = $facebook->api('/255500227799817/feed'); foreach($feeds['data'] as $feed => $list) { echo "<h2>$feed</h2><ul>"; foreach($list as $k => $v) { echo "<li>$k - $v</li>\n"; } echo "</ul>"; } this is the output id - 255500227799817_255522881130885 from - Array message - just another status update actions - Array type - status created_time - 2011-07-13T10:57:13+0000 updated_time - 2011-07-13T10:57:13+0000 So i need to access and display the 'from' array and the 'actions' array Can i do this by amending the above php function?
  23. thanks thorpe. i think i need to get some reading in!
  24. Hi how would i remove query strings from a url? for example: www.mysite.php/blog.php?blog_title=my-blog-title to: www.mysite.php/blog.php/my-blog-title is this possible?
×
×
  • 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.