Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

MySQL without MySQL

compuchipcompuchip Posts: 273Member
This is not really a problem, that is: I can work around it if I want, but if there is a solution, it would be great.
I want to write a website where it would come in very handy to use some basic MySQL. I need to change, add and delete records from various text files (or if possible: tables) and query them.
I don't know if this is possible, since I am using www.i-networx.de and therefor don't have MySQL access.
If there is no way to do this, maybe there are some functions that can help me out with the text files, so if I make a ; delimited text file, I can "easily" add/delete/change records.

I don't hope I am asking too much ... :(

Comments

  • Mark StrijbosMark Strijbos Posts: 82Member
    : I want to write a website where it would come in very handy to use some basic MySQL. I need to change, add and delete records from various text files (or if possible: tables) and query them.
    : I don't know if this is possible, since I am using www.i-networx.de and therefor don't have MySQL access.

    1. do you have file read/write permissions on this server?
    (f.i. in your /cgi-bin directory). If not, you're lost

    2. if you do, just look at the fopen(), fread() and fwrite() functions in the docfiles. this includes a couple of examples that should help you on your way

    3. remember that all these file functions require a full pathstring!
    ( absolute or relative)

    4. to make things a lot easier try to put one "record" on one line in your (text!) files.





  • compuchipcompuchip Posts: 273Member
    Yes, I have these permissions and I know how to write to / from a textfile. I have already made a site like this once, but my next project will be a bit bigger.
    I was just wondering, for example, if there is a "getrecord()" function. So instead of looping through the file till I have the right record (or reading the file in an array and writing it back, replacing one line to change a phone number), I could just write [blue]getRecord(23); writeRecord(23, "John Johnson,654321");[/blue]

    : : I want to write a website where it would come in very handy to use some basic MySQL. I need to change, add and delete records from various text files (or if possible: tables) and query them.
    : : I don't know if this is possible, since I am using www.i-networx.de and therefor don't have MySQL access.
    :
    : 1. do you have file read/write permissions on this server?
    : (f.i. in your /cgi-bin directory). If not, you're lost
    :
    : 2. if you do, just look at the fopen(), fread() and fwrite() functions in the docfiles. this includes a couple of examples that should help you on your way
    :
    : 3. remember that all these file functions require a full pathstring!
    : ( absolute or relative)
    :
    : 4. to make things a lot easier try to put one "record" on one line in your (text!) files.
    :
    :
    :
    :
    :
    :

  • Mark StrijbosMark Strijbos Posts: 82Member

    : I was just wondering, for example, if there is a "getrecord()" function. So instead of looping through the file till I have the right record (or reading the file in an array and writing it back, replacing one line to change a phone number), I could just write [blue]getRecord(23); writeRecord(23, "John Johnson,654321");[/blue]

    in short: no, there isn't such a predefined function. however, in this case it would be fairly easy to roll your own recordread() function.
    Make the records fit on one line, read the wanted line(s) as needed and parse the line read into approprate record fields

    TIP: do not rewrite "records" straight back into the file but make a copy - first read lines 0 to n, write them to the copy, write the updated record line to the copy, now read lines n to end-of-file and write them to the copy as well. replace our db file with the new, updated copy



  • compuchipcompuchip Posts: 273Member
    ok, dan doe ik dat maar
    :
    : : I was just wondering, for example, if there is a "getrecord()" function. So instead of looping through the file till I have the right record (or reading the file in an array and writing it back, replacing one line to change a phone number), I could just write [blue]getRecord(23); writeRecord(23, "John Johnson,654321");[/blue]
    :
    : in short: no, there isn't such a predefined function. however, in this case it would be fairly easy to roll your own recordread() function.
    : Make the records fit on one line, read the wanted line(s) as needed and parse the line read into approprate record fields
    :
    : TIP: do not rewrite "records" straight back into the file but make a copy - first read lines 0 to n, write them to the copy, write the updated record line to the copy, now read lines n to end-of-file and write them to the copy as well. replace our db file with the new, updated copy
    :
    :
    :
    :

  • compuchipcompuchip Posts: 273Member
    Forget it, I switched to coolfreepages.com
    It has a little background ad but WITH MySQL

    : This is not really a problem, that is: I can work around it if I want, but if there is a solution, it would be great.
    : I want to write a website where it would come in very handy to use some basic MySQL. I need to change, add and delete records from various text files (or if possible: tables) and query them.
    : I don't know if this is possible, since I am using www.i-networx.de and therefor don't have MySQL access.
    : If there is no way to do this, maybe there are some functions that can help me out with the text files, so if I make a ; delimited text file, I can "easily" add/delete/change records.
    :
    : I don't hope I am asking too much ... :(
    :

Sign In or Register to comment.