Jump to content

schilly

Members
  • Posts

    870
  • Joined

  • Last visited

    Never

Everything posted by schilly

  1. ooops. sorry. it's substr() not sub_str().
  2. my OOP isn't great but I believe you need to create a template object in order to call echome. you can't just include it in your engineload. plus inheritance only goes the other way. i don't think a globalconf object could call a template function unless you casted it? where as a template object would inherit all the globalconf member functions because it extends globalconf.
  3. if $upuser is your db row then you aren't getting 3 separate db rows. you're pulling from the same row. if you want from three different rows in your result set then i think you want something like this: //get level from three consecutive rows in the result set from the db query $threeup1 = mysql_result($dbresults,0,'level'); $threeup2 = mysql_result($dbresults,1,'level'); $threeup3 = mysql_result($dbresults,2,'level'); //make sure all are greater than or equal to 1 if($threeup1 >= 1 && $threeup2 >= 1 && $threeup3 >= 1){ //level up }
  4. your anchor tag isn't closed. other than that the code looks fine. can you post more of the code? please wrap it in the php reply tag too.
  5. this is likely your culprit. if(($username == $_POST['username']) && ($password = $_POST['password'])){ $password = $_POST['password'] should be $password == $_POST['password'] as a suggestion, you should hash you passwords instead of storing in plaintext.
  6. Ok so is that one index per table? how would that work a multiple table query?
  7. Thanks Fenway. looks like i need to revamp a ton of indexes. I didn't know it could only use one =(
  8. so if i have a table with multiple single column indexes and i do something like: select * from table where column1 = value1 and column2 = value2 etc etc. and there is an index for column 1 and column 2, MySQL will only use the index on one of them and not both?
  9. you want this in your if statement. if any of those variables are empty ( "", NULL, 0 or false) it will result in true and trigger your error message. if (empty($name) || empty($email) || empty($number) || empty($message)) { If you want the POST data still in the form you will either need to POST the form to the same page or put the data in a session then use header to redirect back to the form. Easiest is to POST to the same page then do value="<?php echo $_POST['business']; ?>" in your text fields, etc. Then you can put your error message in a variable and display that in the page as well.
  10. was that suppose to mean something? I told you what was wrong and gave you the solution.
  11. if($_SESSION['logintime'] <= $session_logout){ header("location:Expired.php"); }else{ so your checking to see if the login time is less than time() + 900. This will always be true which is why it keeps loading that page. you want to do $_SESSION['logintime'] + 900 <= time()
  12. ya if you changed to function to: function check_user($secret_key){ and your function call to $player = check_user($secret_key); it should work that way as well.
  13. when in a function, it has a separate namespace so $secret_key is not defined in that function. either pass it into the function or put global $secret_key; at the top of your function.
  14. foreach($_POST['data'] as $student){ $sid = $student['student_id']; foreach($student as $key => $value){ if(sub_str($key,0,strlent($key)-2) == 'lecture' && $value == 'on') $set_clause .= "$key = $value,"; } $set_clause = sub_str($set_clause, 0, strlen($set_clause)-1); $sql = "UPDATE students SET $set_clause WHERE student_id = $sid"; } something like that should do the trick. quick write up. untested. echo $sql to make sure it looks right for your table.
  15. haha wow. can't believe i didn't pick that up.
  16. while($fetch= mysql_fetch_array($sql_query)) { ; ?> semicolon shouldn't be there.
  17. select * from winners order by id desc limit 1
  18. that error is from your header() call. you can't output any information (likely html) to the browser before this is called. there is a space or something being outputted in your mysql_connect.php file. make sure you remove any spaces before and after the <?php ?> tags.
  19. why do you need a column for that? can't you assume that the last winner is the person who has the most recent record in the winners table?
  20. yup. but keep it in the same string as it's the same argument for mail() mail('user1@domain.com,user2@domain.com','Test Results',$body); you can also do: mail('Name1 <user1@domain.com>, Name2 <user2@domain.com>','Test Results',$body);
  21. you can do this mail('user@domain.com','Test Results',$body); or mail('user@domain.com','Test Results',"$body"); if you put a string in single quotes, PHP will not look for any variables inside the string. So your body would of looked like "$body" when you got the email.
  22. nope. just concatenate them. $body = "User: $userID\n\nSect: $sect\n\nTime: $time\n\nAttempt: $attempt"; \n will give you a new line in an email.
  23. Thanks everyone for the feedback. What's the one index per table issue?
×
×
  • 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.