Jump to content

kmaid

Members
  • Posts

    56
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kmaid's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks....... :'( way too much time debugging that query instead of checking the data.
  2. Still stuck on this one ://. Should I be doing this as two separate queries? I really don't want to use multiple queries unless I absolutely need to. Goes against the grain to have to manipulate data like this after using a query.
  3. Most backups are simply SQL dumps to recreate all the tables. Decompress it if required using 7zip if your archiver doesn't support the format. Once you have a .sql files or whatever open it up the file in your favorite text editor and cut out the insert portions. If you just run the queries in order it won't put the duplicate fields in twice so use the latest one first. Hope that helps Edited for *better* clarity
  4. Hi all I could use some help with this query i am working on. I have a transaction table with the following structure. TransactionID - int(11), Primary Date - datetime ClientID - int(11) PaymentType - varchar(50) Reference - varchar(200) AmountUSD - decimal(8,2) AmountGBP - decimal(8,2) Amount - decimal(10,2) Currency - varchar(4) I am trying to get a monthly total of all transactions not marked as an expense or target and then attach that month's target to the result which is marked with 'Target' in the PaymentType. aka Month, Sum(`GBPAmount`), `Target` Here is my query so far. I think i am nearly there but its doing my head in. SELECT date( T1.Date ) AS Date, sum( T1.AmountGBP ) AS Sales FROM transactions AS T1 INNER JOIN transactions AS T2 ON month( T1.Date ) = month( T2.Date ) WHERE T1.PaymentType NOT IN ('Target', 'Expense') AND T2.PaymentType = 'Target' GROUP BY month( T1.Date ) its valid but doesnt return any results. If i remove the "AND T2.PaymentType = 'Target'" part i get a huge sum from joining every record to each other. I think i may need a subquery rather than a join but it seeemed overkill initially. Any help even if its just a pointer would be most appreciated Edit: MySQL client version: 5.1.41
  5. Hi, How can you store a variable name inside another variable and then refer to it? EG <? $Var1 = "Var2"; $Var2 = "WantedInfomation"; echo $Var1; //Somehow outputs "WantedInfomation" ?>
  6. Hi I am making a validation function which will strip any dangerus code from an array or string. The problem is when i create a 2D array it screws up function cleanInput($Data) { $Data = mysql_real_escape_string(stripslashes($Data)); $search = array( '@<script[^>]*?>.*?</script>@si', // Strip out javascript '@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags '@<style[^>]*?>.*?</style>@siU', // Strip style tags properly '@<![\s\S]*?--[ \t\n\r]*>@'); // Strip multi-line comments return preg_replace($search, '', $Data); } function libStripInputSlashes($Data) { if (is_array($Data)) { foreach($Data as $var=>$val) { $output[$var] = cleanInput($val); } } else { return cleanInput($Data); } return $output; } $Data = libStripInputSlashes(array(array('<HTML> \' REALINPUT', '<HTML> \' REALINPUT', '<HTML> \' REALINPUT', '<HTML> \' REALINPUT', '<HTML> \' REALINPUT','<HTML> \' REALINPUT'),array('<HTML> \' REALINPUT', '<HTML> \' REALINPUT', '<HTML> \' REALINPUT', '<HTML> \' REALINPUT', '<HTML> \' REALINPUT','<HTML> \' REALINPUT'))); Echo $Data; Any ideas how I could fix this? Thanks Kmaid
  7. I had this issue with my old webhost and getting the stats of a counter strike server. It turned out that they had a firewall on and even though allow_url_fopen was enabled the firewall was blocking the requests. I am afraid this is defiantly a question for your host. Hopefully your host will be like mine and just add a rule in for you!
  8. I find the best way to learn is to read code from open source applications and understand how it works not that i know if rapidleach is open source! I am sorry i have not done something like this before however it has interested me so take what i say with a pinch of salt ! If you need to simulate logging in by a user try using CURL. That will allow you to post username and password and then can print the response while it receives it. When i first used the Curl libary it was a learning process but turns out it is quite easy to use! I would take a look at rapidleach anyway to see how they do it. Even if you don't understand everything it should at least point you in the right direction. Good luck!
  9. Hi all, My current PHP project requires me to cache data for 5 minuets after which IF the data is requested again the data needs to be requested from another server. I store the DateTime when the data was last requested and what I would like to do is make an SQL query which returns true/false depending on if 5 minuets have passed since the stored DateTime. Is this possible and are there any examples of this or should I just convert the DateTime into a php date time and do it in PHP? Thanks Kmaid **EDIT** My bad didnt read sticky mysql version 5.0.51b-community-nt
  10. Actually i *belive* that MD5 is nolonger secure as the previosly mentioned website solved an MD5 hash of two MD5ed strings. *EDIT* I take it back must have been lucky. Joshuaceo You are missing the point of storing your password in MD5. The reason is that should someone know the hash they dont know the phrase to make the hash. Either store the password in plaintext in your database or save the password in their session when they login and use that.
  11. I haven't used Cpanel but i suggest you use Curl. With this you should be able to authenticate yourself and then parse the XML. Personally i wouldn't bother updating all of the records rather when a user logs update your table and a timestamp and only get new data after 5mins or something.
  12. I personally recommend Cerberus Helpdesk. You can get a 3 person licences completely free and access to the source so you can integrate it really easily into pretty much any system.
  13. I thought that would be the case in which case that function isnt really an option. Oh well i guess i will have to live with it.
×
×
  • 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.