Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Make sure Wamp is running, check the WAMP stats bar icon in the lower right hand of the screen.
  2. Why use number_format? No need to use it as mysql_insert_id returns an integer, not a float.
  3. The site uses AJAX to perform the login. I'd recommend you to ask to the Admin of the site whether you can use cURL to perform login operations. You can see whats going on by looking at the source code, its all handled by Javascript.
  4. You cannot output HTML if you're using the image/jpeg content type header.
  5. It has nothing to do with your firewall, but with how PHP loads the mysql extensions. In order for the mysql extension to function correctly PHP needs to be able to find an external library called libmysql.dll. This file should be located in the root of the PHP Installation folder. Make sure you have done the following. - Added PHP to the PATH Environment Variable. - Ensured PHP is reading the php.ini you're editing - Setup extension_dir to point to PHP's extension folder
  6. If you are getting that error, then there is most probably a problem with the query. Change: $gallerysqla = mysql_query($galleryqa); to $gallerysqla = mysql_query($galleryqa) or die(mysql_error());
  7. I know this is old post. B But there is an issue with the PHP tags. When you post code which is wrapped in PHP tags, it will post fine. However if you then edit the post, after saving some characters (especially spaces) get converted in to their html entities equivalent which really mess the code up. Example: if ($var == 'something') { // blah } Edited, to show results. In this case its only the spaces
  8. Sorry, I modified my post before you replied.
  9. It wont return just 1 result. It'll return all results .= is the concatenation operator. Post the current code you're using now. EDIT: Argh balls! I just noticed I had a typo in my code example. I added the return statement inside of the while loop. It should be outside of the loop. function eNavigation() { $html = null; $domain = $_SERVER['HTTP_HOST']; $NAVresult = mysql_query("SELECT site FROM pages WHERE site='$domain' ORDER BY id ASC"); while ($NAVrow = mysql_fetch_assoc($NAVresult)) { $title = stripslashes($NAVrow['title']); if ($title == 'Home') { continue; } $html .= '<li><a href="' . $title . '">' . $title . "</a></li>\n"; } return $html; }
  10. Umm, you're not using my code. You're still using echo. change echo to $html .= then before the closing brace for your function add return $html;
  11. What are you trying to do? What else do you want to output? You should be able to concat everything to the $html variable.
  12. Because when you use echo in a function, it doesn't return the output of where the function was called from. But from where the function is defined. Example: function test() { echo 'hello '; } echo 'world' . test(); //output: hello world Where as function test() { return 'hello '; } echo 'world' . test(); //output: world hello
  13. Glad everything is sorted. My tip is to use / rather than \ in directory paths. \ is seen as an escape character.
  14. Use return instead. function eNavigation() { $html = null; $domain = $_SERVER['HTTP_HOST']; $NAVresult = mysql_query("SELECT site FROM pages WHERE site='$domain' ORDER BY id ASC"); while ($NAVrow = mysql_fetch_assoc($NAVresult)) { $title = stripslashes($NAVrow['title']); if ($title == 'Home') { continue; } $html .= '<li><a href="' . $title . '">' . $title . "</a></li>\n"; return $html; } } Change <div id="something"><?php eNavigation(); ?></div> to <div id="something"><?php echo eNavigation(); ?></div>
  15. Your extension_dir directive is not set correctly by looks of it. As your phpinfo output seem a little screwed (unless its Word playing up). Set extension_dir like extension_dir = "C:/server/php/ext";
  16. Can you attach the output of phpinfo here. I admit this is the most frustrating part of installing AMP manually, I have ran into this road block many times before.
  17. I recommend you to do somehting like the following when dealing with includes: define('ROOT', $_SERVER['DOCUMENT_ROOT']); require_once ROOT . '/forums/vBExternal.php'; require_once ROOT . '/forums/globals.php'; Seems you are overcomplicating things with chdir. $_SERVER['DOCUMENT_ROOT'] returns the absolute path to your sites root. This will tell PHP to include files from the root rather than the current working directory.
  18. wildteen88

    HOW

    This for PHP help. JSP and PHP are completely different languages.
  19. A ternary operator can be inserted into a string, just you need to wrap it within parenthesis. Example: $n = 9; echo '$n is ' . (($n > 5) ? 'greater' : 'less') . ' than 5'; However it is best to place the ternary operator outside of the string. This allows for the code to be more readable.
  20. Ensure you have restarted Windows after modifying the PATH. Also clear your browsers cache too, incase your browser is loading an older page. Make sure you have uncommented the correct extension, within the php.ini PHP5 comes with two extensions for mysql. These being php_mysql.dll and php_mysqli.dll PHPMyAdmin can be configured to work with either extension. However the default is php_mysql.dll Also when you installed PHP what media did you use? If you used the installer then I recommend you to go to php.net and download the zipped binaries package. Extract the contents of the zip to where PHP is currently installed to, overwriting existing files/folders. The installer comes with limited files.
  21. Have you added the PHP folder to the path environment variable, which was suggested earlier. If its still doesn't load the extension, then PHP is most probably having difficulty finding the libmysql.dll library, which is required in order for the mysql extension to function. The libmysql.dll should be located in the root of your PHP folder. PHP should be able to find this file if PHP is added to the path environment variable. Make sure you don't have any files such as php_mysql.dll or libmysql.dll outside of the php folder, check in places such as C:\Windows, C:\Windows\System32 etc. If you find any remove them as they will interfere.
  22. The text/number between the square brackets is what is called the array key (or index). You use the array key to retrieve an item (value) from the array. Arrays can be multi-dimensional. So $_POST['strLocations'] holds an array within the $_POST array. To see the arrays structor use: echo '<pre>' . print_r($your_array_var, true) . '</pre>';
  23. Umm, what's the error you're getting? I don't see you mention the error you get, except telling us you get an error.
  24. Yes those are some good tips. However I do not recommend using the users IP address to identify them, as br0ken said the IP can change. The frequency of the change depends on the ISP some provide a new IP address when the modem/computer is restarted, on each page request or hourly/weekly/monthly etc. Also the IP address can be easily spoofed. Try not to use use mysql_real_escape_string on everything. For example if all you want is a number from a user. Make sure the user has provided a number. Or if the user is supposed to give a predefined range of options, eg yes or no check to see if the user has provided a yes or no answer. I see many people have zero data validation in their code and rely solely on mysql_real_escape_string.
  25. You have output on line 32 in mainpage.php which is causing the error You cannot have any form of output (even text/html outside of PHP tags) prior to the use of set_cookie() or header() functions.
×
×
  • 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.