
richiec
Members-
Posts
126 -
Joined
-
Last visited
Never
Everything posted by richiec
-
http://fearedwarlords.dks-gfx.com/ if you go there and look at the part which says "top potion hunters" it displays all found in the db but i only want it to return the top 10 this is my current code for that part of the site.. $query="SELECT * FROM `potions` ORDER BY (points+0) DESC"; $result=mysql_query($query) or die(hmm); $num = mysql_num_rows($result); $i=0; echo '<div align="center"> <table width="160" border="0"> <tr> </tr> <tr> </tr> '; while ($i < $num) { $rank = $i+1; $name = mysql_result($result,$i,"name"); $i++; echo "<tr> <td><div align=\"center\"><b><font color=#00FF00> $rank </font>- <font color=#00FF00>$name</font></div></td> </tr> "; } echo '</table> </div>'; does anyone have any ideas on how to only display the top 10?
-
never mind, as soon as i posted i got an idea which i hadnt tried so i tried it out and it worked.. thanks anyway.. Rich.
-
http://www.dks-gfx.com/profileparse.php if you go there and in the text box put devilknightsparda then click go that will parse the "skill" information from the profile devilknightsparda. What i would like it to do is replace the text which it finds for each skill with an image of that skill. ive spent awhile working on it and got nowhere.. i have tried str_replace because i was told that would be the best thing to use to replace the text on there.. but using that just gives me errors.. right now this is how it gets the information.. list($before, $after) = split("/images/skill_13.gif", $file); list($looting) = split("You steal", $after); list($before, $after) = split("/images/skill_46.gif", $file); list($wall) = split("Casting shield", $after); list($before, $after) = split("/images/skill_4.gif", $file); list($stealth) = split("Increases targets HP", $after); list($before, $after) = split("/images/skill_28.gif", $file); list($fort) = split("You receive +", $after); list($before, $after) = split("/images/skill_15.gif", $file); list($cop) = split("Reduces your damage taken", $after); list($before, $after) = split("/images/skill_7.gif", $file); list($bag) = split("Makes all your supplies invulnerable", $after); list($before, $after) = split("/images/skill_50.gif", $file); list($bfa) = split("You receive +", $after); list($before, $after) = split("/images/skill_3.gif", $file); list($emp) = split("Increases targets ATK", $after); list($before, $after) = split("/images/skill_9.gif", $file); list($lust) = split("Target receives +", $after); list($before, $after) = split("/images/skill_2952.gif", $file); list($np) = split("Reward buff for", $after); list($before, $after) = split("/images/pot5.jpg", $file); list($sammy) = split("</b><br>", $after); list($before, $after) = split("/images/pot21.jpg", $file); list($potfort) = split("</b><br>", $after); echo "<table border=\"1\"> <tr> <td width=\"188\"><b>$cid</b></td> <td width=\"1000\">$text $looting $wall $stealth $fort $cop $bag $bfa $emp $lust $np $sammy $potfort</td> </tr> (if there is a better way to get each part of that information for each skill then feel free to help there also) i dont want the site to display any text other than cid (the name placed into the text box) only the image for each skill. any ideas/examples of how i can do that? Thanks Rich.
-
Thank you very much for the help, it works great now thanks again Rich.
-
ok with that done i now get an unexpected T_VARIABLE error on this line if(strtotime('now') > strtotime($date $time)) { full part of it with your code is putenv("TZ=America/New_York"); // Put this at the top of your code // if(strtotime('now') > strtotime("$mysql_date $mysql_time")) { if(strtotime('now') > strtotime($date $time)) { echo "<a href=\"#\" target=\"_parent\" title=\"$name is due on the $date at $time\"> <img src=\"$image\" />"; } else { echo "<img src='$image2'>"; } any ideas what i did wrong? that page works fine, but you need to be loged in first, once the index.php page is finished it will need to be loged in also to view.. i have just taken that off this page for now untill i get it working right so i can use it as an example to show people what im trying to do.
-
http://fearedwarlords.dks-gfx.com/timeframe/index.php If you go there you will see that there are some color images and some grayed out versions of the images.. Now if you hover over the color image you will see that it has a time and date. what i want to do is if the time and date is before what it has on the hover over, for it to display the gray image.. if it is after the time and date on there for it to display the color image. Now i have that working ( i think ) with this if(strtotime('now') > strtotime($date $time)) { echo "<a href=\"#\" target=\"_parent\" title=\"$name is due on the $date at $time\"> <img src=\"$image\" />"; } else { echo "<img src='$image2'>"; But that uses unix time, and i need it set to work from a different time zone, does anyone know how i can change that to work from the time zone that i want. Thanks Rich.
-
[SOLVED] change image depending on date and time?
richiec replied to richiec's topic in PHP Coding Help
That worked, thank you both for the help :x -
[SOLVED] change image depending on date and time?
richiec replied to richiec's topic in PHP Coding Help
ok i did that and changed one of the images to be a later date and left the rest to be before now and it still displays the same color image. this is the code.. $result=mysql_query($query) or die(hmm); $num = mysql_num_rows($result); $i=0; echo "<div align=\"center\">"; $count = 1; while ($i < $num) { $name = mysql_result($result,$i,"name"); $date = mysql_result($result,$i,"date"); $time =mysql_result($result,$i,"time"); $image =mysql_result($result,$i,"image"); $image2 =mysql_result($result,$i,"image2"); if ($count == 7){ //This is how columns you would like echo '<br>'; $count = 0; } // if(strtotime('now') > strtotime("$mysql_date $mysql_time")) { if(strtotime('now') > strtotime('2000-01-01 00:00:00')) {// compares current unix timestamp to that date echo "<a href=\"#\" target=\"_parent\" title=\"$name is due on the $date at $time\"> <img src=\"$image\" />"; // do the html code with the hover } else { echo "<img src='$image2'>"; // do the html code without the hover } $count++; $i++; } echo '</div>'; $image is the color image, and $image2 is a grayed out version of the image. did i do something wrong? -
http://fearedwarlords.dks-gfx.com/timeframe/index.php if you go there and hover over one of the images you will see that it has a date and time on there... what i would like to do is... if the current date and time is before the one that is showing on the hover over, for it to display a different image, with no hover over. if the current date and time is after what the image says then it displays the color image. the images, time, date and name are all in the same sql table. can anyone give me an example of how i would do that? because i can not find anything.
-
thank you very much for the help
-
that works great thank you, and yes that would be helpful because i will be adding more images to that over time so it would be good to know how to do that. thanks again
-
http://fearedwarlords.dks-gfx.com/timeframe/ ok, each image has its own row in the sql table which has the time, date and name also (for the mouse over) But.. I need them to be next to eachother insted of on a different line on the site.. this is my current code.. $result=mysql_query($query) or die(hmm); $num = mysql_num_rows($result); $i=0; while ($i < $num) { $name = mysql_result($result,$i,"name"); $date = mysql_result($result,$i,"date"); $time =mysql_result($result,$i,"time"); $image =mysql_result($result,$i,"image"); $i++; echo "<div align=\"center\"><a href=\"#\" target=\"_parent\" title=\"$name is due on the $date at $time\"> <img src=\"$image\" /><span class=\"style1\"></span></div> "; } any ideas how i can get the images to display next to eachother insted of on a new line for each image?
-
It still gives me the error: Parse error: parse error, unexpected T_VARIABLE in /home/www/dksgfx.freehostia.com/FW/parsetest/profileparse.php on line 32 line 32 is $data = 'hspace="2" width="25" height="25" ONMOUSEOVER="popup(event,"' :-s
-
ok i did what you said but i still cant get it to work.. in adidtion to the code i showed before this is what i also have now.. $lootingimage = "http://sigil.outwar.com/images/skill_13.gif"; $data = 'hspace="2" width="25" height="25" ONMOUSEOVER="popup(event,' Then i have the example of what you told me.. str_replace('hspace="2" width="25" height="25" ONMOUSEOVER="popup(event,\'',$lootingimage,$data); and it gives me the following error... "Parse error: parse error, unexpected T_VARIABLE in /home/www/dksgfx.freehostia.com/FW/parsetest/profileparse.php on line 32" line 32 is $data = 'hspace="2" width="25" height="25" ONMOUSEOVER="popup(event,' any idea what im doing wrong :-s
-
ok... let me try again.. this part gets the information about which skills are cast on the profile you search for... $url = 'http://sigil.outwar.com/profile.php?transnick='; if (isset($_POST['submit'])){ if (empty($_POST['cid'])){ $cid = ''; } else { $cid = '' . $_POST['cid']; } $file = file_get_contents($url . $cid); list($before, $after) = split("/images/skill_13.gif", $file); list($looting) = split("You steal", $after); list($before, $after) = split("/images/skill_46.gif", $file); list($wall) = split("Casting shield", $after); list($before, $after) = split("/images/skill_4.gif", $file); list($stealth) = split("Increases targets HP", $after); list($before, $after) = split("/images/skill_28.gif", $file); list($fort) = split("You receive +", $after); list($before, $after) = split("/images/skill_15.gif", $file); list($cop) = split("Reduces your damage taken", $after); list($before, $after) = split("/images/skill_7.gif", $file); list($bag) = split("Makes all your supplies invulnerable", $after); list($before, $after) = split("/images/skill_50.gif", $file); list($bfa) = split("You receive +", $after); list($before, $after) = split("/images/skill_3.gif", $file); list($emp) = split("Increases targets ATK", $after); list($before, $after) = split("/images/skill_9.gif", $file); list($lust) = split("Target receives +", $after); list($before, $after) = split("/images/skill_2952.gif", $file); list($no problem) = split("Reward buff for", $after); this part displays what skills it finds echo "<table border=\"1\"> <tr> <td width=\"188\"><b>$cid</b></td> <td width=\"1000\">$looting $wall $stealth $fort $cop $bag $bfa $emp $lust $no problem</td> </tr> "; what i want to do is replace where on the site it has: " hspace="2" width="25" height="25" ONMOUSEOVER="popup(event,' with the correct image of that skill
-
if you go here http://dksgfx.freehostia.com/FW/parsetest/profileparse.php put in DevilKnightSparda that will bring up the list of skills that i currently have cast on my account inside the table. Above the table is the skill images. i want to replace the text found from file_get_contents which pulls the text inside the table with the images.
-
that didnt work it didnt replace the text with an image it just displayed the images then the text... any ideas?
-
can noone help?
-
Yes thats all i need it to search for, could you give me an example of how to do that please. --- Wait are you saying it will only display the html of the image and not display the actual image?
-
is there anyway to use file_get_contents to search for a text in a websites source code and then when it finds the text stated it displays an image? Thanks Rich.
-
That works great thank you! Rich
-
Hey ok, this is what im trying to do.. i have a text box <input type="text" name="cid"> <input type="submit" name="go" value="go"> and then with whats inserted into that text box by the user i want it to be added to the end of a url if ($_REQUEST["go"] != NULL){ $cid = $_REQUEST["cid"]; $file = file_get_contents('http://www.something.com/something.php?id=$cid'); But it doesnt work, does anyone know what im doing wrong Thanks Rich.
-
Thank you both for the help and thank you frost110 for the example. Just to clear something up, to get to the table i needed you do not need to be loged into the site. Once again, thank you. Rich.
-
I am not really sure what more information i can give, all im trying to do is to look for a table name on a game site which is http://outwar.com and then it prints out everything listed in the table.
-
That's exactly what i am trying to do yes. As i said though i am quite new to php, would it be possible for you to write the code out as an example of how to do that? Thanks Rich.