Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by cpd

  1. You'll probably find they don't merely md5 something but rather go through a series of steps and md5 it at the end. Take a step back and look at the bigger picture before drawing a conclusion.
  2. You could group by and then only show the first 5 for each. This however splits your logic between the MySQL Server and PHP; not the end of the world. If you wanted all the logic in the MySQL server you've got a painful query ahead of you...
  3. Or a view. Queries can automatically be cached if repeatedly called as well... I believe caching is on by default.
  4. When you submit the form, the data is posted to the header and passed to the action page specified in the form tags; if none is specified it will stay on the current page. The information posted to the header is the "name" of each input/select etc which equals the value of the relevant input field. E.g. <input type="text" name="hello">World</input> [code] This will post variables to the header which look like ?hello=world in its raw format. This is then put into your $_POST variable as $_POST = array("hello" => "World"). The same principle applies for select tags. The value specified in your option tag is the value posted to the header. If you want to use IDs you need a table in your database which defines what the IDs link to. I assume this is already done as you retrieve the information as you progress through your drop downs.
  5. Your going about that in a very long winded way class languages { public function __construct() { $_SESSION['language'] = (isset($_GET['lang']) && in_array($_GET['lang'], array('en', 'nl') ? $_GET['lang'] : "DEFAULT LANGUAGE"); } } And ensure you check what the previous posts mentions...
  6. Through the use of sessions or by passing the information through the header...
  7. Be sure you don't want any data in the specified table as TRUNCATE will remove all the data... It's not a simple function to reset the auto-increment value to 0.
  8. cpd

    array spliting

    You can't. Array keys must be unique therefore you can only have one 15.jpg. What I suggest you do is have a multidimensional array. [1.jpg] => array([0] => "Callum", [1] => "Grant") [2.jpg] => array([0] => "Something", [1] => "Else", [2] => "Here")
  9. I can't even find the phrase "Your invalid company description was". Are you sure this is your error? Moreover, you need to rethink your password validation as it prevents people from using common characters found in passwords...
  10. I thinks ODBC has a fair few more years in it, at least while MySQL is still around haha. Just so you know, using a PDO connection shouldn't effect your code too much. All that would need changing is a bit of syntax and a bit of additional code required for binding parameters. Anyway, I'll leave you be with your project, I've rambled enough.
  11. You should consider a PDO connection as well. I know you say you need an ODBC (reasons for this I'm unsure of) but perhaps try a PDO connection instead. I know Pascal Data Objects work with SQL Server 2005 so one would assume the PHP Data Object, which Pascal Data Objects is vaguely based on, would work. I do understand you've got it working as well but exploration could lead to a better solution. Depends if your willing to, and can, put the time in; sometimes time isn't on a programmers side.
  12. @ melting_dog In other words you need something like "C:/path/to/the/desired/folder/". Or on a server its usually something like "/home/username/public_html/desired/folder/" dependent on permissions and where you want to store the file etc.
  13. In that case you will want the slightly outdated MSSQL drivers which should be lurking around on the web somewhere. They should connect you to SQL Server 2005.
  14. The error would suggest the drivers and database type are incompatible. Try using Microsoft's SQLSRV driver. That's what I use and it works a charm. I'm fairly sure it'll work in SQL Server 2005.
  15. Sooo you want help with what exactly? Or do you want it just done for you, that's the impression I get...
  16. You just hit the nail on the head and hammered it in one blow Muddy. @eroc - Your best route is to use a RDBMS or ORDBS (although there's no great need for it). Don't try and manage everything through cookies which may get destroyed.
  17. If my memory serves me correctly, he's using the smarty engine (pile of junk that it is, apologies if I offend anyone). You'll need to add some HTML like <td></td> to add an additional column in your table; however there are a lot of smarty if statements between your table data tags at the moment so getting the right content in the right place may be a rather tedious task.
  18. I love your signature btw Muddy. Completely true!
  19. Using the $_SERVER variable is not "not safe". Its perfectly safe provided you use it in a safe manner.
  20. Lol. I understand what your saying, I personally would never do it this way but I'm answering the question asked. If we were to discuss "better ways" of doing stuff we could have endless topics as there is never a right or wrong way and people have opinions therefore, the discussion would never be solved. @scootstah - Once again I'll reiterate my point. It's entirely dependent on how your using it. You've obviously read the article in Pikachu's signature and generalised it to all situations. The article linked by Pikachu is correct given that situation, in this situation however, it's not really applicable.
  21. @Muddy_Funcster - Probably because he has a page which is included in both and he wants to test which page he's on to echo out the relevant text. @scootstah - Saying PHP_SELF is not safe is generalising the use of the variable. It is completely dependent on how and where your using it so saying it is simple "not safe" is incorrect. @lingo5 - You can use the following code to get the file name $file = explode("/", $_SERVER['PHP_SELF']); echo $file[count($file) - 1]; If your using PHP v5.2.0+ you can use $pathInfo = pathinfo($_SERVER['PHP_SELF']); echo $pathInfo['filename'];
  22. What your asking is a little "dreamy". To manage downloads effectively you need some sort of database to track everything. Granted it isn't required but definitely recommended!
  23. So you open an entirely new window and then want to close it so they can view the main website again? In that case top.close() document.close() window.close() parent.window.close() should all work....
  24. Assuming you know what you want to default before any HTML is output to the header, you can use PHP to set a variable like $classDefault = "warrior" and then use inline if statements to print out the selected attribute in the option tag. <option value="warrior" <?=($classDefault == "warrior" ? "selected=\"true\"" : "");?>>Warrior</option> <option value="paladin" <?=($classDefault == "paladin" ? "selected=\"true\"" : "");?>>Paladin</option> <option value="priest" <?=($classDefault == "priest" ? "selected=\"true\"" : "");?>>Priest</option>
  25. Why would you want to close a page you've just loaded if its the parent of your entire website?
  • 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.