Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. If you try that, i'm pretty sure you're going to get an exception thrown by the parseInt method. I think Mchl's suggestion should be good.
  2. Your query is failing. Try checking for errors: $sql = "SELECT * FROM email_content where id=".$_GET['id']); $result = mysql_query($sql) or trigger_error(mysql_error() . '<br />Query was:' . $sql,E_USER_ERROR);
  3. You're not assigning the return value of the array_map function to anything. If you take a look at the manual page (array_map) you'll see the function returns the array after having applied the supplied function to all the elements of the array. This is something you have to keep an eye on with the array function; some do their job in-place, others create a copy.
  4. Surely it doesn't matter if the end result is the same? All I was saying is that running a query in a loop is a pretty inefficient way of doing things and requires you to write much more code than is necessary.
  5. Ouch...you really don't need to to loop through the results and execute a query for each player. You can use a join. I think this should work for you: SELECT table1.PlayerName, SUM(table2.PointsScored),table2.SeasonNum FROM table1,table2 WHERE table1.PlayerID=table2.PlayerIDnumb GROUP BY(table1.PointsScored) ORDER BY table1.PlayerName, table2.SeasonNum If you then loop through those results, you should get what you need: $sql = "SELECT table1.PlayerName, SUM(table2.PointsScored),table2.SeasonNum FROM table1,table2 WHERE table1.PlayerID=table2.PlayerIDnumb GROUP BY(table1.PointsScored) ORDER BY table1.PlayerName, table2.SeasonNum"; $result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR); while(list($name,$score,$season) = mysql_fetch_row($result)){ echo "$name, $score, $season <br>"; } Edit: You can find a tutorial on joins here: http://www.phpfreaks.com/tutorial/data-joins-unions
  6. You'll need to use the user sort functions: usort (or uasort if you wish to maintain associativity)
  7. Your question is pretty vague, but you can use the GD library to load an image and write text onto of it.
  8. This is probably a hosting issue. I suggest you contact your host and have them look into the problem
  9. Firstly, the board you posted is is not a help forum. I would have thought that having that written in bold and capitals would be enough for you to see that, but apparently not. As cags says, if you're looking for something in a file you could just use the find option in almost any editor. If you wish to search through lots of files at once and are using a *nix operating system, you could use grep... For example, the following would look through all files with a .php extension in the current folder and print out any lines with an asterisk is them. grep -H -n \* *.php
  10. What do you mean? Do you want to return the key of the array for a corresponding value? You can do this with array_search
  11. Well there's nothing syntactically wrong with your if statement, so i suggest you find out what is stored in $sub_attribute_name_attribute (incidentally, i'm all for descriptive variable names -- but sheesh). You can then go about finding out why it doesn't contain the value you thought it should. Echo out the variable prior to the if statement. Or, to put it another way, i'm sleepy and didn't notice the missing quotes.
  12. You'll need to use regular expressions (e.g. preg_replace) to replace the tags with <b> and </b> tags respectively. The same applies for other tags. I'm sure if you google, you'll find tutorials/examples/code snippets of this kind of thing anyway. You should replace the bbcode for HTML tags when you display data, not before you insert it into the database.
  13. Me neither. Also, please do not post your title in capital letters. It's very annoying.
  14. Well what data are you expecting to store? Are you always going to be using whole numbers? If so, an INT type is best for you.
  15. Yeah, they look like MS "smart" quotes.
  16. simpleXML would probably be your best bet. You can use the SimpleXMLElement::attributes method.
  17. Well for starters, what operating system are you using? Also, what program are you using to view the results? If you use a web browser to look at the file, you might well get everything all on one line if it treats it as HTML rather than a text file (i'm unsure if browsers will be doing this -- i'd expect most would assume it's a text file, but it's a possibility)
  18. Why do hosts still have register globals on?
  19. Just FYI, it would be a bad idea to use a second query to select the last inserted ID; there's no guarantee that it is the same as the one you've just inserted because of concurrency issues. For example, if two users (A and B) are loading the page at the same time, it could be that B's insert would happen inbetween A's insert and A's select, resulting in user A receiving the ID that was inserted by user B. The LAST_INSERT_ID() function works on a per-connection basis. It is therefore safe from this kind of thing.
  20. Ignoring the fact that firefox had more downloads last week, has a higher rating by both the users and editors of that site and that this is only one place you can download the respective programs you have conclusively proved avant is more popular than firefox.
  21. Perhaps a silly question, but just to check...you're getting the same session ID?
  22. You'll need preg_match_all, rather than preg_match
  23. You could use PHP's file-handling functions to read the file contents and output it to the browser. That way, the user never sees the original file.
  24. Did you copy and paste your code exactly? I do not get that syntax error if I try and run your code.
×
×
  • 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.