Jump to content

J.Daniels

Members
  • Posts

    143
  • Joined

  • Last visited

    Never

Everything posted by J.Daniels

  1. With the two pieces of code you have provided, and assuming they are they in the same if/else statement, $arr_email only gets added to if $_POST['Submit_Auto'] is true and $_POST['Email_Auto'] is false. So when Email_Auto is submitted, it goes into the elseif statement where you are only trying to read from the $arr_email array.
  2. At a quick glance it appears that the query is ok. Try echoing $myquery to see what is being sent to MySQL.
  3. I'm not sure why you would need to do this, but you can have the second function call the first: function test1($blah) { ... } function test2($blah) { return test1($blah); }
  4. mysql_last_insert_id() only returns an id if there was a previous INSERT statement. Unless you have performed an INSERT before your code, it will return 0. If you want both columns to have the same id, you will have to do the INSERT, then UPDATE the record with mysql_last_insert_id(). If this is what you are looking for, I am curious as to why you would need two columns with the same id.
  5. sum(e.amount) is going to return the sum of the amount column for all returned rows. Did you want to include only the rows that were greater than 0?? If so, change: amnt > 0 to: e.amount > 0
  6. Working from your display code, you have a semi-colon after the while and you do not need the foreach: <?php while($row=mysql_fetch_array($query, MYSQL_ASSOC)) { ?> <div class="id_box"><?=$row['internal']?></div> <div class="from_box"><?=$row['name']?></div> <div class="from_email_box"><?=$row['email']?></div> <div class="msg_status_box"><?=$row['status']?></div> <div class="reply_status_box"> <a href="?more=<?=$row['internal']?>">more</a> </div> <div class="updated_box"> <? if(empty($row['reply_time'])){ print "".$row['time']." on ".$row['date'].""; } else{ print ""; } } ?> Also, before the while loop, you can echo out the number of rows to make sure there are two rows returned: echo mysql_num_rows($query);
  7. You don't have a column called user_id in your database: $query1="select * from type order by user_id";
  8. Sorry about that echo "<td class='selOverview'><a href=\"javascript:ReadAnnouncement('".$row['id_press'].";','".$row['id_press'].";')\">" . $row['title'] . "</a></td>"; Try this. There may be an extra quote in the javascript portion.
  9. It looks like you are missing a quote on the href and not closing the a tag echo "<td class='selOverview'><a href=\"javascript:ReadAnnouncement(' $row['id_press'];',' $row['id_press'];')\">" . $row['title'] . "</a></td>";
  10. The only way around this is to use JavaScript to change the type of the input
  11. You are missing a closing parenthesis mysql_query("insert into `demo_users` (`name`, `company`, `address`, `city`, `state`, `zip`, `phone`, `email`) values ('$name', '$company', '$address', '$city', '$state', '$zip', '$phone', '$email')") or die(mysql_error());
  12. Try adding quotes around $_POST['service'] $sql = "UPDATE rounder SET staff_name = '" . $_POST['staff_name'] . "' WHERE service = '".$_POST['service']."'";
  13. This: <form action="changestaff-commit.php"> needs to be: <form action="changestaff-commit.php" method="post">
  14. Personally, when I enter dates into a database, I use MySQL's DATE types. This allows you to order by date, or select by a range of dates. However, using your database structure, you can order your results by multiple columns. $nextEvents = "SELECT * FROM calendar ORDER BY year, month, day DESC LIMIT 0, 3"; This should order the records by year, then month, then day in a descending order. The LIMIT only returns the first 3 records.
  15. foreach foreach ($_SESSION['openChatBoxes'] as $chatbox => $time) { foreach iterates over the array $_SESSION['openChatBoxes'] and assigns the keys of the array to $chatbox and their values to $time
  16. This is what I'm assuming you are trying to do with your code. <?php session_start(); include 'Functions.php'; include 'Database.php'; $username = Clean($_POST['username']); $password = Encrypt($_POST['password']); $sekret = Clean($_POST['sekret']); $POST = count($_POST); $GET = count($_GET); $length = strlen($_POST['username'] || $_POST['password']); if ($_SESSION['token'] != $_POST['token']) { echo "Invalid submission."; exit(); } if ($POST == 4 && $GET == 0) { if ($length > 32) { $sql = "SELECT * FROM `users` WHERE `username` = '$username' AND `password` = '$password'"; $results = mysql_query($sql) or die (mysql_error()); if (mysql_num_rows($results) > 0) { header('Location:hello.php'); } else { print "Error, Account Does Not Exist"; } } else { print "Submission Error, Post Varibles Too Long"; } } elseif ($POST < 4 && $GET == 0) { print "Error, Please Enter All Field's"; } else { print "Submission Error, Too Man Post Varibles."; } ?> I am just a little unclear on what you are trying to do with this part: $length = strlen($_POST['username'] || $_POST['password']); I think (I haven't tested this) this will always return a length of 1 as it is a conditional check.
  17. Also, you need to switch the two else statements. The first if checks if the username and password have been supplied. The second if checks if they match any record in the database <?php session_start(); include 'Functions.php'; include 'Database.php'; $username = Clean($_POST['username']); $password = Encrypt($_POST['password']); if (isset($username) && isset($password)) { $sql = "SELECT * FROM `users` WHERE username = '$username' AND password = '$password'"; $results = mysql_query($sql) or die (mysql_error()); if (mysql_num_rows($results) > 0) { header('Location:hello.php'); } else { print "Account Does Not Exist"; } } else { print "Please Enter All Field's"; } ?>
×
×
  • 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.