Jump to content

Drewdle

Members
  • Posts

    75
  • Joined

  • Last visited

    Never

About Drewdle

  • Birthday 06/04/1989

Contact Methods

  • MSN
    DrewGarside@Live.co.uk

Profile Information

  • Gender
    Male
  • Location
    UK, Manchester

Drewdle's Achievements

Member

Member (2/5)

0

Reputation

  1. I have a user database so members can log in to my site, what I want to do is when they first login, I want a message to pop up for them to confirm they have read something, but once they confirm it has been read I don't want it to pop up anymore after that, how would I do that? Thanks
  2. I've read most of them...it confuses me a bit.
  3. I'd like some help understanding how to use validation for form field characters please! if(!preg_match("/^[a-zA-Z]+$/",$_POST['fname'])) { echo "Invalid Entry"; } Now, where do I specify what characters to check? Is it this part: ("/^[a-zA-Z]+$/",$_POST['fname']) How would I add other things? I believe that allows upper and lower case letters only, how would I add things like '@' '-' '_' etc etc...would I just add them to the list inside the square brackets or is it a new set of brackets?... What about numbers? Would it be "/[0-9]/" ? Also, can I swap $_POST['fname'] with just a plain variable ($fname)?. (oh and does it need the '/' inside each quote?) Thanks! OH and also! if I was to check several fields, and if all is ok execute a script would I need to have elseif/else statements of could I have a new if statement for each and then just run the script below it? Thanks again!
  4. Yep, I've done it. Took a while, but I did it. I was hoping for an easier way lol.
  5. I have this script running: <?php $query = mysql_query("SELECT * FROM jobs WHERE event = 'Yes' ORDER BY title"); while ($row = mysql_fetch_array($query)) { ?> How do I check if a field is empty and NOT display it...? For instance it has a 'applied' field, if that is empty I dont want it to display, however I still need the event = 'Yes' part.
  6. Lol. Your thinking about it now aren't you? Giving your kettle a small hard drive, just big enough to hold a script to turn it on when you click a button on your computer?... Or something like that anyway...
  7. I swear the help I've had on here is second to none. It seems php can do damn near anything...don't suppose you have a snippet to make it make me a cup of tea do you?...Lol. Thanks man!
  8. Is there a way to add a date of birth into a mysql but display it as the age?... e.g Mysql = 04/06/89 Display = 21
  9. I'm trying to implement a system on my site where users can apply for 'jobs'. The job would be placed in a mysql via a form, then displayed on a page, from there I want to add a link where users can apply to do the job and then I would be able to view who applied for what job. I'd like direction to the best way of doing something like this? Thanks.
  10. It was defined in the included file as something else but ive changed it now incase that was the problem...still wont store the url? <?php include ('base.php'); $id = $_GET['id']; if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 20000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "imgs/pictures/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } $file = $_FILES["file"]["name"]; mysql_query( "UPDATE `chillp_security`.`staff` SET `picture` = \'imgs/pictures/$file\' WHERE `staff`.`id` = $id"); ?>
  11. Can anyone tell me whats wrong with this: The file uploads fine, the url however does not get posted to the database? I added a 'or die' but it didn't execute...Do I need to move the query higher up the script? <?php include ('base.php'); $id = $_GET['id']; if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 20000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "imgs/pictures/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } $file = $_FILES["file"]["name"]; $sql = "UPDATE `chillp_security`.`staff` SET `picture` = \'imgs/pictures/$file\' WHERE `staff`.`id` = $id;"; ?>
  12. What's the best way to do previous employer form: It would have field like: Company Name | Position Held | Date Started | Date Ended | Company Address The only problem I have is Joe Bloggs might have 7 previous jobs and Fred Biggins might have only 3 previous jobs... How would I create a table for such a form? Would I have to have them enter each job one at a time and create an add row query?... I think I could add a hidden username field so when I call it back it would display only those rows relevant to that username....
  13. Don't suppose you have a trick up your sleeve for creating and displaying forms with an unknown entry value?...or a trick to make my below guess easier? To explain further its a previous employers form, so it would have fields like: Company Name | Position Held | Date Started | Date Ended | Company Address The only problem I have is Joe Bloggs might have 7 previous jobs and Fred Biggins might have only 3 previous jobs... How would I create a table for such a form? Would I have to have them enter each job one at a time and create an add row query?... I think I could add a hidden username field so when I call it back it would display only those rows relevant to that username.... I dont expect you to provide the code, just guidance towards the proper method!
  14. Genius. I was looking at string replace functions and all that riff raff but that one liner is perfect! Thanks!
×
×
  • 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.