Jump to content

mikesta707

Staff Alumni
  • Posts

    2,965
  • Joined

  • Last visited

Everything posted by mikesta707

  1. that header error happens when output (including any whitespace or html tags) happens before that line. IE echo "hi"; header("Location: somewhere.php"); would throw the same error. To be of more help we would have to see the code in question, but make sure you don't have any whitespace, html tags, or other output (print, echo, etc) before that line. Based on the error message, particular this part it appears the output is sent on line 9 (you can tell which line and file the output starts by from this string.) so check that line
  2. The first two errors are because whatever file your copy() function is pointing too doesn't exist. Make sure you update the file paths to reflect what they are on the new server. and the third error is a very common error that results in trying to send a header (using the header() function) after you have output something to the page (this means anything, from whitespace, to html tags). We would have to see some code to be able to help more though
  3. if you let the user input what country they are from (from a drop down box or something) then you won't need geolocation. The data you get might be a little off (as a user can lie) but thats probably not a big deal. and No, you wouldn't need to have people sign up (obviously this depends on your comment system. I'm assuming anonymous posting is allowed) you would just have a drop down box with a bunch of countries listed. You can then make a folder with a bunch of images of the flags named after their country. In the drop down, each item's value could be the name of the image for that flag (without the extension). For example, the japanese flag could be in a folder called Flags/ and could be named Japan.jpg. In your drop down box, for japan you would just have something like <select> .... <option value="Japan">Japan</option> ... </select> then in the PHP script itself, you can use that value as the name of the file. I don't know how you store comments in your database, but you can either add html directly in the comment body, or have a column that stores which country they are from, then use that as the image source, like $q = "SELECT * from Comments Where ...."; //other sql stuff while($row = mysql_fetch_array($result){ //display flag $flag = $row['country']; echo '<img src="'.$flag.'.jpg" />'; // etc }
  4. Well how exactly do you want it sorted? Can you provide an example of an unsorted array, then how you want it sorted? asort will sort it numerically (ascending) You can also get a descending sort with arsort. for example $arr = array(1,2,5,34,2,6,3,2,7,34,6,3,4,6); $arr2 = $arr; asort($arr); arsort($arr2); echo "<pre>"; print_r($arr); echo "</pre>"; echo "<pre>"; print_r($arr2); echo "</pre>"; ?> produces Array ( [0] => 1 [7] => 2 [1] => 2 [4] => 2 [11] => 3 [6] => 3 [12] => 4 [2] => 5 [10] => 6 [5] => 6 [13] => 6 [8] => 7 [9] => 34 [3] => 34 ) Array ( [9] => 34 [3] => 34 [8] => 7 [5] => 6 [13] => 6 [10] => 6 [2] => 5 [12] => 4 [11] => 3 [6] => 3 [4] => 2 [7] => 2 [1] => 2 [0] => 1 ) asort() arsort() if you are working with strings, or have a certain way of sorting in mind, then this might not work, but your first example has an array of numbers. If you don't sort them numerically, how else do you want to sort them....
  5. you can do that a fews. The easiest (well easiest IMO) would be to just concatenate (or basically mush together) a string in the loop and just trim the last comma from it. while(...){ $string = "";//create an empty string if (..){ $string .= "Black, "; } if (..) { $string .= "Asian, "; //etc.. //trim last comma and space $string = rtrim($string, ", ");//use rtrim because we only want to trim from the right }//end while but there are multiple ways of doing it (and the method is pretty much the same (or similar) with the foreach or while)
  6. wouldn't asort work for you? you seem to try to do it in that if statement, but you have it commented out
  7. a foreach is used with arrays. In this case, I don't think a foreach would be the best option, but what exactly were you intending to do with a foreach? which array would you iterate through?
  8. If you want to just pull only asians and blacks, or something like that, than I would suggest using WHERE clause. if you just want to list everyone, and say what race they are, than select the columns you needs and leave out the Where clause (since you want every entry) and use the if statements
  9. I would start off with Curl. There are a lot of tutorials on the internet for it, and logging into other websites via curl is pretty common. basic tutorials: http://phpsense.com/php/php-curl-functions.html , http://www.askaboutphp.com/65/php-basics-accessing-remote-urls-using-curl.html
  10. you shouldn't use single quotes for numeric data types. try removing the single quotes
  11. can you post the code that does this so I can try it out?
  12. Pretty sure GA does that for you
  13. seems like your query is failing. try adding or die(mysql_error()); on the same line as your query statement and see what it returns
  14. Well if you don't have anything to show them, what suggestions are you looking for? ways to not show them something?
  15. The problem is $ld is a loop variable, and get overwritten everytime the foreach happens. What you probably want to do (assuming that the order of the array elements corresponds to the order of the columns in your insert statement) is to make a string $insert = "" foreach ($_POST ['listdock'] as $ld) { $insert .= "'"$ld."',"; } $insert = rtrim($insert, ",");//trim the last comma off the string and then you could use the insert string like so $query = "INSERT into blah blah blah VALUES($insert)";
  16. np, if your topic is solved you can click the marked solved button at the bottom of the thread
  17. if both are empty then the or will still be true. And will only be true if both are empty, and he wants it to redirect if 1 OR both are empty.
  18. Looks like a crawler of some sort, or something that does some sort of crawling. You say you don't know how it got there? could your host have put it there? what kind of hosting do you have?
  19. I think google analytics tells you where you rank on certain keywords. haven't used it in a while, but I believe I saw that somewhere when I was using it. its free too http://www.google.com/analytics/
  20. what are those times in the strtotime() function supposed to be exactly? have you tried putting dashes or some other delimiter between the year/day/month?
  21. the URL parameters are formatted incorrectly. When you send $_GET data, you append a ? at the end of the filename (IE page.php?) and then you add the variables (IE page.php?id=5) if you have multiple variables, after the first variable, you separate them with the ampersand (&) IE (page.php?id=5&other=6)
  22. No, he should use OR. Think about it, you want an error to occur if 1 OR the other is not set (or, 1 OR the other is empty). I don't see much of a problem (other than the fact that your code is formatted very strangely) Can you post the form you use to log in? try doing print_r($_POST); and see what $_POST data is being sent (and if the data being sent is what you expect it to be) also remember if you use an md5 (or other algorithm) hash on your passwords, you have to hash the password before you check it in the query
  23. as far as mysql goes, thats pretty much the only way to connect to a database. A lot of people make the database info (like $host, $user, etc) into constants rather than normal variables, but beyond that yeah, thats how you do it
  24. this line needs a semi colon $to = $_REQUEST['to'];
  25. can you post your full header statement?
×
×
  • 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.