An7hony
Members-
Posts
79 -
Joined
-
Last visited
Everything posted by An7hony
-
is this possible?
-
values which overlap the range as if someone searches for a job and select 15000 - 20000 and there are jobs on there for 16000 - 22000. These should show up as 16000 is within the range even if 22000 overlaps
-
yeah, your right How would i find these middle values
-
ok that makes sense, if its between 0 and 15000 it will find jobs with say 1000 - 15000. But not jobs like the ones above So if i replace AND with OR it should work, i'll give it a go
-
cheers, I have one more question Say i make a search like this: SELECT id, title, description, salary_from, salary_to FROM jobs WHERE `title` LIKE '%fund%' AND `salary_from` >= 15001 AND `salary_to` <= 20000 ORDER BY id DESC Why doesnt it pull a result for: 16000 - 22000
-
I have read that i can search for a number within a mysql database using BETWEEN i.e: SELECT * FROM `table_name` WHERE `field_name` BETWEEN 99 AND 200 How would i do this with the code below? <?php $salary = explode(":", $_GET['salary_to']); } $types[] = (isset($_GET['salary_to']) && strlen(trim($_GET['salary_to'])) > 0) ? "`salary_from` LIKE '%". mysql_real_escape_string(trim($salary[0])) ."%' AND `salary_to` LIKE '%". mysql_real_escape_string(trim($salary[1])) ."%'" : ''; ?> Thanks for any help
-
that seems to be working. Although how do i pull the results i.e $message = ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head></head> <body> <table> <tr><td>Categories</td><td>' . $JobCategories . '</td></tr> <tr><td>Company</td><td>' . $company . '</td></tr> <tr><td>Title</td><td>' . $title . '</td></tr> <tr><td>First Name</td><td>' . $firstname . '</td></tr> If i put $JobCategories[] into this it throws me an error
-
how would i get checkboxes to work. I have tried: $JobCategories = ($_GET['JobCategories[]']) ? $_GET['JobCategories[]'] : $_POST['JobCategories[]']; html looks like: <li><input name="JobCategories[]" type="checkbox" value="Admin" /> Admin</li> <li><input name="JoCategories[]" type="checkbox" value="Campaigning" /> Campaigning</li>
-
i tried this $this->url = $_SESSION['url'] = $_SERVER['PHP_SELF'] = $_SERVER['QUERY_STRING']; but it gave me: elements/view=view&id=5 rather than: jobs.php?view=view&id=5
-
Hi all, I have a page url that looks like this: jobs.php?view=view&id=5 Their is a login on this page, the form ends with this command: header("Location: ".$session->referrer); The fuction for this is: <?php function startSession(){ global $database; //The database connection session_start(); //Tell PHP to start the session /* Determine if user is logged in */ $this->logged_in = $this->checkLogin(); /** * Set guest value to users not logged in, and update * active guests table accordingly. */ if(!$this->logged_in){ $this->username = $_SESSION['username'] = GUEST_NAME; $this->userlevel = GUEST_LEVEL; $database->addActiveGuest($_SERVER['REMOTE_ADDR'], $this->time); } /* Update users last active timestamp */ else{ $database->addActiveUser($this->username, $this->time); } /* Remove inactive visitors from database */ $database->removeInactiveUsers(); $database->removeInactiveGuests(); /* Set referrer page */ if(isset($_SESSION['url'])){ $this->referrer = $_SESSION['url']; }else{ $this->referrer = "/"; } /* Set current url */ $this->url = $_SESSION['url'] = $_SERVER['PHP_SELF']; } ?> Basically $this->url = $_SESSION['url'] = $_SERVER['PHP_SELF']; seems to cut my url to: jobs.php instead of: jobs.php?view=view&id=5 Can anyone here tell me how to fix this? Thanks Guys
-
cool thanks works great much appreciated
-
Hi Guys Could somebody tell me how i would put a line break into the code below i.e: 1.07 <br /> 2010 <?php echo date('d.m.Y',strtotime($news['created_at']));?> Thanks for your help
-
ah got you. Thanks for your help, Its much appreciated
-
I read it on the fasthost knowledge base http://www.fasthosts.co.uk/knowledge-base/?article_id=65 Use the PHP mail function and set the mail from using the following line of code - replacing $email_from with the correct domain name. * ini_set("sendmail_from", " $email_from "); You need to add a fifth "-f" parameter to the sendmail function. This will set the name of the from address. * mail($email_to, $email_subject, $email_message, $headers, '-f'.$email_from);
-
sorry the rest of it goes like this <?php if($_POST['to']==""){ $to = ""; echo '<div class="error">Please select a <strong>Branch</strong></div>'; }else{ $to = $_POST['to']; } if($_POST['firstname']==""){ $firstname = ""; echo '<div class="error">Please fill in your <strong>First name</strong></div>'; }else{ $firstname = $_POST['firstname']; } if($_POST['surname']==""){ $surname = ""; echo '<div class="error">Please fill in your <strong>Surname</strong></div>'; }else{ $surname = $_POST['surname']; } ?> Then gets inserted into a mysql database and then runs into the script in the first post.
-
Hi this is killing me, the email form works on all hosts except fasthost. I have checked that the from email is hosted with fasthost and it is. I have changed the script to: ini_set("sendmail_from", $from); mail( "$to", "candidate application", $message, "From: \"-f\".$from"); But the emails dont send? Any help is really really appreciated Thanks <?php $from = "our@fasthosteddomain.com"; $message .= "You have an General job application from: "; $message .= $firstname; $message .= " "; $message .= $surname; $message .= "\n"; $message .= "\n"; $message .= "Looking for: "; $message .= $typeofwork; $message .= "\n"; $message .= "\n"; $message .= "Job Type: "; $message .= $jobtype; $message .= "\n"; $message .= "\n"; $message .= "Transport: "; $message .= $transport; $message .= "\n"; $message .= "\n"; $message .= "Please login to http://www.ourdomain.com/admin to view their details"; $message .= "\n"; $message .= "\n"; $message .= "Their Telephone number is: "; $message .= $telephone; $message .= "\n"; $message .= "\n"; $message .= "Their email address is: "; $message .= $email; $message .= "\n"; $message .= "\n"; $message .= "Cover Letter:"; $message .= "\n"; $message .= $coverletter; $message .= "\n"; $message .= "\n"; $message .= "If CV attached: http://www.ourdomain.com/cvs/".$fileName; ini_set("sendmail_from", $from); mail( "$to", "candidate application", $message, "From: \"-f\".$from"); } } ?>
-
How would i call safe_output() when using <<< EOF Heres my code: <?php $job_list = <<< EOH <div class="joblisting"> <div id="jobtools"> <h1>Job Tools</h1> <div class="content"> <ul> <li><a href="#" title="Apply for this Job" class="apply">Apply for job</a></li> <li><a href="#" title="Save this Job" class="savejob">Save this job</a></li> </ul> </div> </div> <div class="jobtop"> <div class="jobimage"><img src="skin/images/logo.gif" /></div> <div class="headers"> <h1><a href="jobs.php?view=show&id=$id; ?>"> safe_output($title); </a></h1> ?>
-
How would i make a jump menu sticky? I have tried to do it the same as a drop down menu but have had no success <select name="select" onChange="MM_jumpMenu('parent',this,1)" class="basic-combo" > <option value="#" selected>Locations. . .</option> <option value="<?php echo 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']. '&location=0'; ?>">All Locations</option> </select>
-
Here is some of my form: <form method="POST" enctype="multipart/form-data" action="" onsubmit="return false;" id="myid"> <label for="txtmessage" class="labsmall">Upload<span>*</span></label> <input type="hidden" name="MAX_FILE_SIZE" value="20000000000"><input name="userfile" type="file" class="browse" id="userfile"><br /> <input type="image" src="images/applybut.gif" class="applybutton" onclick="ajax_form('myid','validate.php','receiver');" /> Here is some of my validate.php: <? //file upload $uploadDir = '/blabla/'; $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; // get the file extension first $ext = substr(strrchr($fileName, "."), 1); // generate the random file name // and now we have the unique file name for the upload file $filePath = $uploadDir . $fileName; // move the files to the specified directory // if the upload directory is not writable or // something else went wrong $result will be false $result = move_uploaded_file($tmpName, $filePath); if (!$result) { echo 'Error uploading the <strong>file</strong>'; } $SQL = " INSERT INTO table "; $SQL = $SQL . " (name, size, type, path) VALUES "; $SQL = $SQL . " ('$fileName', '$fileSize', '$fileType', '$filePath') "; $result = mysql_db_query($db,"$SQL",$cid); if (!$result) { echo("ERROR: " . mysql_error() . "\n$SQL\n"); } mysql_close($cid); ?> Will this work using: onclick="ajax_form('myid','validate.php','receiver');" The rest of my data gets posted except the file upload Thanks for the help guys
-
Hi I have 2 jump menus which im using for sort by Sown below the jump menus: <select name="select" onChange="MM_jumpMenu('parent',this,1)" class="basic-combo" > <option value="#" selected>All Locations</option> <option value="/index.php?view=jobs&location=1">Lincoln</option> <option value="/index.php?view=jobs&location=2">Mansfield</option> <option value="/index.php?view=jobs&location=3">Grantham</option> </select> and <select name="select" onChange="MM_jumpMenu('parent',this,1)" class="basic-combo" > <option value="#" selected>Sort By. . .</option> <option value="/index.php?view=jobs">All Job Types</option> <option value="/index.php?view=jobs&sort=1">Temporary</option> <option value="/index.php?view=jobs&sort=2">Permanent</option> <option value="/index.php?view=jobs&sort=3">Perm to Temp</option> </select> Here is my php <?php $sortbylocation = intval($_GET['location']); switch ($sortbylocation) { case 1: { $sortlocation = "WHERE branch = 'Lincoln'"; };break; case 2: { $sortlocation = "WHERE branch = 'Mansfield'"; };break; case 3: { $sortlocation = "WHERE branch = 'Grantham'"; };break; //etc with the rest of the attributes } $sortby = intval($_GET['sort']); switch ($sortby) { case 1: { $sqlExtra = "WHERE jobtype = 'Temporary'"; };break; case 2: { $sqlExtra = "WHERE jobtype = 'Permanent'"; };break; case 3: { $sqlExtra = "WHERE jobtype = 'Temp to Perm'"; };break; //etc with the rest of the attributes } ?> and where its sorting: <?php $sql = "SELECT id, agent, branch, title, location, salary_from, salary_to, frequency, jobtype, description, specifications, benefits, email, created_at, categories FROM $tbl_name ".$sortlocation." ".$sqlExtra." LIMIT $start, $limit"; $result = mysql_query($sql); ?> question is how do i make the second menu dependant on the first menu option?
-
if this is more help here is the form: <? <li class="even"><label class="field-title">Categories: </label> <label> <? $categories = find_categories(); ?> <?php foreach( $categories as $category): ?> <input type="checkbox" name="job[cats][]" value="<?php echo $category['id']; ?>" > <?php echo $category['name']; ?> <br/> <?php endforeach; ?></label> <span class="clearFix"> </span></li> ?> and here is the find_categories(); function <? function find_categories() { db_connect(); $query = "SELECT categories.name, categories.id, COUNT(jobs2categories.job_id) as numjobs FROM categories LEFT JOIN jobs2categories ON categories.id = jobs2categories.category_id GROUP BY categories.id ORDER BY categories.name ASC "; $result = mysql_query($query); $result = db_result_to_array($result); return $result; } ?>
-
I am trying to display a category name related to a 'job' post. The function i create the job with is shown below: <?php function create_job($params) { db_connect(); $query = sprintf("INSERT INTO jobs set jobs.agent = '%s', jobs.branch = '%s', jobs.title = '%s', jobs.location = '%s', jobs.salary_from = '%s', jobs.salary_to = '%s', jobs.frequency = '%s', jobs.jobtype = '%s', jobs.description = '%s', jobs.specifications = '%s', jobs.benefits = '%s', jobs.email = '%s', created_at = NOW() ", mysql_real_escape_string($params['agent']), mysql_real_escape_string($params['branch']), mysql_real_escape_string($params['title']), mysql_real_escape_string($params['location']), mysql_real_escape_string($params['salary_from']), mysql_real_escape_string($params['salary_to']), mysql_real_escape_string($params['frequency']), mysql_real_escape_string($params['jobtype']), mysql_real_escape_string($params['description']), mysql_real_escape_string($params['specifications']), mysql_real_escape_string($params['benefits']), mysql_real_escape_string($params['email']) ); $result = mysql_query($query); if(!$result) { return false; } $job_id = mysql_insert_id(); if(!empty($params['cats'])) { foreach($params['cats'] as $cat_id) { $query = sprintf("INSERT INTO jobs2categories set category_id = '%s', job_id = '%s'", mysql_real_escape_string($cat_id), mysql_real_escape_string($job_id) ); $result = mysql_query($query); if(!$result) { return false; } } } return true; } ?> Here is the code i use to pull the job data: <?php $query = "SELECT id, agent, branch, title, location, salary_from, salary_to, frequency, jobtype, description, specifications, benefits, email, created_at FROM jobs WHERE branch = '$ulevel' ORDER BY id DESC "; $result = mysql_query($query) or die('Error : ' . mysql_error()); if(mysql_num_rows($result)==0) { echo(' <span><strong>No Jobs from '.$ulevel.' Listed</strong></span> '); } while(list($id, $agent, $branch, $title, $location, $salary_from, $salary_to, $frequency, $jobtype, $description, $specifications, $benefits, $email, $created_at) = mysql_fetch_array($result, MYSQL_NUM)) { ?> <tr> <td class="col-first"><?php echo date('d.m.Y',strtotime($created_at));?></td> <td class="col-second">### CATEGORY NAME ###</td> <td class="col-third"><?php echo safe_output($title); ?></td> <td class="col-fourth"><?php echo safe_output($location); ?></td> <td class="col-five"><?php echo safe_output($jobtype); ?></td> <td class="col-sixth"><?php echo safe_output($agent); ?></td> <td class="col-seven">3</td> <td class="row-nav"><a href="#" class="table-edit-link">Edit</a> <span class="hidden"> | </span> <a href="javascript:delArticle('<?php echo safe_output($id); ?>');" class="table-delete-link">Delete</a></td> </tr> <?php } ?> How would i display the related category name in the table above? Any help is appreciated