Jump to content

pengu

Members
  • Posts

    154
  • Joined

  • Last visited

    Never

Everything posted by pengu

  1. I think people do the same as me, look at this post and think it's shifty..
  2. I saw fgetcsv() after, it probably would have done what I needed.
  3. Could I ask for a moderator to remove the files attached in this thread. Thanks!
  4. <?php $YourFile = "Client_Desc.txt"; $handle = fopen($YourFile, 'r'); while (!feof($handle)) { $Data = fgets($handle, 512); print "insert into client_desc (first_name, last_name, Address1, City, Postal, Plate_Number, Email, Phone, Robot_id, description ) values('" .$Data. "','','','','')"; print "<p>"; } fclose($handle); ?> I have this so far, is it possible to put each variable or something into an array? (By variable I mean each peice of data, name , address etc) EDIT: Thanks Mad Techie, exactly what I was after! Words can not explain the love I feel for you right now!
  5. Ok screw it, attached is the information I want to change so I can insert it into a database. [attachment deleted by admin]
  6. No my post is obviously not clear enough. I have this sort of data. 2000 lines or so, in a text document. I need to insert this information into a database, but due to microsoft being buggy I am unable to just do a straight import. So I need to change all that information into the following. Having insert into client_desc (blablabla) at the start. Then using all the information into variables and putting them between ' & ' and ending with a bracket. Does this make sense, could a PHP script do that? I really don't want to manually do this for 2000 lines of data lol.
  7. I'm sorry I could not see any other places to ask this. UltraEdit uses a similar method for REGEX for FIND & REPLACE (can also use Unix regex). http://www.ultraedit.com/support/tutorials_power_tips/ultraedit/regular_expressions.html I just need some assistance, I have a data file with some information I want to insert into a database. I want to take the information from this file and change it to this. insert into client_desc (first_name, last_name, Address1, City, Postal, Plate_Number, Email, Phone, Robot_id, description ) values('D','Pearce','00 Changed St','Perth','870','','','','','') The order is not important I can change that myself with queries. Once again I'm sorry if I've posted in the wrong section. An example I came across, http://simonwillison.net/2003/Mar/23/ultraEditRegularExpressions/
  8. Having some problems with BULK INSERT *shudder* Got some data off a client, emphasis on some which is where my problem is. The table I want to insert into is the following. I'll do an example of the data this text file contains. Using the table. client_id first_name last_name address1 city postal plate_number email phone id2 desc mark turner 123 fake st bris 4600 A lot of information is missing. Now when I try to do a BULK INSERT. BULK INSERT Client_Desc FROM 'c:\clients.txt' WITH ( FIRSTROW = 2, FIELDTERMINATOR = '\t', ROWTERMINATOR = '\t\n' ) I get the following error. Which is to do with the Client_ID which is Auto Increment. Any suggestions or am I manually going to have to write up the insert line for each client, which works..
  9. Crud.. didn't realise it was solved.. sorry!
  10. Thanks, first part is helpful. I believe a cron job thru cpanel will do what I want, I would not, in this case at least, want to increment the values. The would always be set to 3 at XXXX hours
  11. Hi Ignace thanks for that... BUT cookies wont show 'WHO IS ONLINE' sort of thing will it? Because it doesn't update the table. Right? I will Google cron, this is server side I'm assuming.
  12. http://www.w3schools.com/php/php_ajax_database.asp - Changing this as required.
  13. I have a few questions. First one is about phpBB forums, as an example. You log in, do your thing and exit the browser, now it will still say you're logged in for a period of 5-10 minutes or so, even though you have exited via the browser. After that time period it will then say you're not still logged in, while checking the users. How is this achieved? Because I thought a field in the phpBB_Users would be updated and from my understanding the only way to change that is to trigger it, via a logout button. My second question, I'd like to use MyBrute as an example, thinking of it in a database sort of view. You get to do 3 fights a day, the next day this 3 fights thing is reset. Can this be achieved automatically, say, through a script or would someone have to manually run a query every day? Cheers, Pengu.
  14. Not very secure though, lol. Check out security regarding credit cards and PHP/MySQL security in general.
  15. I can't explain much more. Because of the program, privacy etc. It's not setup that great imo. That part must have been rushed. I got something working, but, it's not reliable so I gave up on it.
  16. Didn't make sense to me lol. Can you show us the table structure.
  17. Briefly looked over this, but you'll need to do some coding. http://www.w3schools.com/php/php_mail.asp - Tutorial on using the php mail() function.
  18. Dunno if it'll work because they're in the same table. Thanks anyways.
  19. That would be another problem. This was poorly written, in my opinion. IF they were to only do one product at the time, take my original crappy logic of it being always 1 MORE. Would it be possible to write a query for this?
  20. Ok below are the examples. This is for a program so I can not alter the code, or I would, to add some sort of field to accompany for what I need. When transaction is done, a 'invoice sale' for example. It puts two records into the database one for the 'invoice sale' and one for the product (coke). They have NOTHING that matches up, except the price, but in that table there are 100 of things with that price. The only thing I've noticed is with the "Transaction_ID" the can of coke is always 1 more than the original "invoice" ID. I just can't find anything in SQL that I could use to take advantage of this. So my original question, is it possible? Transaction_ID Transaction_Desc Product_ID Price Client_ID Blah 100 Invoice Sale 1 5.00 34 171 101 1 Can Of Coke @ $5.00 7 5.00 0 0
  21. Hi All, I have tried googling this, trust me. Can't seem to find the words google requires. Keeps telling me how to do it to an attached database. I've got a database that I can only pressume is corrupt, I need to run a DBCHECK against it, to verify this. However, it is from a backup and as such is an external file. I can't attach it to the database, because of the corruption. Requests that I run a DBCHECK against it. So, is it possible to do? If so, link me up please!! Using SQL Express 2005 and Management Studio.
  22. Someone did it for me If you scroll down the bottom of the thread, it has a green solved button
  23. Thank you Jake. Next question is they will start at level 1.. so I pretty much want to count from 2 onwards, will this have any effect? I mean I can easily get around it by making there starting $my_xp at 500. Edit: On second glance, Global is what I was missing, thanks heaps Jake.
  24. 2 Files. functions.inc.php -> <?PHP Function myLevel($my_xp) { switch($my_xp) { case ($my_xp > 500): // Level 2 $stuff = 'happens'; $my_level = 1; case ($my_xp > 1000): // Level 3 $stuff = 'happens'; case ($my_xp > 2000): // Level 4 $stuff = 'happens'; $my_level = 4; case ($my_xp > 3500): // Level 5 $stuff = 'happens'; case ($my_xp > 5500): // Level 6 $stuff = 'happens'; } } ?> stats.php <?PHP $my_xp = 2002; include('functions.inc.php'); myLevel($my_xp); echo $my_level; ?> Alrighty a few questions. I have removed the 'break;' from the switch, not sure if it's needed, but I thought it'd see that the first case was TRUE and break away and not bother going any further. Is this correct? How does switch handle when multiple things are true, will it take the last case down the list and use all the information from that, keeping in mind I'll be repeating certain information. (by info I mean variables) Finally It's not actually working, haha. So I want to include that list of functions, more will be added and I assume I am calling it correctly. I want to include it, set '$my_xp' then use the function to check the $my_xp and adjust information accordingly. Regards, Pengu. P.S It may look like a bad idea to do each level individually but there is method to my madness, method I tell you!
  25. Thanks for the help guys. Found the problem, I was editing a report created by someone else and some of the field names didn't have the table prefix at the front and it was clashing with the other tables. All good now! Solved.
×
×
  • 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.