Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. How do you know that user is being insert, the code you posted above is irrelevant. What is the code you use to insert the user to the database
  2. it's because you're using variables within single quotes. PHP wont parse variables within single quotes. header('Location: . $url .'); die('<a href=". $url .">Contiune</a>'); The above line should be header("Location: $url"); die('<a href="'. $url .'">Contiune</a>');
  3. This how I'd do it: $str = 'johns-account_p5'; $arr = preg_split('/_p([0-9]+)$/i', $str, 0, PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE); if(is_array($arr) && count($arr) == 2) { list($name, $pX) = $arr; for($i = 0; $i <= $pX; $i++) { ${'newVar'.$i} = $name . '_p' . $i; } echo $newVar1 . '<br />'; echo $newVar3 . '<br />'; echo $newVar5 . '<br />'; } else { $newVar1 = $str; } However you'll be better of using an array rather than series of variables named the same
  4. What other form? I don't understand.
  5. Example of variable variable $str = 'hello'; ${$str . 'world'} = 'hi'; echo $helloworld; // outputs hi In your case you'll need to implement a counter. However it'll be better to use an array instead (after all this is what their there for)
  6. If you're getting an error then either PHP isn't configured as an Apache module. Or the AllowOverride directive within the htttpd.conf does not permit it.
  7. First of you'll need to remove the # at the start of line in order for Apache to read the line, otherwise it'll be ignored. Secondly the php_flag and php_value directives are only available if PHP is configured as an Apache Module only.
  8. I believe your orginal site http://kodo.gtagaming.com/melc/pages/home uses a technique called mod_rewrite, because if I goto http://kodo.gtagaming.com/melc/pages/services it'll load up the services page, so does http://kodo.gtagaming.com/melc/index.php?p=services mod_rewrite allows you to make url aliases, eg pages/services actually calls index.php?p=services However on your other sites index.php doesn't seem exist and the clean urls don't work. How I see it index.php is used to load the requested page into your main site design. On your other sites you are physically calling the files and thus your site design disappears. EDIT: Hold on index.php does exist except its in the root of the site, this works http://www.michequinelaw.com/index.php?p=services however http://www.michequinelaw.com/pages/services.php doesn't because your physically calling services.php, whereas the above url calls index.php which includes pages/services.php into your site design.
  9. This will be an Apache configuration (httpd.conf) issue rather than PHP. How have you installed Apache and PHP? Make sure you are restarting Apache when every make any modification to the httpd.conf for php.ini
  10. The $type variable doesn't exist in the code you provided. There is a variable called $type1 though.
  11. Pardon! Post more information about what you're trying to do. What do you mean by install PHP? Do you mean a PHP script or PHP itself?
  12. You'll have to ask your host whether they provide such a facility for managing sqlite databases online, as you're using a free host then I doubt it. To mange an sqlite database online then the application will need to be web base (ie like phpMyAdmin for managing MySQL databases).
  13. You'll need to use the (object) type cast to convert the array to object form: $modelId = (object) $v['modelId']; $modelId->stock = $stockTotal;
  14. As the database is only single file, I'd just download the .sqll database file to my computer annd open it into sqlite manager to apply whatever changes needs to be done. Once finished I'd reupload the database overwriting the old one.
  15. md5 returns a string which is 32 characters in length , make sure your password field holds atleast 32 characters. also as your password is encrypted after running this line: $encrypted_mypassword=md5($mypassword); You do not need to make it safe for insertion into the database, as md5 uses alpha numeric characters (a-z and 0-9) only. So following lines are not necessary: $mypassword = stripslashes($mypassword); $mypassword = mysql_real_escape_string($mypassword); EDIT Didn't read your register script, this line $password = Trim(stripslashes(md5($_POST['password']))); should be $password = md5(trim($_POST['password']));
  16. By sqlite manager do you mean the firefox addon or some program installed on your computer? Not sure what you mean.
  17. Try: <?php function getGames() { $lines = array_map('trim', file('your_file.txt')); $search_word = 'boring'; foreach($lines as $line) { $parts = explode('-', $line); list(,$name) = explode('=', array_shift($parts)); foreach($parts as $p) { list($key, $value) = explode('=', $p); $game[$name][$key] = $value; } } return $game; } function findGame($game) { global $games; if(isset($games[$game])) { return $games[$game]; } else { return 'Game <b>' . $game . '</b> not found!'; } } $games = getGames(); $game = findGame('test'); echo '<pre>' . print_r($game, true) . '</pre>'; ?> Note make sure you change your_file.txt to the name of the file that contains the list of games
  18. To add a column to an existing table you'd ran an ALTER TABLE query.
  19. And I don't really understand what this is supposed to do what does ([0-9]+)\ Do? Where are you putting the code? How are you running it? As I get the following output Has a width of 200 and a height of 150! Seems you may be doing something incorrectly, especially if displays $txt = <<
  20. And I don't really understand what this is supposed to do what does ([0-9]+)\ Do? If you're getting code outputted, then make sure you wrap the code in PHP tags (<?php ?>) and that your server is configured with PHP.
  21. You may also want to read this Sticky (Windows only).
  22. You'd just change the table/field names accordingly, like so: You'll need to change the bits in red.
  23. I believe on windows installations you have to enable the sqlite extension within the php.ini, its not enabled by default However on a *nix (most hosts run linux rather than windows) installations sqlite is available if PHP was complied with the --with-sqlite flag, no need to enable sqlite within php.ini To see if sqlite is available run phpinfo() and look for an sqlite sub heading.
  24. Use $_SERVER['HTTP_HOST'] to receive the hostname
  25. public, private and protected are not functions but called visibility keywords. It allows you to control how items (methods and properties) can used within an object public means an item can be used anywhere private means that an item can used within the class it is defined in, or the class it is inherited from. protected means the item can only be used within the class it is defined in php.net has very good examples of how these are used, here :: is the scope resolution operator, here is an explanation
×
×
  • 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.