Reccord locking with PHP & MySQL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Otto Haldi

    Reccord locking with PHP & MySQL

    Hello to all,

    Could somebody tell me if it's possible to lock a record
    with PHP when I have a simple MySQL Database by a provider
    ?

    Many thanks in advance for your help.

    Best regards

    Otto

  • Taliesson Wang

    #2
    Re: Reccord locking with PHP & MySQL

    hi,Otto[color=blue]
    >
    > Could somebody tell me if it's possible to lock a record
    > with PHP when I have a simple MySQL Database by a provider[/color]

    I'm not clear what you really want.
    If you want to LOCK the record in you SQL-SERVER level, for Mysql, that's
    impossible.
    If you want only to lock a record in your PHP program, so that not to make
    any mistake in mutile-thread/request. That's possible.
    The simplest way is to create a file in tmp folder, with name like:
    DB-TABLE-ROWNUM.lock,
    each response from php, check if there was a .lock file.
    Just like .pid file in *nix.

    best regards
    Wang


    Comment

    • Otto Haldi

      #3
      Re: Reccord locking with PHP & MySQL

      Hello Wang

      Many thanks four your quick answer.
      [color=blue]
      > I'm not clear what you really want.
      > If you want to LOCK the record in you SQL-SERVER level, for Mysql, that's
      > impossible.
      > If you want only to lock a record in your PHP program, so that not to make
      > any mistake in mutile-thread/request. That's possible.
      > The simplest way is to create a file in tmp folder, with name like:
      > DB-TABLE-ROWNUM.lock,
      > each response from php, check if there was a .lock file.
      > Just like .pid file in *nix.
      >[/color]
      Sorry my english is not perfect. Yes I like to lock a record in my PHP
      program. The table is not on my PC, but by the provider.

      [color=blue]
      > The simplest way is to create a file in tmp folder, with name like:
      > DB-TABLE-ROWNUM.lock,
      >[/color]
      Is this possible, when the MySQL server isn't installed locally ?
      Because I didn't see any tmp folder by the provider.

      Regards

      Otto




      Comment

      • Taliesson Wang

        #4
        Re: Reccord locking with PHP & MySQL

        Hi,Otto.[color=blue]
        > Is this possible, when the MySQL server isn't installed locally ?
        > Because I didn't see any tmp folder by the provider.
        >[/color]
        It will work wether the MySQL server installed locally or remotely.
        The file:DB-TABLE-ROWNUM.lock file should be created in your PHP-Server, not
        your MySQL Server.
        The main idea of this way is to create a global mark in your PHP-server, so
        that each thread could know what's goning on on certain block. Just like
        when i want you know I've been here today, I post an article with subject"
        Wang Has Been Here" in this group. :)

        Wang


        Comment

        • Useko Netsumi

          #5
          Re: Reccord locking with PHP & MySQL

          Does MySQL support row-level locking in ISAMDB but may be with InnoDB?

          "Otto Haldi" <ohaldi@freesur f.ch> wrote in message
          news:VA.0000019 0.01d77106@free surf.ch...[color=blue]
          > Hello to all,
          >
          > Could somebody tell me if it's possible to lock a record
          > with PHP when I have a simple MySQL Database by a provider
          > ?
          >
          > Many thanks in advance for your help.
          >
          > Best regards
          >
          > Otto
          >[/color]


          Comment

          Working...