GingerRobot
-
Posts
4,082 -
Joined
-
Last visited
Posts posted by GingerRobot
-
-
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);
-
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.
-
Can I do it somehow that this
while(list($PlayerIDnumb, $PointsScored) = mysql_fetch_row($result)){ $PS_sum=$PS_sum+$PointsScored; }
remains the same?
I don't really want to change it as it's actually as an include and also used elsewhere.
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.
-
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
-
-
Your question is pretty vague, but you can use the GD library to load an image and write text onto of it.
-
Umm, maybe they deleted that page?
-
This is probably a hosting issue. I suggest you contact your host and have them look into the problem
-
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
-
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
-
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.
-
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.
-
Nothing is duplicating when I look at the page.
Me neither.
Also, please do not post your title in capital letters. It's very annoying.
-
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.
-
Are you using M$ Word or OpenOffice as a text editor?
Yeah, they look like MS "smart" quotes.
-
simpleXML would probably be your best bet. You can use the SimpleXMLElement::attributes method.
-
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)
-
Why do hosts still have register globals on?
-
I was wondering how I can get the ID of an item I just inserted into the database, without using another query to fetch the last item in the database
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.
-
Oh and by the way .... http://download.cnet.com/windows/web-browsers/?tag=bc
More downloads that firefox OH YEAH!!
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.
-
I am getting the session id on both pages
Perhaps a silly question, but just to check...you're getting the same session ID?
-
You'll need preg_match_all, rather than preg_match
-
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.
-
Did you copy and paste your code exactly? I do not get that syntax error if I try and run your code.
[Java] Sending a string through an Integer?
in Other Programming Languages
Posted
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.