missyevil
Members-
Posts
21 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
missyevil's Achievements
Newbie (1/5)
0
Reputation
-
Thanks :)
-
Ahhh, thank you Ken! This really isnt as easy as I first hoped... Anyone suggest the easiest way of setting this up? I really am completely new to all this!
-
Hi! I'm having issues with the mail function too, and I'm not sure if its me being really *really* stupid, or my system is shafted. I have the simplest bit of code ever that is just: [code]mail("$email", "Hello!", "This is the content of the message", "From: Webmaster<$from_email>");[/code] I'm just running it locally at the minute, and I have configured my php.ini file so that "SMTP = localhost" and "smtp_port = 25", but I'm still gettin an error when I try to run it!! This is the error in case it helps: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\Apache Group\Apache2\htdocs\Project\mail.php on line 5 I'm totally stumped. Everythin I've read seems to say that this should work fine - its the simplest thing the mail function can do!! Help??
-
Hi! Basically I want to delete entries from 3 tables - table1, table2 and linktable. I have something along the lines of: [code]DELETE FROM table1, table2, linktable WHERE linktable.id1=table1.id AND linktable.id2=table2.id[/code] BUT, I'm getting syntax errors returned. I'm very new to MySQL and PHP, so sorry if this is a really stupid question! Any help much appreciated.
-
Hi, this is probably a really simple problem, but I can't seem to get the syntax for the command right! I'm trying to delete related entries in 2 MySQL tables simultaneously. What I'm trying looks like this: [code]DELETE FROM cvs, jscvs WHERE cvid = '$cvid'[/code] Where cvs and jscvs are the two tables, and cvid is the primary key in each. When I run it tho, I get an error, and nothing is deleted. Any ideas?
-
Finding records with timestamp more than a given time ago
missyevil replied to missyevil's topic in MySQL Help
OK, I changed the js_last_login column type to DATETIME (thanks for the tip - didn't realise there was a problem with TIMESTAMP), and now it is working!! Thanks :) -
Finding records with timestamp more than a given time ago
missyevil replied to missyevil's topic in MySQL Help
TIMESTAMP... Should it be a simple DATETIME? -
Hi, I've been trying to get a query working that returns a list of users stored in my database, who last logged in over 90 days ago. I've got this so far: [code]SELECT jobseekers.forename, jobseekers.surname, jslogin.email, jslogin.js_last_login FROM jobseekers, jslogin WHERE jslogin.js_last_login <= SUBDATE(NOW(), INTERVAL 90 DAY);[/code] But when I run it I get an empty set, when there really should be some entries. Am still a total newbie, but I hope its clear what I'm trying to do!! Thank you in advance for any help.
-
Ahh, have realises my mistake - used $jsid = $_POST['jsid']; rather than $jsid = $_SESSION['jsid']; Thanks for help!
-
Its not being passed as a variable.... It *should*, as the user has to login to get to the editing page. I'm using session_start(); at the beginning of each of my scripts. What else am I supposed to be doing?
-
Hmm, it doesn't... The echo is UPDATE jobseekers SET forename='new_forename', surname='new_surname' WHERE jsid='' What am I doing wrong that $jsid isn't being set right??
-
Think I have a smiilar problem, but can't figure it out from the past posts.... I'm trying to update info in my database, but the stuff isnt actually updating. Here's my code: [code]<?session_start(); include 'db.inc.php'; if (isset($_POST['forename'])): $forename = $_POST['forename']; $surname = $_POST['surname']; $email = $_POST['email']; $password = $_POST['password']; $jsid = $_POST['jsid']; $sql = "UPDATE jobseekers SET forename='$forename', surname='$surname' WHERE jsid='$jsid'"; if (mysql_query($sql)) { echo '<p>Your details have been updated.</p>'; } else { echo '<p>Error updating details: ' . mysql_error() . '</p>'; } else: $jsid = $_GET['jsid']; $jobseeker = mysql_query( "SELECT forename, surname, email, password FROM jobseekers, jslogin WHERE jobseekers.jsid='$jsid'"); if (!$jobseeker) { exit('<p>Error fetching jobseeker details: ' . mysql_error() . '</p>'); } $jobseeker = mysql_fetch_array($jobseeker); $forename = $jobseeker['forename']; $surname = $jobseeker['surname']; $email = $jobseeker['email']; $password = $jobseeker['password']; // Convert special characters for safe use // as HTML attributes. $forename = htmlspecialchars($forename); $surname = htmlspecialchars($surname); $email = htmlspecialchars($email); $password = htmlspecialchars($password); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head></head> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <p>Edit jobseeker details:</p> <label>Forename: <input type="text" name="forename" value="<?php echo $forename; ?>" /></label><br /> <label>Surname: <input type="text" name="surname" value="<?php echo $surname; ?>" /></label><br /> <label>Email: <input type="text" name="email" value="<?php echo $email; ?>" /></label><br /> <input type="hidden" name="jsid" value="<?php echo $jsid; ?>" /> <input type="submit" value="SUBMIT" /></p> </form> <?php endif; ?> </body> </html>[/code] I'm getting the message that details *have* been updated, but when I check the database, nothing has been. Is probably something really simple, but I just can't see it! If anyone can shed some light it'd be much appreciated.
-
I agree! I know I'll have to be more secure, but at the minute I'm not *too* worried, as currently this is just a project for uni.
-
Search is now working, with a mixture of selections from menus, radio boxes, and a keyword search :D Thanks for help. Gonna post the code for anyone who's interested: [code]// the basic SELECT statement $select = 'SELECT *'; $from = ' FROM vacancies'; $where = ' WHERE 1=1'; $order = ' ORDER BY closing_date DESC;'; $job_area = $_POST['job_area']; if ($job_area != '') // a specific area has been specified { $len=count($job_area); $count=0; $where .= ' AND ('; foreach($job_area as $select_area) { echo 'My select: '.$select; $where .= " job_area='$job_area[$count]'"; if($count<$len-1) {$where .= ' OR ';} $count++; } $where .= ') '; } $job_location = $_POST['job_location']; if ($job_location != '') // a specific location has been specified { $len=count($job_location); $count=0; $where .= ' AND ('; foreach($job_location as $select_location) { echo 'My select: '.$select; $where .= " job_location='$job_location[$count]'"; if($count<$len-1) {$where .= ' OR ';} $count++; } $where .= ') '; } $job_status = $_POST['job_status']; if ($job_status != '') // a specific status (ft/pt) has been specified { $len=count($job_status); $count=0; $where .= ' AND ('; foreach($job_status as $select_status) { echo 'My select: '.$select; $where .= " job_status='$job_status[$count]'"; if($count<$len-1) {$where .= ' OR ';} $count++; } $where .= ') '; } $job_type = $_POST['job_type']; if ($job_type != '') // a specific job type has been specified { $len=count($job_type); $count=0; $where .= ' AND ('; foreach($job_type as $select_type) { echo 'My select: '.$select; $where .= " job_type='$job_type[$count]'"; if($count<$len-1) {$where .= ' OR ';} $count++; } $where .= ') '; } // Get keyword(s) $keyword = $_POST['key']; $trimmed = trim($keyword); //trim whitespace from the stored variable if (isset($keyword)) { $where .= " AND job_title LIKE \"%$trimmed%\""; } ?> <h3>Search Results</h3> <hr /> <table> <? $jobs = mysql_query($select . $from . $where . $order) or die (mysql_error()); if (!$jobs) { echo '</table'; exit('<p>Error retrieving vacancies from database! <br />'. 'Error: ' . mysql_error() . '</p>'); } while ($job_area = mysql_fetch_array($jobs,MYSQL_ASSOC)) { echo "<tr>\n"; $vacid = $job_area['vacid']; $job_title = htmlspecialchars($job_area['job_title']); echo "<td>$vacid</td>"; echo "<td>$job_title</td>\n"; echo "</tr>\n"; }[/code] ?>
-
Ahhhh, that look about right.... I'll have a play and see what happens. Thanks!!