Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. Mines actually C:\wamp\www\phpfreaks.php I lot of my testing is for posts on here, so it seemed a logical choice of name Mind you, i probably have a test.php file in pretty much every directory too.
  2. Take a look at this FAQ here: http://www.phpfreaks.com/forums/index.php/topic,95426.0.html Should be exactly what you need.
  3. Well, i can only assume there is some other code? However, to tidy things up - and make everything a little clearer (and to avoid the repeat query) try replacing what you've posted above with: <?php $sql = "SELECT a,b,c FROM `table` WHERE posttime != '' ORDER BY posttime DESC LIMIT 20"; $result = mysql_query($sql) or die(mysql_error()); echo '<div id="leftcontent"><p>'; $i = 0; while($row = mysql_fetch_assoc($result)){//same as mysql_fetch_array($result,MYSQL_ASSOC) but less typing echo '<font size = "3"><a href ="'.$row['a'].'" target="_blank">'.$row['b'].'</a></font><font size="2">'.$row['c'].'</font>'; $i++; if($i == 10){//we've had 10 results echo '</p></div><div id="rightcontent"><p>'; } } echo '</p>'; ?> As i say, i do wonder if there is other code below though.
  4. For the most part you dont need to sacrifice 'bling bling' for those not using a javascript enabled browser - merely provide an alternative. As was mentioned above with the 'click here' links, for example.
  5. Not only that, what about the increasing number of people accessing on phones/PDAs? There's plenty of people using the internet without javascript support.
  6. Unless you need to do a timed redirect, you'd be better off using the header() function. What about users who have javascript disabled?
  7. You could just implode() the array - perhaps using a comma as the 'glue': <?php if (!empty($_POST['Breakfast'])) { $breakfast = implode(',',$_POST['Breakfast']); echo 'Breakfast requirements: '.$breakfast } ?>
  8. Well, if you dont need detailed information about the time the banner was used, then you might not need a new row for each view. For example, if you're only interested in statistics by day, then you could store a count of the number of times that banner was viewed on each day in the database. Your 3 columns would be: banner_id,date,views Of course, that would require a check to see if a row exists for the particular banner id on the particular day, and if it does, update the existing row. If it doesn't, create a new row with a view of 1.
  9. Well, the basic logic is: 1.) User decides to attack other user 2.) Pull information relating to the two users from the database 3.) Use this information to decide who wins 4.) Update the database - e.g. new health, perhaps some winnings etc Its pretty impossible to give any more help than that; it's too situation specific. Of course, if you have a specific problem with part of that, then we will be able to help more.
  10. Try: <?php SESSION_START(); if (isset($_GET['lang'])) { $lang=$_GET['lang']; $_SESSION['lang'] = $lang; } if(!isset($_SESSION['lang'])){ $lang="en"; }else{ $lang = $_SESSION['lang']; } ?> Edit: I assume that was what was meant by the last poster.
  11. It wouldn't make sense for a tutorial to exist on player vs player games - the way anything like that would work would depend entirely on the game in question. To be honest, it all boils down to logic and database work. The hardest part in anything like this is likely to be coming up with some algorithm to decide who wins (im assuming this is some sort of rpg). You need to take into account all the various factors, whilst making it fair.
  12. Err, if you placed the call to session_start() before the php opening tag, then it wouldn't be parsed. It would be useless. I assume you mean just after the opening tag. Either, way, its not true. It must simply come before any headers are sent or the $_SESSION array is used.
  13. So you want to post to an external form? Try curl
  14. I disagree - HTTP_REFERRER should really only be used for data collection purposes - not security. As thorpe said, it is unreliable at best. For instance, whilst firefox does send the referrer by default, it can be set up not to. I think you'll find that there are some firewalls which block the sending of the referrer too. As for that, you could set a session on the page you want people to go through first - and on the results page, check this session exists. If it does not, you can redirect them to the home page - if it does, then let them view the results.
  15. Yeah, apparently its also called bull**** (according to wikipedia anyway), though i've always known it as cheat.
  16. I've never cheated. Not once. On anything. I think its pathetic when people can't float or sink by their own merits. What about if you play the card game, cheat?
  17. You'll need to do a little more work to find out what parameters need to be passed. Try using firefox and the live http headers extension: http://livehttpheaders.mozdev.org/ Hopefully with that you will be able to see where the form takes you, and any other parameters that are being set, perhaps with javascript.
  18. Well, presumably you are getting a different error now? Since r is defined, the user id is presumably part of the query now?
  19. You could explode by the forward slash, and select the last element of the array: <?php $sql = "SELECT `url` FROM `yourtable` LIMIT 8";//obviously you'll want an order by statement in there, but im not sure how you're defining last 8 $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc()){ $bits = explode('/',$row['url']); $num = $bits[count($bits)-1];//get the last part of the array echo $num.'<br />'; } ?>
  20. I listen to music all the time im able to. If it weren't for that fact i wasn't allowed to, i'd listen to music all the time at college. I find any music that i like, regardless of genre, relaxing. I don't think i could cope with other drivers without music, for instance. And i pretty much always listen to music whilst i code. Some good artists there, and of course some classics. Some of my favourite artists: The Killers, The Libertines, The Editors, Art Brut, The Jam, Kanye West, Air, Strokes, Athlete, Snow Patrol, Jamie T, The Cribs, Cold War Kids, The Fray, The Rakes, Good Shoes, Arctic Monkeys, The Long Blondes, Little Man Tate, Kubichek!, Keane, Jack Penate. I could go on of course. Out of those, i've seen The Editors, Arctic Monkeys and Art Brut live. Arctic Monkeys was probably the best. Its interesting, a lot of that music is from similar genres; yet i would consider my music taste reasonably varied. Whilst my favourite artists are often similar, i like songs from all sorts of genres, and do listen to all sorts. For instance, looking through my library, i have plenty of dance songs, some rap, a bit of cheesy pop, some oldish music, some which i would almost consider easy listening, some hip-hop, even a bit of country. If you watch my signiture, you'll see what i've been listening to. Its usually quite varied.
  21. Did you read the second example? Evidently not.
  22. Well, if i go to the link you gave, i get the following error: Warning: imagettftext() [function.imagettftext]: Could not find/open font in /home/h/a/havebeengood/public_html/memberpages/layout/images/letter.php on line 15 Therefore, it appears that it is a problem with the font. Check the notes under the fontfile parameter given here and see if any of those things apply to you.
  23. Well, i've never work with PDO, but i would imagine you have to do it as part of the query: SELECT COUNT(*) FROM tipsntricks Edit: Indeed, certainly looks like the way: http://uk2.php.net/manual/en/function.PDOStatement-rowCount.php Take a look at the second example.
  24. <?php $sql = "SELECT TIME_FORMAT( TIMEDIFF( NOW( ) , `yourfield` ) , '%i' ) AS difference FROM `yourtable`"; $result = mysql_query($sql)or die(mysql_error()); $difference = mysql_result($result,0); // or ,if you are selecting other fields as well: $difference = mysql_result($result,0,'difference'); ?>
  25. Haha, very interesting analogy there! On a final point, you seem to be confused on another issue Azu. You keep referring to a feelig that tables are bad. Tables are not the invention of the devil, contrary to popular belief. Tables should be used for their purpose - using them is not bad, if you are using them for the right reasons! I feel to make any other point would be to completely re-iterate what everyone else has said. So i wont.
×
×
  • 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.