Jump to content

PeoMachine

Members
  • Posts

    52
  • Joined

  • Last visited

Everything posted by PeoMachine

  1. You talking about the PHP validation, right? If yes, when your department is not valid, you didnt use the errors variable. So, even you have and invalid department you will send, because the sending is been wrapper by a if testing just the error variable.
  2. What did you mean? I can't understand your point. Can you give us some example?
  3. Try to use something like: $userId = end(explode('/', 'site/user/39')); It will explode the Uri and returns the last element of the array, in this case, the Id you wanted. You can get the URI on the SERVER global.
  4. How do you know who is Admin and who doesnt ?
  5. Give us the "execQuery" method. Maybe youre not returning the MySQL resource.
  6. The button will be created in HTML, but you can echo him with the php. Try something like that <?php function authenticate() { // Your authentication logic here } // If user is loged in if(authenticate()) { echo '<a href="/user-acount">My account</a>'; } // If user need to login else { echo '<a href="/login">Log in</a>'; } It will prints out a link. You can customize the link with CSS and an image, if you want to.
  7. Try to use a Apache, MySQL, PHP distribution, like XAMPP, WAMP, LAMPP, etc.
  8. On the second question... i think the second way you did that is the better way to do. i think it improve the reading and the sense of the code.
  9. When you try to login on the first time, you get redirect to where?
  10. What PHP Errors you get?
  11. I'm sry about that... Well, look if your directive "file_uploads" on the php.ini file is On.
  12. Set on your errors... maybe the path to the files is incorrect.
  13. Try to put a enctype on your form.... <form method="post" action="" enctype="multipart/form-data"> </form>
  14. Verify if search was performed. If yes, you show your results, else you show your form. Something like: if(isset($_GET['search'])) include 'search_results_page.php'; else include 'search_form.php';
  15. You can use a loop (like foreach or for) to scan the array $_FILES, and testing the field you need with the empty function
  16. You're testing the var "$results_num" to know if you have any record, but this var is not receiving any value... You need to fetch the result to know if you have any record. You just need to know if you have records in the database?
  17. You're calling the search_funtion twice. When you use it in "else if (search_results($keywords) === false)", it echoes too.
  18. Try to use the SQL: SELECT COUNT(*) FROM table WHERE itemA = 'foo' and itemB = 'bar';
  19. What you really need? You will fetch it only one time or more? If you need to count it on the same column everytime, use the SQL Count.
  20. The variable $userid has a value? From where it came? And why you set the values two times? $data2 = array("text"=>"$response" , "user_id"=> "$userid"); $data2["text"] = "$response"; $data2["user_id"] = "$userid"; You dont need to use the " too.
  21. I'm not sure if i understand what you need... you need to count how much times these values repeat on the array fetched from the database, right? you can use: array_search('foo', $yourArray); http://php.net/array_search
  22. Why not modify the database table? ...
  23. Well, it depends of the error... sometimes the adapter give an error (like connection errors), and sometimes you have to find him (like this case).
  24. For development you can set display_errors = on, on the php.ini, or use ini_set('display_errors', 'on') on the files you wanted. In this case, a little echo on the return of $db->execute() could give you the answer.
  25. INSERT INTO users (username,pass,email) ... show me the table creating SQL...
×
×
  • 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.