Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. How is that variable created, Sorry I have not used smarty so I don't know the language. Edit. Those smarty variables must be set from this line: $smarty->assign($params['assign'], $product); $params['assign'] must hold an array of variables to be set in smarty.
  2. If you have Apache2.2.x installed you should use the php5apache2_2.dll module. php5apache2.dll is for Apache2.0.x only. Both modules come with PHP5.
  3. You cant pass a variable by reference in a foreach loop, perhaps you mean: foreach ($where as $key => $value) { $where[$key] = "`ID` = '{$value}'"; }
  4. Heres is some example code for turning a comma delimited list in to a pull down menu $color_str = 'red,blue,green'; $colors = explode(',', $color_str); echo '<select name="color">'; foreach($colors as $color) { echo "\n <option value=\"$color\">" . ucwords($color) . '</option>'; } echo "\n</select>";
  5. You cannot serve images that are out side of your document root. Images on your site will always be downloaded locally to the users computer. There is no way to protect your images. Also the code I posted was only an example. What you're trying to do is not possible
  6. Have a look at the documentation for how to use the tidy library, You might want to look into the tidy_parse_string function here.
  7. PHP can access outside of the document_root. Use ../ to one level higher in the document tree, eg include $_SERVER['DOCUMENT_ROOT'] . '../secret/file.ext'; Say your directory structure is like this / (root) | +--home | +-- secret (where you files are) | | | +-- file.ext | +-- public_html (document root) $_SERVER['DOCUMENT_ROOT'] returns your sites document root ( eg /home/public_html/) Now the ../ tells PHP to go out of the public_html directory into the /home/ directory and load file.ext in /home/secret You can ofcourse use an absolute path.
  8. Setup a user id field instead, then run all queries based on the user id rather than the customers name.
  9. Or do $Html = "<html> <head> </head> <body> <a href .........> ......... ANOTHER HTML CODE FOR EXAMPLE......... </body> </html>"; echo $html
  10. PHP can not open/edit any files on the users PC, unless the user uploads the file first to the server.
  11. use return not echo in the hi function.
  12. Yes you can do that, however when you do $var = new MAIN you're creating a new instance of the main class. If all you want to do is call function A from the function B in SOMETHING class then do parent::A() instead;
  13. You cannot use a variable to set a functions default parameter value. What I'd is this function myfunc($var = null) { if(is_null($var)) { $var = $my_default_var; } }
  14. After having a readup on the functions you provided, I came up with this: <?php $words = array('blah', 'bleh', 'bloo', 'blah', 'bloo', 'blip'); $word_count = array_count_values($words); foreach($word_count as $word => $count) { if($count > 1) { $keys = array_keys($words, $word); $i = 1; foreach($keys as $key) { $words[$key] = $word . $i; $i++; } } } echo '<pre>' . print_r($words, true) . '</pre>'; ?>
  15. What reference does the names have with the calender? You need to be more specific, provide example data and any existing code.
  16. I cannot see anything wrong with that code. However this is bad programming practice: $check = mysql_query("SELECT points FROM sweetshop WHERE id='$id'") or die(mysql_error()); $sweetpoints = mysql_result ($check, 0, 'points'); // gets sweet name $check1 = mysql_query("SELECT name FROM sweetshop WHERE id='$id'") or die(mysql_error()); $sweetname = mysql_result ($check1, 0, 'name'); //gets points of user $check = mysql_query("SELECT totalpoints FROM usertable WHERE username='$username'") or die(mysql_error()); $userpoints = mysql_result ($check, 0, 'totalpoints'); You are running 3 queries to return the points, name and totalpoints from the sweetshop and usertable tables. MySQL can return multiple columns (which are in different tables) from a single SQL query.
  17. This has more to do with how Notepad2 handles the running of .php files, because your file path has spaces in it, php.exe thinks you're passing parameters to it rather than a file path. File paths should always be in quotes. I have not used Notepad2 so I can't really help you.
  18. The problem is Apache is loading all PHP modules. You should only load the PHP module that is compatible with the version of Apache installed. In your case the following is the only lines you need, to configure Apache with PHP: LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll" PHPIniDir "C:/Program Files/PHP/" AdddType application/x-httpd-php .php The following errors: PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_oci8.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_pdo_oci.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_pdo_oci8.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_pdo_pgsql.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_pdo_sqlite_external.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_pgsql.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_pspell.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_sybase_ct.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_ibm_db2.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_ifx.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_ingres2.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_maxdb.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_mcve.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_netools.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_oracle.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_pdo_ibm.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_pdo_informix.dll' - The specified module could not be found.\r\n in Unknown on line 0 Is to do with PHP, not Apache. Before enabling any PHP extensions you should first make sure Apache is properly configured. Then you need to make sure PHP is loading the php.ini you're modifying.
  19. What happens when you echo $pagepath? Also do not modify the include_path directive, always it leave as default. Post the error message in full here (i know you posted it before, but it may have changed since). I cannot see why the above code is not working.
  20. Don't use the installer for installing PHP. Just download the the zipped binaries package from php.net. Extract the contents of the zip file to C:\php Next open Apaches configuration file (Start > Apache HTTP Server > Configure Apache Server > Edit the Apache httpd.conf Configuration File) Scroll to the very bottom of the httpd.conf and add the following lines: LoadModule php5_module "C:/PHP/php5apache2_2.dll" AddType application/x-httpd-php .php Save the the httpd.conf and restart Apache. NOTE: I assume you have installed Apache2.2.x, if you have installed Apache2.0.x then you'll need to change php5apache2_2.dll to php5apache2.dll, for the LoadModule line[/b].
  21. No, you have to do each field separately.
  22. PHP sees a \ as an escape character. When using \ in a file path do \\ instead. You can use / in file paths too. Examples: $path = "C:\\wamp\\www\\project\\"; $page = $path . $_GET['page']; // OR $path = "C:/wamp/www/project/"; $page = $path . $_GET['page'];
  23. Yes, look into the concatenation operator.
  24. Yes, still go to be in the if statement though: if(isset($_SESSION['member_id'])) {
  25. Do not use variables within single quotes. PHP will treat variables as normal text within single quotes. Put simply remove the quotes. Also do not use session_is_registered or session_register functions, they are depreciated. A replacement for session_is_registered is isset($_SESSION['your_variable'])
×
×
  • 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.