Jump to content

B0b

Members
  • Posts

    91
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

B0b's Achievements

Member

Member (2/5)

0

Reputation

  1. Mchl, My goal is to transfer a .txt list to a mySQL database, then remove duplicate entries from it, shuffle the list and finally separate the table into 20 sub-tables. I managed to separate it fairly quickly using: SELECT * FROM tableName LIMIT ... DELETE FROM tableName LIMIT ... Where LIMIT split it in equal parts based on quantity of entries in the original table. I then remove duplicate entries using a SELECT DISTINCT and shuffle using ORDER BY RAND() on each sub-table. The issue with this method is that there may still be duplicate entries as only the sub-tables are cleared and the mixing isn't as good as it could be. Also, an excessively large original table that would result in sub-tables greater than 250K would lead to a huge load time. If you have any idea, please let me know.
  2. I am having the same problem as well with this: CREATE TABLE $TMPtableName AS SELECT DISTINCT columnName FROM $tableName If I set a limit to 250K, it will take few seconds while a limit to 500K will require about a minute. Not limit... errr. Why is mySQL ALWAYS slowing down beyond ~250K?
  3. Hum, I am having the exact same problem as I am trying to separate a table into parts: for ( $i = 1; $i <= 20; $i++ ) // In 20 parts. { $TMPtableName = $i . '_' . $tableName; mysql_query( "CREATE TABLE $TMPtableName ( ID int auto_increment not null, columnName varchar( 255 ) Unique, primary key ( ID ) )" ); } // Determine total of entries. $total = mysql_query( "SELECT MAX( ID ) FROM $tableName" ); $total = mysql_fetch_row( $total ); $total = $total[0]; $counter = 1; for ( $i = 1; $i <= $total; $i++ ) { $tmpQuery = mysql_query( "SELECT columnName FROM $tableName WHERE ID = $i" ); $tmpQuery = mysql_fetch_row( $tmpQuery ); $tmpQuery = $tmpQuery[0]; $TMPtableName = $counter . '_' . $ableName; mysql_query( "INSERT INTO $TMPtableName ( columnName ) VALUES ( '$$tmpQuery' )" ); $counter++; if ( $counter > 20 ) { $counter = 1; } } Any clue?
  4. #1, thanks!
  5. $dbCon = mysql_connect( 'localhost', 'root', 'password' ); mysql_select_db( 'database', $dbCon ); $tableName = 'tableName'; mysql_query( "CREATE TABLE $tableName ( columnName varchar( 255 ) )" ); mysql_query( "LOAD DATA INFILE '/var/www/docs/myDomain/hugeFile.txt' INTO TABLE $tableName" ); echo mysql_error();
  6. Thanks guys. The following error is returned: I am using the absolute path to the file. Any clue?
  7. Thank you Mchl. Would this be the proper syntax for LOAD DATA INFILE?: mysql_query( "LOAD DATA INFILE 'hugeFile.txt' INTO TABLE $tableName LINES TERMINATED BY" . "\r\n" ); Doesn't work?
  8. Hi everyone, I'm trying to transfer a large .txt list of 2M+ entries into a mySQL databse. Everything works fine until it reaches about 250K entries, from there, the performance dramatically drops and it takes ages to complete the rest. Using top command, I may clearly see the CPU doesn't seem to work as much as it did for the first 250K. Most of the time, it idles and the entries are very slowly transfered (about 10 per second), then it spins for a second to transfer at 10K+/sec. What's going on? $handle = fopen( 'largeFile.txt', 'r' ); $dbCon = mysql_connect( 'localhost', 'root', 'password' ); mysql_select_db( 'database', $dbCon ); mysql_query( "CREATE TABLE tableName ( jack varchar( 255 ) Unique )" ); while ( !feof( $handle ) ) { $line = trim( fgets( $handle ) ); if ( $line != '' ) { mysql_query( "INSERT INTO tableName VALUES ( '$line' )" ); } } Thanks so much!
  9. I wish text not to be highlighted when we click and drag our mouse on it (ie. what you do when you wish to copy/paste a block of text).
  10. B0b

    PHP if

    if ( $row['personale'] != '1' && $row['personale'] != '2' ) { // Is not 1 and is not 2: not admin. } else { // Is admin. }
  11. Hi everyone, I would like to know how, via CSS, we may make text not clickable? For instance, if you click on my message and move your mouse, it will highlight it in blue: that's what I'd like to remove! Thanks!
  12. You should go through W3Schools tutorials: http://www.w3schools.com/ <body> <div id='counter'></div> </body> <script type="text/javascript"> theArray = new Array( '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' ); for ( counter in theArray ) { document.getElementById( 'counter' ).innerHTML = theArray[counter]; } </script>
  13. Thanks for your input Ken. I don't know why there's a base64_encode there, but my situation has evolved since my last message. My goal is simply to send out an email from an Hotmail account (it. through SMTP authentication). Here's how the code looks like right now: <?php $sock = socket_create( AF_INET, SOCK_STREAM, SOL_TCP ); socket_bind( $sock, 'XX.XX.XX.XX' ); socket_connect( $sock, 'smtp.live.com', 25 ); socket_write( $sock, 'EHLO mydomain' . "\r\n" ); socket_write( $sock, 'STARTTLS' . "\r\n" ); socket_write( $sock, 'EHLO mydomain' . "\r\n" ); socket_write( $sock, 'AUTH LOGIN' . "\r\n" ); socket_write( $sock, 'myemail' . "\r\n" ); socket_write( $sock, 'mypassword' . "\r\n" ); socket_write( $sock, 'MAIL FROM: <anotheremail>' . "\r\n" ); // And this will output this error: "Connection reset by peer". I've been told Hotmail requires an SSL connection and fsockopen would solve this, but I got to bind an IP address to my socket, so here I am.
  14. B0b

    hi need help

    Connecting to your mySQL database is done this way: $dbUser = 'your_database_username'; $dbPass = 'your_database_password'; $database = 'your_database_name'; $dbCon = mysql_connect( 'localhost', $dbUser, $dbPass ); mysql_select_db( $database, $dbCon ); You should refer to this: http://www.w3schools.com/php/php_mysql_connect.asp
  15. <textarea cols=20 rows=20><?php echo 'this' . "\n" . 'that' ?></textarea>
×
×
  • 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.