Jump to content

onthespot

Members
  • Posts

    424
  • Joined

  • Last visited

    Never

Everything posted by onthespot

  1. Why doesnt this echo all the rows out? and only the last one?
  2. $fifa09="SELECT * FROM fifa09_stats"; $fifa09stats=mysql_query($fifa09); while($row=mysql_fetch_assoc($fifa09stats)){ $fifa09user=$row['user']; $fifa09homefor=$row['home_goals_for']; $fifa09homeagainst=$row['home_goals_against']; $fifa09awayfor=$row['away_goals_for']; $fifa09awayagainst=$row['away_goals_against']; } $fifa09for = ($fifa09homefor + $fifa09awayfor); $fifa09against = ($fifa09homeagainst + $fifa09awayagainst); $fifa09gd = ($fifa09for - $fifa09against); echo $fifa09user; echo $fifa09gd; I have used this code, but it only displays the user from the bottom of the table, so the last row. Any ideas?
  3. I shal reexplain. the table has home goals for home goals against away goals for away goals against i then do some php to make them goals for (home and away) goals against (home and away) then i shal do goals for - goals against = goal difference then this goal difference i want to display in order of largest 1st down to smallest last, there are many rows in the original table i am taking this from.
  4. Really just looking for a push in the right direction here. So i have a table with stats in, they have home goals for and home goals against, and away goals for and away goals against. I want to add these up which is obviously simple to make a goals for and goals against number. I will then create the goal difference using both. How would i then rank these using PHP? could someone help me here. thankyou
  5. There were a few isssues, i have sorted it now and it works.
  6. <?php $mess12=$_POST['mess12']; $sub12=$_POST['sub12']; $query = "SELECT username FROM users"; $result = mysql_query($query); while($data = mysql_fetch_assoc($result)) { $user12=$row['username']; $masspm=mysql_query("INSERT INTO messages (from_user, to_user, message_title, message_contents, message_date) VALUES ('Virtual-soccer', '$user12', '$sub12', '$mess12', now(), '0');"); } echo"Mass Pm have been sent"; ?> Can anyone see any errors here?
  7. Must be a database issue then, will look into it. Will this create a message for every username in the user table?
  8. Hello. I have been working on a mass PM function, where the message is sent out to every member of the site. The form <form action="masspm.php" method="POST"> <input type="text" name="sub12" /> <textarea name="mess12" rows="2" cols="30" ></textarea> <input type="submit" align="right" name="submit" value="Mass PM"> </form> The masspm.php <?php $mess12=$_POST['mess12']; $sub12=$_POST['sub12']; $query = "SELECT username FROM users"; $result = mysql_query($query); while($data = mysql_fetch_assoc($result)) { $user12=$row['username']; } $masspm=mysql_query("INSERT INTO messages VALUES(NULL, 'Virtual-soccer', '$user12', '$sub12', '$mess12', '0')"); echo"Mass Pm have been sent"; ?> This isn't currently inserting anything into the database, could anyone help me with this?
  9. Yeah thats what i was expecting, something like that. I will play around with the values and that should work, thankyou
  10. Sorry yes message them the same message. Just a message to all the user basically. The same message as a MASS pm
  11. Hey guys, I have a question. I have two tables. User and Messages. What SQL would I need to take all users from the user tables and message them all? Like the messages have to_user, and that needs to be every user from the user table. Am just trying to create a mass PM function. Thankyou
  12. Sorry I thought that if someone were to show me an example, as its using echo, this would be the correct place to ask. Thanks for the link
  13. Hello. I have been creating a shoutbox. And have it all working, except I need to make the whole thing display in a scroll box, so it doesnt just go on and on down the page, does anyone have any idea how I do this? This is my code.... echo "<table cellspacing=\"1\">"; if(($count % 2) != 0) { echo "<p class='odd'>"; echo "<tr><td width=\"70\">$dtime</td>"; echo "<td width=\"100\">$shouter_name</td>"; echo "<td>$shout_content"; echo "</td></tr>"; echo "</p>"; } else { echo "<p class='even'>"; echo "<tr><td width=\"70\">$dtime</td>"; echo "<td width=\"100\">$shouter_name</td>"; echo "<td>$shout_content"; echo "</td></tr>"; echo "</p>"; } $count++; echo "</table>"; Of course that Is only a snippet, but thats the only part that will be of significance for this question. Thankyou
  14. The problem I believe lies with the length of my comment section. But its entering a varchar(8000). Why would this be a problem?
  15. Ok so I have a problem with my news submission. Does anyone know any reasons (general) why things work offline but not online. My problem is that I am submitting news and its not going into the DB. But it works fine offline? Thankyou
  16. I found this script, and have tried to install it. I cannot for the life of me get the shoutbox to display. That is what the instructions are, but I just cannot get it to work. Has anyone else had experience with this?
  17. I have the following code, which brings up a list of all the users who are registered on the site. However, I want there to be an option at the top saying NONE, and then the list below. So a dropdown that will default to NONE, and if clicked you see all the users, but still have NONE at the very top. Any ideas how I would alter the following code to achieve this? Thankyou <?php $res=mysql_query("SELECT username FROM ".TBL_USERS."") or die(mysql_error()); while($row=mysql_fetch_assoc($res)){ $username=htmlspecialchars($row['username']); echo "<option value=\"$username\">$username</option>"; } ?>
  18. That has solved it, thankyou very much!
  19. Basically, it just moves the div at the very bottom. But if I remove the num rows, it goes back to normal?
  20. Hey guys, I have included num rows in my script. <?php $leagues = mysql_query("SELECT `comp_name`, `game`, `format` FROM `competitions` WHERE `comp_type` = 'league' AND format = 'xbox 360'"); $num_rows = mysql_num_rows($leagues); ?> <table cellspacing="10" width="300"> <tr> <td></td> <td></td> <td></td> </tr><? if ($num_rows > 0) { while( $row = mysql_fetch_assoc($leagues)) { extract($row); $info = explode("_",$row[comp_name]); ?> <tr> <td><A HREF="league.php?comp=<? echo $comp_name; ?>"><? echo $info[2]; ?></A></td> <td><? echo $info[1]; ?></td> <td><? echo $info[0]; ?></td> </tr> <? } ?> </table> <? } else { echo "There are currently no Xbox 360 Leagues"; } ?> Problem is that with the numrows in there, it messes my css up. So there must be a reason including it? Can you see anything that isn't what it should be?
  21. The user submitted variable is defined by the extract(row). Is there a way i can add into the sql WHERE user_submitte is not session[username]. That would remove that part from it?
  22. Yeah i echoed num rows and it displays them. I will add the error in.
×
×
  • 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.