Jump to content

°°Ben³

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

About °°Ben³

  • Birthday 10/11/1982

Contact Methods

  • MSN
    benjamin@klaile.com
  • Website URL
    http://www.developers-guide.net
  • ICQ
    226006471

Profile Information

  • Gender
    Male
  • Location
    Germany / Remagen

°°Ben³'s Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, there are two ways to do it. 1. Destroy the session --> session_destroy() 2. Unset the respective variables --> unset($_SESSION['cart']); Try this to understand <?php session_start(); $_SESSION['cart'] = array(1,2,3); echo '<pre>'; var_dump($_SESSION['cart']); echo '</pre>'; unset($_SESSION['cart']); echo '<pre>'; var_dump($_SESSION['cart']); echo '</pre>'; ?>
  2. Use the mysql_error() function in future to receive a more detailed error message! i.e.[code]$resource = mysql_query($sql) or exit(mysql_error());[/code] That is really helpful while developing!
  3. Remove the @ and hope that an error message is put out.  ;D
  4. Again ... how the days are in relationship with the code of the if construct? Sorry, but I really do not understand ...  :-\
  5. I do not understand how the data is in relationship with the code you posted.  ???
  6. So you may follow the link in the menu bar? --> http://www.digitalmidget.com/php_noob/captcha.php
  7. You have to decide what information you want to store in the session. Data like the username, that is used very often, i.e. in this forum " Hello °°Ben³", is a perfect example for such an information. @smartguyin: Do you have further questions? Or has anyone a contrary opinion to my proposal? Regards, Ben.
  8. I would not store the password in the session. [code]if FORM_IS_SUBMITTED   check if the user puttet the correct username and password in,   else reload the login form (1) [/code] When the user has logged in you have to do something like this [code]if USER_IS_LOGGED_IN     show the site ELSE     load the login form[/code] Maybe (1) is something like this [code=php:0]$sql = 'SELECT ...'; // .. if(LOGIN_IS_CORRECT) {     $_SESSION['loggedIn'] = true;     $_SESSION['userData']['id'] = $id     $_SESSION['userData']['name'] = $name; } else {     header('location: login.php');     exit(); }[/code] Just some sample code. Try to understand .. it is not really difficult. Hope to help. Regards, Ben.
  9. Try this if you use a version >= PHP 5. [code=php:0]<?php $dir = new RecursiveIteratorIterator(     new RecursiveDirectoryIterator('.' . DIRECTORY_SEPARATOR) ); foreach ($dir as $file) {     printf(         '%s %s is a %s' . PHP_EOL,         str_repeat(' ', $dir->getDepth()),         $file,         $file->getType()     ); } ?>[/code] Regards, Ben.
  10. I think I'm male ... hmm .. yeah I really am. Actually 23 years old. I started programming respectively in the beginning you could not call it "programming" about three years ago. In my studies I have several courses in Java programming. PHP is just a hobby ... Hope that it is okay, that I'm from good old Germany .. Regards, Ben.
  11. So what does $type contain in the calling file? Try this to get the information [code=php:0]echo '<pre>'; var_dump($type); echo '</pre>';[/code] Regards, Ben.
  12. Depending on what you want to do in the end, you may use an associative array as argument. Though Jenk's suggestion is also a nice one .. ;)
  13. [quote author=Cep link=topic=107356.msg430606#msg430606 date=1157726992]if there is a limit on the number of arguements that can be passed to a user defined function[/quote] I don't think so respectively I think if there is a limit it would be too high to reach. ;) [quote author=Cep link=topic=107356.msg430606#msg430606 date=1157726992]if there are any disadvantages in having large numbers of arguments?[/quote] Im my opinion you should not put too many arguments into a function, but there is no fix "rule" or something like that. I think that it becomes kind of chaotic, if you have eight or twelve parameters. If I'm honest, I cannot imagine why one should want to do this .. ;) Regards, Ben.
  14. You can remove the last array entry by using [url=http://www.php.net/manual/en/function.array-pop.php]array_pop[/url]. Regards, Ben.
×
×
  • 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.