Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. Just redirect those 8 domains to your main domain domain.com A 11.12.13.14
  2. $variable = $GLOBALS['name']; is hardly a tip as it's the same as: global $name; $variable = $name; Some prefix globals with gbl (for example $gblName) as they think it's a way around the problem while it's not like Roopurt has pointed out. function foo( $a, $b, $c ) { global $total; $total = $a * $b + $c; // Let's say $total is now: 34 magical_function(); // Does $total still equal 34? We DONT KNOW! // It's global so magical_function might have altered it without our knowing. echo $total; // Might be 34! Might be something else! } Globals are bad no matter how small the application.
  3. Have you got this setup? Server: functions.inc Client: require('http://server.com/functions.inc'); Also allow_url_include should be set to On on your Client
  4. Try out an IDE like NetBeans or Eclipse PDT these contain tools to automatically format your code against a certain naming convention (or your own for that matter). Personally, I use PhpStorm and I copy-paste any code on these forums into it and select Format where the IDE format's the entire code.
  5. That's not what I meant. I surely hoped there would be some specific document/book that discussed these advanced MySQL features/uses and I actually wanted to know the title of this document/book. Although your lmgtfy turned up some good results
  6. I think this is quite obvious http://www.work-server.com And this indeed doesn't work because your .php is parsed on the client server and the result is returned as a response so you'll have to rename it to for example .inc However I do not recommend it as anyone will be able to look up your source code.
  7. Care to elaborate (field() is new to me)? field() returns the index position of size in the '3XL','2XL','XL','L','M','S','XS' list which is thus 0-7 then how does for example ORDER BY 3 help as it would just order by the 3rd column? Magick size, FIELD(size,'3XL','2XL','XL','L','M','S','XS') -------------------------------------------- 3XL, 1 2XL, 2 XL , 3 L , 4 M , 5 S , 6 XS , 7 Thx Mchl Magick indeed I now understand how it works and I'll remember to use that whenever I have a fixed list. Got any resource that contains more of such Magick? Book? Tut?
  8. There's an article on MySQL in how to handle such data (called Adjacency List Model) http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
  9. Care to elaborate (field() is new to me)? field() returns the index position of size in the '3XL','2XL','XL','L','M','S','XS' list which is thus 0-7 then how does for example ORDER BY 3 help as it would just order by the 3rd column?
  10. Not entirely: My method avoids this second call.
  11. Make sure you always retrieve only the data that you need in the request nothing more, nothing less (SELECT field1, field2 FROM). If certain queries return a big result and these results do not change often consider caching. Solve what? To create efficient queries? Give me a real example so that I can give you a real solution. PS that thread wasn't really relevant as it discusses design patterns and directory layout's none of which is applicable to databases
  12. Add a field checkin (boolean DEFAULT FALSE) then when a user edits a page (checkin = TRUE) when a new user wants to retrieve a page query: SELECT * FROM table WHERE checkin = FALSE ORDER BY rand() LIMIT 1
  13. Like yourself I am a developer and not a designer and I usually create a wire-frame or mock-up before I get to the coding plus this is no excuse for your color scheme. Anyway here's my take: I threw this together using mockflow.com now that I am taking a second look I can spot a few errors in this design Add & Save are confusing for example and Save would probably be best to be put under the to-do list to avoid this. Again this proves the flexibility of wire-framing I threw it together in like 20 seconds I review it, and correct any error's I found for a total of 30 seconds. Think you can do that to in Photoshop- or a HTML document? I may extend this further and identify them as steps 1. Start adding events to your calender 2. Press Save to store the events and create an account
  14. Because in most cases you would want to tie in business rules. For example a user may only login when he verified his e-mail address. if (!$user->hasVerifiedEmailAddress()) {//can't login, verify e-mail first
  15. I still like Notepad though I have always found it to bad Notepad didn't support syntax highlighting, intellisense, and auto-indentiation. How about such a simple thing as being able to figure out that LF is a line break? It's the only editor I've ever known that doesn't support LF style line breaks. Yes, that to.
  16. Congratulations, your website just beat Geocitiesizer
  17. Yes, you can put that in a function. However while you are "refactoring" your code you could do it with flexibility in mind I for example would re-factor the above code like: function cleanup($value) {/*implementation comes here*/} function validUsername($username) {} function validPassword($password) {} define('LOGIN_OK', 1); define('LOGIN_EMPTY', 2); define('LOGIN_INVALID', 4); define('LOGIN_UNKNOWN', ; define('LOGIN_AMBIGUITY', 16); function login($username, $password) { if (empty($username) || empty($password)) return LOGIN_EMPTY; $username = clean($username); $password = clean($password); if (!validUsername($username) || !validPassword($password)) return LOGIN_INVALID; $query = "SELECT user_id, name FROM test_roster_April2010 WHERE username = '$username' AND pwid = '$password'"; $result = mysql_query($query); if ($result !== false && ($num_rows = mysql_num_rows($result)) === 0) return LOGIN_UNKNOWN; if ($num_rows > 1) return LOGIN_AMBIGUITY; $_SESSION = array_merge($_SESSION, mysql_fetch_assoc($result)); return LOGIN_OK; } //YOUR CODE REFACTORED: // //$response = login($_POST['username'], $_POST['pwid']); //if ($response === LOGIN_INVALID) { // echo '<h2 class="fail">You have entered a username or password that does not match our database records.', // ' please try again.<br><br>You will be redirected back to the login screen in five seconds.</h2>', // '<meta http-equiv="refresh" content="5; url=StudentLogin.php">'; // exit(0); //} However for the best result it would be best to use classes as your login implementation may vary depending on the project (OpenID, FacebookConnect, ..). More so because your query is hard-coded, not in every project will your table be called test_roster_April2010 nor will it always contain the fields username, pwid, userid, name as these are project specific.
  18. I still like Notepad though I have always found it to bad Notepad didn't support syntax highlighting, intellisense, and auto-indentiation. If it had, it probably would still be my favorite editor I know there is Notepad++ but I don't like the GUI and it feels bloated.
  19. Amazingly, you joined on the 1st of January. Oh thats quite weird. I remember I was home late that day There is a 6-hour difference between Belgium and the server's location.
  20. Search engines only crawl pages they found on previous pages. If a user doesn't want his profile to be shown on SE then just don't link to it (or add a rel="nofollow").
  21. PDO indeed allows you to connect to multiple databases but it does no re-write your queries to match the DBMS which means that you have to write your queries keeping in mind the differences between the DBMS systems you wish to support now and in the near future.
  22. - Do you have a sticker on your car stating it's a car? People know where to click to navigate from page-to-page. Don't point out the obvious. - You may want to fix your font-sizes they don't match up also your banner looks awfully big
  23. Translation: how can I increase/decrease the font-size You think we know all keyboard shortcuts for all browsers, for all platforms? You tried Google? I found http://www.white-hat-web-design.co.uk/articles/js-fontsize.php
×
×
  • 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.