Jump to content

nzol

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

nzol's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. You may want something like this: $midnighthour = "23"; $midnightmin = "59"; $hour = date("G"); $hoursminutes = $hour*60; $minutes = date("i"); $minutesfrommidnighta = $hoursminutes+$minutes; $minutesfrommidnightb = 1440-$minutesfrommidnighta; $username = $_GET['username']; $getcookie = $_COOKIE['user']; if($getcookie==0) { $createcookie = setcookie("user",$username,time()+$minutesfrommidnightb); } else { if($getcookie==$username) { // the code you want to execute if the user cookie is there } else { // the code you want to execute if the user cookie does not exist. } }
  2. HI all, I need help to get data out of an array using a while loop or something simalar. What I have, is this: <?php $data = array( 1 => array( "name" => "Jordan Smith", "age" => "16 Years 0 Months" ), 2 => array( "name" => "Olivia Smith", "age" => "13 Years 12 Months" ) ); Now, what I did, is I constructed this: while($result=$data[1]) { echo $result['name']; } But it echoed "Jordan Smith" for infinity down the page. If anyone can help be do this, it will be great. Thanks
  3. @Pikachu2000: You are absolutely correct! I accidentally put $ before the field name! Thank you very much.
  4. If you want to filter these out, you could use: $data = $_POST['data']; $newdata = str_replace($data , " ", "£"); //this replaces any occurences of £ with a space
  5. Because I tried the query and it said; You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ='1' AND alas='Login failed' AND ns='Page'' at line 1 If you know if it does please tell me! Thanks
  6. So what you need is: FOR ALL USERS: send.html <form action="process.php" method="POST"><br /> <b>Send message to all users:</b> <br />Subject: <input type="text" id="subject"> <br />Message:<br /> <input type="textarea" id="message" <br /><input type="Submit"> </form> process.php <?php include('headers.php'); $subject = $_POST['subject']; $message = $_POST['message']; $getusers = mysql_query("SELECT * FROM users"); while($result = mysql_fetch_array($getusers)) { $emailaddress = $result['emailaddress']; mail($emailaddress,"Subject","Message","From:whoever@whatever.com"); } FOR AUTHENTICATED USERS ONLY: send.html <form action="process.php" method="POST"><br /> <b>Send message to authenticated users:</b> <br />Subject: <input type="text" id="subject"> <br />Message:<br /> <input type="textarea" id="message" <br /><input type="Submit"> </form> process.php <?php include('headers.php'); $subject = $_POST['subject']; $message = $_POST['message']; $getusers = mysql_query("SELECT * FROM users WHERE authenticated='yes'"); while($result = mysql_fetch_array($getusers)) { $emailaddress = $result['emailaddress']; mail($emailaddress,"Subject","Message","From:whoever@whatever.com"); } Hope this is what you want.
  7. I want to get data from mysql database with more than two fields matching in the WHERE clause. For example I want something like this: SELECT * FROM users WHERE town='$town' AND age='$age' AND firstname='$firstname'"); Now for some reason, Mysql does not allow more than two specifications in the WHERE clause. If someone could please tell me away to get around this, it would be very appreciated.
  8. @DavidAM >> THANK YOU SOOOOO MUCH! I SOLVED IT.
  9. Hi all, Can anyone please help me with my problem. I want to know how to round a decimal - eg. 12.34 to the nearest .10 so it would be 12.30 or if 12.35 go to 12.30 or 12.40. // my example: round(12.34, 2); // I want to to go to: 12.30 Any help is greatly appreciated.
×
×
  • 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.