Jump to content

jacko_162

Members
  • Posts

    405
  • Joined

  • Last visited

Everything posted by jacko_162

  1. i actually dont think arrayValue[71] pulls anything as when i echo that i get nothing. problem was i didnt code the above coding and i dont know how it works tbh i just need to pull the averags sell price from the xml link.
  2. still struggling to: a) figure out why the insert part has marketPrice='$arrayValue[71]' b) why nothing is being pulled from xml where array=71 and inserted into DB.
  3. ok it gives me: UPDATE TABLE2 SET marketPrice=' ' WHERE typeID='17619'; its obviously not getting the marketPrice from the URL: http://api.eve-central.com/api/marketstat?typeid=17619&regionlimit=10000002 not sure where the array[71] came from but i tried to echo it and got nothing?
  4. FOr some reason i cant pull data from an XML file to insert into the database, it works without error just adds a blank value in the database? i have this code at the moment, i guess arrayValue[71] is the value i need to pull and add to the "TABLE2" table, but when i run the script it just adds a blank value in the database? <?php include "connect.php"; //Price check Isle 9001! Query EVE-Central API. Example XML file is: http://api.eve-central.com/api/marketstat?typeid=35&regionlimit=10000002 $queryItemList = mysql_query("SELECT * FROM TABLE2;") or die(mysql_error()); $rowCount = mysql_num_rows($queryItemList); $s=0; $typeArray = array(); $region = "regionlimit=10000002"; while($s<$rowCount){ $typeID = mysql_result($queryItemList,$s,"typeID"); echo $typeID."<br />"; //echo "start<br />"; $reader = new XMLReader(); //echo "initialized XMLReader<br />"; $url = "http://api.eve-central.com/api/marketstat?typeid=".$typeID; echo $url.$region."<br />"; $reader->open($url.'&'.$region); $t=0; $arrayName = array(); $arrayValue = array(); while ($reader->read()) { //echo $reader->name; $name = $reader->name; $arrayName[$t] = $name; if ($reader->hasValue) { //echo ": " . $reader->value."<br />"; $value = $reader->value; $arrayValue[$t] = $value; } $t++; } echo $arrayValue[71]; $import="UPDATE TABLE2 SET marketPrice='$arrayValue[71]' WHERE typeID='$typeID';"; mysql_query($import) or die(mysql_error()); $s++;; } print_r($typeArray); /*print_r($arrayName); echo "<br />"; echo "<br />"; echo "<br />"; print_r($arrayValue);*/ ?> an example XML file would be: <!-- Automatically generated data from EVE-Central.com --> <!-- This is the new API :-) --> − <evec_api version="2.0" method="marketstat_xml"> − <marketstat> − <type id="24692"> − <all> <volume>4.00</volume> <avg>152500000.00</avg> <max>152500000.00</max> <min>152500000.00</min> <stddev>0.00</stddev> <median>152500000.00</median> <percentile>0.00</percentile> </all> − <buy> <volume>0.00</volume> <avg>0.00</avg> <max>0.00</max> <min>0.00</min> <stddev>0.00</stddev> <median>0.00</median> <percentile>0.00</percentile> </buy> − <sell> <volume>4.00</volume> <avg>152500000.00</avg> <max>152500000.00</max> <min>152500000.00</min> <stddev>0.00</stddev> <median>152500000.00</median> <percentile>152500000.00</percentile> </sell> </type> </marketstat> </evec_api> im looking at pulling the following value from the <sell> section: <median>152500000.00</median> i am guessing the above should be arrayValue[71] but for some reason its not picking it up. any help on this would be greatly appreciated as im lost in this script.
  5. I am coding a PHP / API based website for eve online game. I have it all worked out apart from cross browser crap. www[DOT]shiplotto[DOT]com wont view correctly in internet explorer but it works in firefox and the built ingmae browser. can anyone help me fix it, spent days trying all sorts; <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="center" valign="middle"> </td> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <? $queryInvClass = mysql_query("SELECT groupName FROM ships WHERE typeName='$iname';") or die(mysql_error()); $invClass = mysql_fetch_assoc($queryInvClass); $queryDescription = mysql_query("SELECT description FROM ships WHERE typeName='$iname';") or die(mysql_error()); $invDescription = mysql_fetch_assoc($queryDescription); //Create the auction picture $queryInvTypeID = mysql_query("SELECT typeID FROM ships WHERE typeName='$iname';") or die(mysql_error()); $invTypeID = mysql_fetch_assoc($queryInvTypeID); ?> <table width="100%" border="0" cellspacing="5" cellpadding="5"> <tr> <td align="left" valign="top" colspan="2"><?php echo "<span class='shipName'>".$iname."</span><br />"; echo "Value: <span class='isk'>".number_format($marketPrice[marketPrice], 2, '.', ',')." ISK</span><br /><br />"; ?></td> </tr> <tr> <td align="left" width="150"><img src="images/types/shiptypes_png/128_128/<?php echo $invTypeID[typeID]; ?>.png" align="middle" /></td> <td align="left" valign="top"><?php //While loop to create auction info. echo "<span class='normalbold'>Ticket Price:</span> <span class='credits'>".number_format($ticketPrice[ticketPrice], 2, '.', ',')." ISK</span><br />"; echo "<span class='normalbold'>Info:</span> <span class='normal'>".$invDescription[description]." </span><br />"; ?></td> </tr> </table> </td> </tr> </table> <table width="800" border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <? if($half<=$tickeRow){ ?> <tr> <? //echo "IF"; //While loop to create half of the buttons if ticket is not sold else list ticket owners name. $tt=1; while($tt<=$half){ $queryTopTicket = mysql_query("SELECT * FROM promoTickets WHERE promoID='$promoID'&&ticketNumber='$tt';") or die(mysql_error()); $topTicketName = mysql_fetch_assoc($queryTopTicket); if(!empty($topTicketName[username])){ ?> <td width="20%"><? echo $tt.") <span class='nameyellow'>".$topTicketName[username];?></span></td> <? } else { ?> <form action="buy_ticket2.php" method="post"> <input type="hidden" name="ticketNumber" value="<? echo($tt); ?>" /> <input type="hidden" name="promoID" value="<? echo $promoID; ?>" /> <input type="hidden" name="ticketPrice" value="<? echo $ticketPrice[ticketPrice]; ?>" /> <td width="25%"><input type="submit" value="Buy Ticket <? echo $tt; ?>" class="btn"> </form> </td> <? } $tt++; } ?> </tr> <? } else{ //echo "ELSE"; $tRow = 17; //echo $tRow; $tCount = 0; while($tCount < $tRow){ ?> <tr> <? //While loop to create half of the buttons if ticket is not sold else list ticket owners name. $tt=1; while($tt<=$tickeRow){ $queryBotTicket = mysql_query("SELECT * FROM promoTickets WHERE promoID='$promoID'&&ticketNumber='$tnum';") or die(mysql_error()); $botTicketName = mysql_fetch_assoc($queryBotTicket); if(!empty($botTicketName[username])){ ?> <td width="20%"><? echo $tnum.") <span class='nameyellow'>".$botTicketName[username]; ?></span></td> <? } else { ?> <form action="buy_ticket2.php" method="post"> <input type="hidden" name="ticketNumber" value="<? echo($tnum); ?>" /> <input type="hidden" name="promoID" value="<? echo $promoID; ?>" /> <input type="hidden" name="ticketPrice" value="<? echo $ticketPrice[ticketPrice]; ?>" /> <td width="25%"><input type="submit" value="Buy Ticket <? echo($tnum); ?>" class="btn"> </form> </td> <? } $tt++; $tnum++; } ?> </tr> <? $tCount++; } } ?> </table> </td> </tr> <tr> <td> <td> </tr> <tr> <td> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <? if($half<=$tickeRow){ ?> <tr> <? //echo "IF"; //While loop to create half of the buttons if ticket is not sold else list ticket owners name. $tb=$half+1; while($tb<=$numberTickets[numberOfTickets]){ $queryBotTicket = mysql_query("SELECT * FROM promoTickets WHERE promoID='$promoID'&&ticketNumber='$tb';") or die(mysql_error()); $botTicketName = mysql_fetch_assoc($queryBotTicket); if(!empty($botTicketName[username])){ ?> <td width="20%"><? echo $tb.") <span class='nameyellow'>".$botTicketName[username]; ?></span></td> <? } else { ?> <form action="buy_ticket2.php" method="post"> <input type="hidden" name="ticketNumber" value="<? echo($tb); ?>" /> <input type="hidden" name="promoID" value="<? echo $promoID; ?>" /> <input type="hidden" name="ticketPrice" value="<? echo $ticketPrice[ticketPrice]; ?>" /> <td width="25%"><input type="submit" value="Buy Ticket <? echo($tb); ?>" class="btn"> </form> </td> <? } $tb++; } ?> </tr> <? } else{ //echo "ELSE"; $tRow = (($numberTickets[numberOfTickets]/6)/2); //echo $tRow; $tCount = 0; while($tCount < $tRow){ ?> <tr> <? //While loop to create half of the buttons if ticket is not sold else list ticket owners name. $tb=1; while($tb<=$tickeRow){ $queryBotTicket = mysql_query("SELECT * FROM promoTickets WHERE promoID='$promoID'&&ticketNumber='$tnum';") or die(mysql_error()); $botTicketName = mysql_fetch_assoc($queryBotTicket); if(!empty($botTicketName[username])){ ?> <td width="20%"><? echo $tnum.") <span class='nameyellow'>".$botTicketName[username]; ?></span></td> <? } else { ?> <form action="buy_ticket2.php" method="post"> <input type="hidden" name="ticketNumber" value="<? echo($tnum); ?>" /> <input type="hidden" name="promoID" value="<? echo $promoID; ?>" /> <input type="hidden" name="ticketPrice" value="<? echo $ticketPrice[ticketPrice]; ?>" /> <td width="25%"><input type="submit" value="Buy Ticket <? echo($tnum); ?>" class="btn"> </form> </td> <? } $tb++; $tnum++; } ?> </tr> <? $tCount++; } } ?> </table> </td> </tr> </table> </td> </tr> <tr> <td> <? echo "<br />"; ?> </td> </tr> </table> <? $s++; } ?> Its bugging me to hell..
  6. ha finally figured it out. $id = $_POST['typeID'] ; $typeName = $_POST['typeName'] ; $marketPrice = $_POST['marketPrice']; $auction = $_POST['auction'] ; if(isset($_POST['Submit'])) { for($i=0;$i<$count;$i++){ $sql1 = "UPDATE `ships` SET `marketPrice`='$marketPrice[$i]', `auction`='$auction[$i]' WHERE `ships`.`typeID`='$id[$i]'"; $result1 = mysql_query($sql1); for whatever reason i changed typeID to assign to $id instead of $typeID and it worked.. strange. Thank you for help and assistance guys and gals
  7. still no luck, here is link to test page; http://www.shiplotto.com/test.php
  8. i still cant figure out what you mean here is my newest code with the crap taken out. <?php include "../connect.php"; $sql="SELECT * FROM ships LIMIT 10"; $result=mysql_query($sql); // Count table rows $count=mysql_num_rows($result); ?> <table width="500" border="0" cellspacing="1" cellpadding="0"> <form name="form1" method="post" action=""> <tr> <td> <table width="500" border="0" cellspacing="1" cellpadding="0"> <tr> <td align="center"><strong>typeID</strong></td> <td align="center"><strong>Ship Name</strong></td> <td align="center"><strong>Market Price</strong></td> <td align="center"><strong>Auction?</strong></td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td align="center"><? $typeID[]=$rows['typeID']; ?><? echo $rows['typeID']; ?></td> <td align="center"><? $typeName[]=$rows['typeName']; ?><? echo $rows['typeName']; ?></td> <td align="center"><input name="marketPrice[]" type="text" id="marketPrice" value="<? echo $rows['marketPrice']; ?>"></td> <td align="center"><input name="auction[]" type="text" id="auction" value="<? echo $rows['auction']; ?>"></td> </tr> <?php } ?> <tr> <td colspan="4" align="center"><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </td> </tr> </form> </table> <?php // Check if button name "Submit" is active, do this if($_POST['Submit']){ for($i=0;$i<$count;$i++){ $sql1="UPDATE ships SET marketPrice='$marketPrice[$i]' AND auction='$auction[$i]' WHERE typeID='$typeID[$i]'"; $result1=mysql_query($sql1) or die(mysql_error()); } } if($result1){ echo "sucess<br>"; echo $sql1; //header("location:test.php"); } mysql_close(); ?>
  9. ok how do i process the POST array from the form?
  10. if i echo $sql1 after it runs i get the following: UPDATE ships SET marketPrice='', auction='' WHERE typeID='592' seems to add nothing to the database which makes the field blank?
  11. now it did something, it set every value in the db table to blank:-[
  12. still cant find my problem even after sleep.
  13. your frontpage code would handle this by attaching a stylesheet, but if not we will need more of the front page coding. you could always wrap news in a DIV tag; <div class='news'>$news</div> and assign its variables in a seperate style sheet as follows; .news{ width: 100%; padding: 0; text-align: left; }
  14. i am getting the database connection in the header file. which i didnt include in the code above. the query above all pull the data correctly, its just the UPDATE query thats not updating the sql tables.
  15. can anyone see anything wrong here?? it wont update the Ships table.. i should of gone bed hours ago but its bugging me: <?php $sql="SELECT * FROM ships ORDER BY auction='Yes' DESC"; $result=mysql_query($sql); // Count table rows $count=mysql_num_rows($result); ?> <table width="100%" border="0" cellspacing="1" cellpadding="0"> <form name="form1" method="post" action=""> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0"> <tr> <td align="center"><strong>Active?</strong></td> <td align="left"><strong>typeID</strong></td> <td align="left"><strong>Item Name</strong></td> <td align="left"><strong>Base Price</strong></td> <td align="left"><strong>Market Price</strong></td> <td align="center"><strong>Auction</strong></td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <?php if ($rows['auction'] != "Yes") { ?> <td align="center"><img src="../images/site/delete.png" /></td> <?php } else { ?> <td align="center"><img src="../images/site/accept.png" /></td> <? } ?> <td align="left"><span class="isk"> <? $typeID[]=$rows[typeID]; ?> <? echo $rows['typeID']; ?></span></td> <td align="left"><span class="eveyellow"><? echo $rows['typeName']; ?></span></td> <td align="left"><span class="normal"><?php echo number_format($rows['basePrice'])?> isk</span></td> <td align="left"><input name="marketPrice[]" type="text" size="10" id="marketPrice" value="<? echo $rows['marketPrice']; ?>"> <span class="credits">(<?php echo number_format($rows['marketPrice']/1000000, 2)?> m)</span></td> <td align="center"><input name="auction[]" type="text" size="6" id="auction" value="<? echo $rows['auction']; ?>"></td> </tr> <?php } ?> <tr> <td colspan="4" align="center"><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </td> </tr> </form> </table> <?php // Check if button name "Submit" is active, do this if($Submit){ for($i=0;$i<$count;$i++){ $sql1="UPDATE ships SET marketPrice='$marketPrice[$i]', auction='$auction[$i]' WHERE typeID='$typeID[$i]'"; $result1=mysql_query($sql1); } } if($result1){ header("location:ship.php"); } mysql_close(); ?> typeID is my primary key in the table and i only want to update "marketPrice" and "auction" upon submit. its a update multiple rows form by the way. thank you so much for helping me... again.. would be lost without phpfreaks.
  16. haha so you do... nearly 1am and i have been coding for 6 hours... getting tired. Thx
  17. I am looking into sotring values in the sql database as "29824478.15" for example, now i use the number_format function to display as: 29,824,478 is it possible to get it to display as: 29.8m if its a million number and 0.29m if its less than a million for example?
  18. i have the following code: <?php session_start(); include "connect.php"; $queryFinished = mysql_query("SELECT * FROM `finished` ORDER BY auctionID DESC LIMIT 10;") or die(mysql_error()); $queryAdmin = mysql_query("SELECT maxClosed FROM `admin`;") or die(mysql_error()); //echo $queryAuctionID." = Auction ID<br />"; $username = mysql_fetch_assoc($queryFinished); $queryShip = mysql_query("SELECT * FROM ships WHERE typeName='$username[itemName]';") or die(mysql_error()); $getShip = mysql_fetch_assoc($queryShip); $shipID = $getShip[typeID]; echo "<img src='http://image.eveonline.com/Character/".$username[charid]."_32.jpg'> <span class='eveyellow'>".$username[username]."</span> has won a <img src='/images/types/shiptypes_png/32_32/".$shipID.".png'/> ".$username[itemName]." with ticket number #".$username[ticketNumber]."<br />"; ?> it basically lists the most recent auctions that have won, but even though i set the query to LIMIT by 10 it still only shows the 1? is something above sticking out to anyone? i know it looks messy but im still learning.
  19. worked like a charm, except i couldnt use: date_default_timezone_set('Europe/London'); // Set your default timezone so i just edited &setTime to bring it into the timezone. Thank you. ;P
  20. ok this is my test.php page: <?php include "connect.php"; // GRAB LAST UPDATE TIME OF CRON FROM DATABASE $queryTime="SELECT time FROM cron WHERE id='1'"; $result=mysql_query($queryTime); while($row=mysql_fetch_assoc($result)) $setTime = $row['time']; //echo "$setTime"; // ECHO THE INTERGER TIME FOR DEBUG //echo "<br>"; $Time = time(); // Sets time in interger //echo $Time; $timePlus = time()+3600; // Sets time in interger and adds 1 hour to match with UTC Time //echo $timePlus; $Date = date("Ymd"); // Sets date in 20100212 format $lastrun = date("H:i", $setTime); // converts last run from integer to XX:xx //echo $lastrun; $lastrun2 = date($setTime)-3600; // server is 1 hour in front so take 1 hour away //echo $lastrun2; $lastrun3 = date("H:i", $lastrun2); // converts last run minus 1 hour from integer to XX:xx //echo $lastrun3; //now you want to figure out when next run is due (server is 1 hour behing UTC so you need to + 3600) $nextrun = $lastrun2 + 3600; // calculate when next run is due and adds 1 hour to match with UTC Time. $nextruntime = date("H:i", $nextrun); //converts next run from integer to xx:xx //now you want to calculate the time now "UTC" and countdown from the next due time $countdown = $nextrun - $timePlus; $countdownmins = round($countdown/60, 2); echo "last cron was at $lastrun3, the next cron will be at $nextruntime, the time remaining until next cron is in $countdownmins Minutes"; ?> i got the cron file to insert the time() in the database that it ran, that works perfectly now. runs on the hour. as you can see the above 90% works except the last section: //now you want to calculate the time now "UTC" and countdown from the next due time $countdown = $nextrun - $timePlus; $countdownmins = round($countdown/60, 2); echo "last cron was at $lastrun3, the next cron will be at $nextruntime, the time remaining until next cron is in $countdownmins Minutes"; its not calculating the minutes correctly and counting them down. here is link to my current page: http://www.shiplotto.com/test.php thank you for help thus far.. i would appreciate if someone could help me finish up this code before my brain pours out of my ears on the floor in a php math mess..
  21. and i need to format the output something like: "Time remaining until next run is in 59 Minutes" not sure how i can set it around but its basically working of a cron script that runs every 10 minutes past the hour. thats primarily what the timer is to show users when the next "update" will be.
  22. forgot to add, after the 60 minutes is over i need the timer to keep repeating 24 hours a day. and i will have to edit the 60 minutes at some point to 30 minutes etc....
  23. When it comes to php im still no expert, and when it comes to date/time within PHP my brain melts... what i want is a countdown timer in php that echos how long left is on a timer. i will set the timer for 60 minutes. and i want it to countdown in minutes (no need to display hours, seconds etc...) everytime the user refreshes the page the coundown will obivously refresh. how can i code this or anyone have any handy links to point me in the right direction. Thanks
×
×
  • 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.