Jump to content

thefollower

Members
  • Posts

    324
  • Joined

  • Last visited

    Never

Everything posted by thefollower

  1. Hey, I have a query with two inner joins or trying to anyway - but its not returning the rows correctly when it should find at least 1 row based on current data in my database.... this is what i tried: <?php $Get = mysql_query(" SELECT (army.Quantity+times.Quantity) AS TotalQuantity,military.Size FROM army INNER JOIN military ON army.ID=military.ID INNER JOIN times ON army.ID=times.ID WHERE (times.UserID='$UserID' AND times.Type='Buy' AND times.Quantity>0) OR (army.Quantity > 0 AND army.UserID='$UserID')") Or die(mysql_error()); ?> Currently army is empty, but times has 1 row with matching UserID and with a quantity of 500 and type set to "Buy" but mysql_num_rows returns 0. The idea is to get the total quantity the user has of a army ID which could be on either of the two: army or times table. Hope you can help.
  2. Hey, I am currently using DATEDIFF() to compare the difference between two timestamps but currently returns total number of days passed so how can i change this to minutes? Hope you can help me.
  3. bump - post ended up on a entirely different page.
  4. Oh - turns out no rows returned like you suggested, so mysql_fetch_assoc is nothing... so what can i do to return something accurate in this situation that won't give an error? I edited the function to this to test it: <?php function completedresearch($UserID){ $Get = mysql_query("SELECT ResearchID FROM mayor_research WHERE Completed='1'") Or die(mysql_error()); If(mysql_num_rows($Get)<1){ Echo ' no rows'; } $row = mysql_fetch_assoc($Get); return ($row); } ?>
  5. Hey im having problems it an in_array check im doing im not entirely sure what is wrong so im better off showing u the script. The idea is to check the user has completed some thing by checking it against an id loaded from a table - im using a function because its easier in the long run for future scripts that also may need to do similiar checks. <?php function completedresearch($UserID){ $Get = mysql_query("SELECT ResearchID FROM research WHERE Completed='1'") Or die(mysql_error()); return (mysql_fetch_assoc($Get)); } //query to get research id If(in_array($row['ResearchID'],completedresearch($_SESSION['Current_User']))){ Echo 'yes it is in the array'; } ?> The error i get is: Warning: in_array() [function.in-array]: Wrong datatype for second argument in functions.php on line 979
  6. http://i49.tinypic.com/9ut53c.jpg < see image Still doesn't work, all bar one is invalid but they all come out invalid bar the first one. I used: <?php $Array = 'http://www.megaupload.com/?d=62LER87B, http://www.megaupload.com/?d=04L0TC2M, http://www.megaupload.com/?d=09P3EHZL, http://www.megaupload.com/?d=ZACN1J, http://www.megaupload.com/?d=0C6NFC2Y, http://www.megaupload.com/?d=0GPWC3OJ, http://www.megaupload.com/?d=0LUAWPF0, http://www.megaupload.com/?d=0OOOXXJX, http://www.megaupload.com/?d=0R8JP2V7, http://www.megaupload.com/?d=441KFFEZ'; $pieces = explode(",", $Array); foreach ($pieces As $var){ $source = file_get_contents($var); echo "<strong>$url</strong>: "; if (preg_match('~<input\b[^>]*>~i', $source)) { echo '<span style="color: green;">File is available.</span><br />'; } else { echo '<span style="color: red;">File does not exist.</span><br />'; } } ?>
  7. I tried this: The second link in $Array is invalid but it returns valid. <?php $Array = 'http://www.megaupload.com/?d=ZD6ACN1J,http://www.megaupload.com/?d=ZACN1J'; $pieces = explode(",", $Array); foreach ($pieces As $var){ Echo '<b>'.$var.'</b> - '; if (preg_match('/Unfortunately, the link you have clicked is not available./i',$var)) { echo "<font color=red>File does not exist.</font>"; } else { echo "<font color=green>File available.</font>"; } echo '<br>'; } ?>
  8. What variable does the text pass into ?
  9. Say a megaupload file no longer exists on megaupload's server it still seems to return its live - for example: Example try it with this: http://www.megaupload.com/?d=62LER87 < this is a dead link the file for that link is not found on megaupload's server but it returns live yet the upload is still dead.
  10. Hmm no this isn't working - i tested it with a dead link and it still returned value 200 which according to wikipedia means its OK but it's not cos its deffinately a dead link.
  11. Hey, Is there a way to explode a string which would have a fixed first half then a wildcard second half... for example say i have: www.domain.com?id=12345678 www.domain.com?id=87654321 Notice i got the domain the same but ID is different but say a user inputs it like this: Any one of the above inputs could occur from a user But because i know the the id has 8 chars i want to explode it so i can get each link and put them in an array regardless of the format they are inputted.
  12. Gave it ago and it loads megaupload inside my site i guess its meant to! But i don't get how i can just check the link is live from that? I was thinking more like just it returning "Live" "Unavailable" or "Dead". Although looks like you got the idea - but i need to some how return just response rather than load the page - if you get me ?
  13. Hey, I use a file host to store alot of my back ups but the links die from time to time. So i thought i should try and make my own link checker - but when i google for scripts i just find websites which offer a link checker... rather than a guide on how to make them.. Any one got any idea where to begin with link checkers on sites like Megaupload/Rapidshare ?
  14. Argh i found the issue... i had a JS file included on all pages which calls an image direction of /images/ How ever when you go into a subfolder it then things it has to look in /subfolder/images/ So i put ../images/ and that seems to so far solve the issue Looks like you were right about it being related to directories! Thanks!
  15. I have put that on every page line 1 but nothing displays but yet it does to the error log every time =/ If its any help, i noticed this only occurs when viewing a page which is not in the root directory... as the file is in the subfolder /staff/scrip.php this the only time the error occurs... regardless of what subfolder... in the main root how ever this error never occurs.. not sure if that helps? very odd.
  16. I am getting errors in my error log related to the scirpt looking for something that cannot be found but nothing in my script is physically looking for a direction which is why i don't get why im getting the error! Unless i am misunderstanding. This is the error: Can some one explain what it means and what i am doing wrong/what i have to do to solve it?
  17. Well vague questions give vague answers... my guess you got your script wrong. But i see this not being a php but more a JS issue.
  18. I see i didn't know that functions worked backwards... also I have nl2br because I was about to ask how to make emails with nice formats and stuff... can't find a tutorial on how to do it anywhere with google. I got mysql_real_escape_string there just from sheer habit...lol! Thanks for the tip off.
  19. But logically the mysql_real_escape_string is before the stripslashes.. not after.. i already thought of that
  20. Renamed a variable? That doesn't really make a difference to the issue involved.
  21. What do you suggest? You do a php script like: load first number (add 1 increment to a table and store timestamp) make a function to check 30 seconds has passed from timestamp if so .. load increase+1 and update timestamp and repeat until increment == 500 this won't be automated how ever you could then use something like cron to run such a script or a script that will run the php file whilst keeping the numbers coming out server side..
×
×
  • 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.