Jump to content

ajsuk

Members
  • Posts

    34
  • Joined

  • Last visited

    Never

Posts posted by ajsuk

  1. Hey there, another nooby question I'm sure but again I'm stuck so I shall have to ask. ;)

    As the title says really, I'm looking to grab email addresses from a database to make up a recipients list for this email script...
    I've got this which does the job but having a script run 500 times over sending emails doesn't sound the best of ideas...
    [code]
    <db connect code etc...>

    while($row = mysql_fetch_array($result))
    {
    $to = $row['email'];
    $subject = "Test Email";
    $message = "Test Email Message";
    $from = "someone@mydomain.com";
    $headers = "From: $from";
    mail($to,$subject,$message,$headers);
    }

    mysql_close($con);
    ?>[/code]
    Is there some way I can store the results in a variable to be used as the mail-to value for sending to all at once rather than one by one?

    Thanks for any help you can give! :)
  2. Here there, I'm _very_ new to MySQL (as in started today) so please be gentle hehe.

    I'm playing around with making a simple login system using a form to check login details and display results belonging to that user if login is correct. I've got this all working fine but ofcourse if the details are wrong it'd be nice if I could get it to print something rather than the user being left with a blank page.

    I'm guessing I need to check the form results (user and pass) against the the database records. I've tried this with an if statement but it doesn't seem to want to know.

    Any help would be great, thanks in advance! =)

    Heres my poor n00b attempt:
    [code]<?php
    $nameresult = $_POST['name'];
    $passresult = $_POST['pass'];

    $con = mysql_connect("localhost","<dbnamehere>","<dbpasshere>");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }

    mysql_select_db("db_testing", $con);

    $result = mysql_query("SELECT * FROM info WHERE name='$nameresult' && pass='$passresult'");

    while($row = mysql_fetch_array($result))
      {
      echo "Welcome ".$row['name'] . " - " . $row['email'] . " - " . $row['pass'];
      echo "<br />";
     
    if ($nameresult != $row['name'] && $passresult != $row['pass'])
      echo "login Bad";
      }

    mysql_close($con);
    ?>[/code]
  3. Well I would of posted something but its all in my head at the moment.
    I havn't really a clue what how to do what I want and so havn't got any examples however I'll throw in what little I think is right...

    [code]
    function agecheck()
      {
    if ($age < 21)
    echo $age."(Under age)";
    else
    echo $age;
      }

    $to = "someone@hotmail.com";
    $subject = "Test mail";
    $message = "Here are the results: $firstname $lastname of agecheck() years old...";
    $from = "someonelse@hotmail.com";
    $headers = "From: $from";
    mail($to,$subject,$message,$headers);
    echo "Mail Sent.";
    [code][/code][/code]
  4. Hey there, I'm having trouble doing what I want to do with emailing some form results.

    I know that you can include results as variables with no trouble but the problem comes for me because some of my form results have to be processed with if statements and so on meaning its not always just a direct dump from the form field for example. I'm guessing I need to be using a function or something? I've tried messing with them but I can't seem to get the email message to accept/include anything other than variables and static text.

    Any help would be greatly appreciated!

    Thanks in advance,

    Andy. =)
  5. Ok, after some playing I've found that the get form method will produce the URL for me and display what I want.

    The only problem is that form forgets whats been filled in when submited, which is a pain if the user perhaps wants to keep most of  the outfit as is and only edit one or two clothing options...

    Is there a way I can get the form to recall the submited info, or even pull back the values from the newly generated url..?

    Thanks,

    A
  6. Hey, I'm looking to make up a dressing room builder type system with custom clothing parts to select from.
    I'm thinking of doing it using a form which then hopefully generates the correct address to display the custom outfit.

    I'd somehow like to produce the page so it displayed:

    [u]The output area[/u]

    {tshirt}
    {pants}

    [u]Builder[/u]

    {form}

    [hr]

    Just as a simple example the form could consist of two sets of radio buttons with red, green & blue options for shirts and pants...
    Once the form was completed and submited it'd need to tell the address bar to generate something like this: http://mydomain.com/?shirt=green&pants=blue

    Which would then change the output display on the page and also the URL would be there to copy incase anybody wanted to directly link to an outfit.

    Thats me pretty much done, thanks for any help or suggestions I get. I'm no good at this stuff at all so it'd be much appreciated!

    -A
  7. Hey there, me again with another request.  :)

    I'd like to build a special custom countdown timer. What makes it special (and more complicated :() is its not going to countdown to a specified event(time,date) as the 100's of other scripts out there do.

    Heres what i'd like it to do...

    Have 4 cycles of 4.5 Days(108 hours)
    Display how long it is to each new cycle start. - For example "2 Days, 8 hours and 5minutes until cycle#3"
    Somehow be able to reset/calibrate/specify the countdown and cycle if the webserver went down or something.
    This is continues btw... (except if the server goes down ofcourse;))
    I think thats everything...  :o

    I'm guessing PHP is the way to go with this as we could still use the server to count with?
    Thanks a bunch for any help you can give! This ones kicking my backside.  :D
  8. Yeah  :-\

    So is there any way to change the "Balblablax" to "<? echo $status[2] ?>" without it getting annoyed?

    the "<? echo $status[2] ?>" bit is supposed to trigger another script earlier in the include file to produce a server status (from server #3) and I [u]only[/u] want it to display that 3rd server result in this case. So this is why I'm trying to tell it to echo that status in this example.

    If theres any other way to do it, I'm all ears. Sorry for the confusion, I'm not up on all this.  :(
  9. So I'd like to be able to echo php in to an include, but php really doesn't seem to like me trying to include php in an echo.

    Heres an example of what I've tried, hopefully you can grasp the idea of what I'm trying to do. :)

    Trying to echo in bit of PHP:
    [code]<?php
    $text = '<? echo $status[2] ?>';
    include("/blahblah/myinclude.php")
    ?>[/code]

    Then output in to the included file:
    [code]<?php
    echo "$text"; // Text Inc
    ?>[/code]

    It doesn't like being formated like that, could somebody tell me what I'm doing wrong and how to fix it?

    Thanks in advance!  8)
×
×
  • 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.