Jump to content

TOA

Members
  • Posts

    623
  • Joined

  • Last visited

Everything posted by TOA

  1. Correct. What he gave you will complete the script after your query.
  2. What does it do/not do? Any errors? Not sure what you're trying to do here, but this invalidly sets a variable (so its not getting set) and then you echo it incorrectly too I think you mean this? $usr = $_SESSION['usr']; echo $usr;
  3. Change it to NOT IN then. It might help to show your most recent code if that doesn't work.
  4. Ok, I think I get you. You want to make sure it's not in the other table AND that the user is a valid/registered user or whatever. Take that original sql statement and add an AND condition that checks for the user: SELECT * FROM Table1 WHERE Field NOT IN (SELECT * FROM Table2) AND Username IN (SELECT Username FROM Table3) I think that's what you mean. If I'm misunderstanding, I appologize.
  5. Not sure what you mean. Check if a session variable exists? That would be if (isset($_SESSION['yourvariable'])) { do something }
  6. Can you be more specific? I made a typo when I posted it, the comma in the implode should be a semi-colon. But we need more details Edit: also, use $tostring instead of $to in the mail function
  7. If I understand you correctly, when you go back to the form, add a condition to the query that checks that the info is not in the other table. Ex: SELECT * FROM Table1 WHERE Field NOT IN (SELECT * FROM Table2) Hope I understood you correctly.
  8. Your main problem was you weren't calling the mysql_query function, and you needed quotes around your sql string. You also would have gotten a resource id error because you needed to deal with the result accordingly. Try this $sql = 'select email from newsletters where mens = 1'; $result = mysql_query($sql); while ($row = mysql_fetch_assoc($result)) { $to[] = $row['email']; } $tostring = implode(';', $to); // had a comma in here should be semi-colon to separate email addresses *Edit* Beat me to it. My example joins them together
  9. You might also want to look into relational databases Then follow the tutorial suggested by cssfreakie to handle the information when you pull it from the database. Here's a quick jump to get you started. The user creates an account and the data is stored in the user table. All your jobs are stored in the Jobs table. When a user wants to follow, apply for a job or whatever, you put the users id and the jobs id in the JobList table that then holds all the jobs a user is interested in. Follow? A working system will be a bit more complex than this simplified example, but it should get you started. Hope it helps. User <-- table userid, password <-- fields Jobs<-- table jobid, jobtitle, jobdetails<-- fields JobsList<-- table userid, jobid<-- fields
  10. As delickate said, a db field is the way to go. His method for sending would work also, but what if no one opens the page that day? The email would never be triggered. IMO, the better way would be a cron job (cron jobs on apache, scheduled tasks on IIS- if my memory serves.) Just my 2 cents
  11. Oh, no, I was referring to the article; I'm using it in a very simple way, so I don't think my idea requires decimals. Maybe I just didn't understand what you meant Actually, I just ran it and it's exactly what I was needing, major thanks. I thought I was familiar with your "funny money" up there but never heard of a toonie. My family vacations in the Whiteshell almost every year..
  12. I only thought about it in change, so maybe I should just start there I think it will work without decimals. I'll look into it, thanks. And thanks for the script, I'll see what it does shortly
  13. I need to know what change to return when making a purchase.. Is there a mathematical formula or something for this? Ex: The change from a purchase is 95 cents. I need to know that it should be 3 quarters and two dimes that should be returned. Thanks for reading
  14. You ain't kiddin'. I work in the healthcare field. Do not take the consequences lightly. If I'm understanding your OP, I would just store permissions in the db with the user data, so if they have the right permission, they can view/export data, but this is based off very little information. But I would take Nightslyr's suggestion if I were you; nothing personal, more of a CYOA kinda deal.
  15. <?php /* should give you an email that looks like: Subject: Call-back John Doe 555-555-5555 After 6 PM user@email.com */ if (strtolower($_SERVER['REQUEST_METHOD']) == "post") { // process code here $to = "THE EMAIL ADDRESS YOU WANT IT SENT TO HERE"; $subject = "Call-back"; $body = ""; foreach ($_POST as $value) { $body .= "$value\r\n"; } if (!mail($to, $subject, $body)) { // handle error echo "Sorry, there was an error"; } else { // handle successful send echo "Email was successfully sent"; } } else { // display form here ?> <form action="" method="post"> <input type="text" name="Name" value="" /> <input type="text" name="Phone" value="" /> <input type="text" name="BestTime" value="" /> <input type="text" name="Email" value="" /> <input type="submit" value="Submit" /> </form> <?php } ?> Note that this has no validation or cleansing involved. It's just to get you started.
  16. 1. Build your form 2. In the processing, add the $_POST data to your email body 3. Use mail() to send the email Any mail script you find on google will do this. If you make an attempt, I'm sure the community here will be more than happy to help if you run into trouble.
  17. Also, this typo would cause a problem sometime anyway so you should probably fix it at the same time since it's just a few lines after $rs = myslq_query( $sql, $conn ) or die( "Could not execute query" ); should be $rs = mysql_query( $sql, $conn ) or die( "Could not execute query" );
  18. *edit* didn't read full post So you're just not getting the time between echo's?
  19. Same problem as before...take the single quotes off the column and add it to the value (which would be $id) in the where clause. $query = mysql_query("UPDATE page SET title='$title', keywords='$keywords', description='$description', menu='$menu', content='$content' WHERE pageID= '$id'") Back ticks are for tables and columns, single quotes are for values. You did it right on the rest of them as you can see
  20. I used this tutorial to build a script. http://www.phpfreaks.com/tutorial/php-basic-database-handling Basically, without reading the tutorial, here's what it does: allows you to enter/update db entries via an html table. (very useful..that you crayon violent) When submitted, it checks to see if anything has been entered in the new input or updated in the previous inputs and acts accordingly. I also have this js function, that checks for a valid date format and age restrictions. <script type="text/javascript"> function checkAge(input) { var today = new Date(); var d = document.getElementById(input).value; if (d == "") { showMessage('empty',input); return false; } if (!checkFormat(input)) { // check valid format return false; } d = d.split("-"); var byr = parseInt(d[0]); var nowyear = today.getFullYear(); if (byr >= nowyear || byr < 1900) { // check valid year showMessage('impossible',input); return false; } var bmth = parseInt(d[1],10)-1; // radix 10! if (bmth <0 || bmth >11) { // check valid month 0-11 showMessage('impossible',input); return false; } var bdy = parseInt(d[2],10); // radix 10! var dim = daysInMonth(bmth+1,byr); if (bdy <1 || bdy > dim) { // check valid date according to month showMessage('impossible',input); return false; } var age = nowyear - byr; var nowmonth = today.getMonth(); var nowday = today.getDate(); var age_month = nowmonth - bmth; var age_day = nowday - bdy; if (age < 18 ) { showMessage('child',input); return false; } else if (age == 18 && age_month <= 0 && age_day <0) { showMessage('child',input); return false; } } function checkFormat(input) { var validformat = /\d{4}\-\d{2}\-\d{2}/; var d = document.getElementById(input).value; if (!validformat.test(d)) { // check valid format showMessage('format',input); return false; } return true; } function showMessage(messagetype, input) { if (messagetype == "format") { alert ("Invalid date format - please re-enter as YYYY-MM-DD"); } else if (messagetype == "impossible") { alert ("Impossible year/month/day of birth - please re-enter."); } else if (messagetype == "child") { alert ("Only adults are allowed."); } else if (messagetype == "empty") { alert ("Nothing was filled out."); } document.getElementById(input).select(); } function daysInMonth(month,year) { // months are 1-12 var dd = new Date(year, month, 0); return dd.getDate(); } </script> As you can see, I call it with the id of the input I want to check. What heppens currently is that it always calls back the empty error when updating a previous entry, because it's only checking the one input. What I need to do is use it to iterate through all the date fields in the form, and if the new input is not filled out, skip it. Hope that makes sense. Any suggestions?
  21. Thanks for the suggestion. What the problem was: I hadn't given the input an id. Now I've encountered a new problem though. I'll start a new post about it; it's a different problem.
×
×
  • 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.