Jump to content

The Little Guy

Members
  • Posts

    6,675
  • Joined

  • Last visited

Posts posted by The Little Guy

  1. you can do it via javascript.

     

    <div id="twitter_update_list"><!-- Your Latest Tweet Will Display Here Once Loaded --></div>
    <script type="text/javascript" src="//apis.jssnips.com/twitterblogger/latest.js"></script>
    <script type="text/javascript" src="//twitter.com/statuses/user_timeline/my_user_name.json?callback=twitterCallback2&count=1"></script>

     

    replace my_user_name with your twitter username

  2. @Little Guy:  Are you trying to resolve a problem you know exists? or are you just trying to cover all your bases?

     

    One of our tables has about 225,000 (~2/sec) inserts per day, and every so often we need to insert 2+ records, so instead of doing one at a time to get the insert ID's it would be nice to do it all at once.

     

    So with about 2 addition inserts per second, you can almost guarantee that while I am doing my mass insert someone else will be wanting to insert 1 or more rows as well. So if the other person doesn't get locked out, he could insert halfway through my insert, and I will then have bad historical data.

     

    Does that answer your question?

  3. I keep hearing that doing this is bad though, because someone could do an insert while my insert is only half way complete. But it seems like some of you are disagreeing with that.

     

    You can retrieve the most recent AUTO_INCREMENT value with the LAST_INSERT_ID() SQL function or the mysql_insert_id() C API function. These functions are connection-specific, so their return values are not affected by another connection which is also performing inserts.

     

    But Barand already told you this.

     

    Right but if I get auto_id 10 on one connection, and another connection gets auto_id 11 and we each insert 5 rows, I am not going to get all 5 of my inserts, I will get mine and someone esle's. since supposedly the table doesn't get locked on inserts, but maybe that is Storage Engine Specific...

  4. Going off Illusion:

    insert into table_a (col1) values ('one'), ('two'), ('three');
    set @first_iid = (select last_insert_id());
    set @last_iid = (select (row_count() + @first_iid) - 1);

     

    That should get us our first and last insert id's, and assuming the table increments by one, you can calculate all the rows inserted by basic math.

     

    I keep hearing that doing this is bad though, because someone could do an insert while my insert is only half way complete. But it seems like some of you are disagreeing with that.

  5. #2 has wild car operators in them, and the equal sign comparison doesn't support wild cards so, that is what it is searching for something that has % on the ends of what $program_name is. remove them and you should get what you are looking for

  6. when the user goes to a page check the session this should be an int for the page/step number they are on. then you just would compare their session to the step number. if the step is bigger than the session number send them back to their session number's step. once they complete a step successfully increment the session number.

  7. does the user on the database have enough permissions to import the dump file?

     

    also remove the table name from the command your running it is already in the dump file. you also have too many quotes.

     

    exec("mysql --user=... --password=... --host=... $database < /location/$filename.sql");

  8. with a single insert query, the next insert waits, till the previous one is done before it can go, I would assume that this is the same thing that way you wouldn't have the alternating inserts. I am not sure though.

  9. is it possible for two members to run this, and they are inserted every other?

     

    for example we both insert 6 records (total of 12) and it looks like this for the insert:

     

    me

    you

    me

    you

    me

    you

    ..

    ..

    and so on

     

    If that happens, then this won't really work will it?

  10. Instead of using php to populate an array, why don't you just place it into hidden HTML Div's then when you want to show one show hide all the divs then show the one you want by toggling css's "display" property.

×
×
  • 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.