Jump to content

DanielBP

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

DanielBP's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. @PFMaBiSmAd - It doesn't work, it shows only the ID/Image cells, nothing more Found a solution: for($i=0; $i<=100; $i++) { $url = 'http://localhost/images/icon_'.$i.'_64x64.jpg'; if (@fclose(@fopen($url, "r"))) { echo "<tr><td>".$i."</td><td><img src='".$url."' /></td></tr>"; } } The only problem is, I have ~70-80 icons in that folder and it takes forever to see the result. But it does skip the files that don't exist.
  2. @QuickOldCar already tried that, it doesn't work
  3. <table border="1"> <tr> <th>ID</th> <th>Image</th> </tr> <?php for($i=0; $i<=100; $i++) { $url = 'http://localhost/images/icon_'.$i.'_64x64.jpg'; echo "<tr><td>".$i."</td><td><img src='".$url."' /></td></tr>"; } ?> </table> So after testing this script, I get empty cells in the table if the image doesn't exist. Can someone show me how to make it display only the images that exists in that folder ?
  4. Well I did tried to use the sort functions in php but I don't know how so I found an alternative to it by using a javascript (this) and it works <table class="sortable"> <tr> <th>Username</th> <th>Points</th> </tr> <?php $arr = array ("Christina", "Daniel", "Andreea"); reset($arr); foreach ($arr as $username) { //more code here ... foreach ($stats as $result) { echo "<tr><td>".$username."</td><td>".$result."</td></tr>"; } } ?> </table> The only problem is, the user HAS to click the column to sort the results, it won't do it automatically. Bahhh, I'm such a mess at coding
  5. Part of my code: <?php $arr = array ("Christina", "Daniel", "Andreea); reset($arr); foreach ($arr as $username) { //more code here ... foreach ($stats as $result) { echo $username."'s points - ".$result."<br />"; } } ?> And gives this: Christina's points - 14 Daniel's points - 45 Andreea's points 23 My question is: can you sort the the $result so it will show Daniel's points - 45 Andreea's points 23 Christina's points - 14 Thank you
  6. Nvm I made it myself. Thank you again for your help, you can close this topic now
  7. Thank you, it works Here's the code: foreach ($linkarray as $result) { echo "<h2>".$username."'s number - ".strip_tags($result)."</h2><br />"; } Is there a way to also sort the numbers ?
  8. I made a script to grab the data between these tags on my page: <td class="numbers"> </td> It shows only the numbers and that's what I want (see Ex: ) but if I view the source code it shows this: Andreea - <td class="numbers">111</td><br /> Claudia - <td class="numbers">30</td><br /> Daniel - <td class="numbers">37</td><br /> Adela - <td class="numbers">4</td><br /> Is there a way to display the result without those tags ? Ex: Andreea - 111 Claudia - 30 ............ As you can see, I only need the numbers, there's nothing else inside those tags.
  9. Hello. I'm new to php and I have a problem with a script. If someone could help me I will apreciate it. So, I'm using this script to get data from my Gamespot profile (level, date joined, etc). The problem is I don't know how to get multiple "things" from my profile. I made 2 similar examples based on that script but I want to make them in a single script if you know what I'm trying to say. So in the end it should display information from both my examples in one page. <?php // Inlcude our tag grab class require("taggrab.class.php"); // class for spider //Username define('username','twistedface12'); // Enter the URL you want to run $urlrun="http://www.gamespot.com/users/".username."/achievements/gamespot"; // Specify the start and end tags you want to grab data between $stag='<ul class="profile_stats">'; $etag="</ul>"; // Make a title spider $tspider = new tagSpider(); // Pass URL to the fetch page function $tspider->fetchPage($urlrun); // Enter the tags into the parse array function $linkarray = $tspider->parse_array($stag, $etag); echo "<h2>".username."'s Stats - <a href=".$urlrun.">Source</a></h2><br />"; // Loop to pump out the results foreach ($linkarray as $result) { echo $result; echo "<br/>"; } ?> and the second example shows all emblems <?php // Inlcude our tag grab class require("taggrab.class.php"); // class for spider //Username define('username','twistedface12'); // Enter the URL you want to run $urlrun="http://www.gamespot.com/users/".username."/achievements/gamespot"; // Specify the start and end tags you want to grab data between $stag='<ul class="achievements ">'; $etag="</ul>"; // Make a title spider $tspider = new tagSpider(); // Pass URL to the fetch page function $tspider->fetchPage($urlrun); // Enter the tags into the parse array function $linkarray = $tspider->parse_array($stag, $etag); echo "<h2>".username."'s emblems - <a href=".$urlrun.">Source</a></h2><br />"; // Loop to pump out the results foreach ($linkarray as $result) { echo $result; echo "<br/>"; } ?> How can I merge those 2 ? Thank you.
×
×
  • 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.