1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

php mysql flat file operations

Discussion in 'PHP' started by phpwreker, Nov 4, 2012.

  1. #1
    well since there are many flat file operations associated with php and mysql on files like these

    [​IMG]

    where would i start ?
     
    phpwreker, Nov 4, 2012 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    What do you want to do? i don't get your needs?
     
    EricBruggema, Nov 4, 2012 IP
  3. phpwreker

    phpwreker Greenhorn

    Messages:
    67
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    i wanted something simpler to work on ... i was looking for a simple registration form / script then a login form /script to see a few php mysql operations ...

    the only thing i saw was this link

    http://phpeasystep.com/phptu/6.html
    which is a tutorial on a login form /script
    but lacks a registration form /script


    maybe i should try to design a registration form /script for that table

    i cant think of anything better ...
     
    phpwreker, Nov 4, 2012 IP
  4. phpwreker

    phpwreker Greenhorn

    Messages:
    67
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
  5. phpwreker

    phpwreker Greenhorn

    Messages:
    67
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #5
    i want to make a site where i can sell icecream ...

    [​IMG]
     

    Attached Files:

    phpwreker, Dec 4, 2012 IP
  6. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #6
    Maybe you should try something more basic first - like the client-server model. Like the document object model. Like HTML and CSS.
     
    Rukbat, Dec 4, 2012 IP
  7. phpwreker

    phpwreker Greenhorn

    Messages:
    67
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #7
    [​IMG]

    i am a bit lost ..

    a home page

    registration link registration page registration form ...

    login link login page login form ...

    a member only page link ..a member only page ... where a streaming video describes how icecreams are made ...

    and finally order ice cream page . .
     
    phpwreker, Dec 4, 2012 IP
  8. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #8
    Because you're trying to create a website before you've learned the things you need to know in order to be able to create a page. Learn them in order.
     
    Rukbat, Dec 4, 2012 IP
  9. phpwreker

    phpwreker Greenhorn

    Messages:
    67
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #9
    yea thanks .i am trying to learn them in order .. this is the sort of stuff i was told to build .. but failed the first time .. this is my 4rth try on the same subject ...

    [​IMG]
     
    phpwreker, Dec 4, 2012 IP
  10. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #10
    You don't start by building, you start by studying. And you study, in this order, the client-server model, the document object model, HTML and CSS. Learn one before starting to study the next.
     
    Rukbat, Dec 4, 2012 IP
  11. phpwreker

    phpwreker Greenhorn

    Messages:
    67
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #11
    edit ...

    The message you have entered is too short. Please lengthen your message to at least 10 characters.

     
    Last edited: Dec 5, 2012
    phpwreker, Dec 5, 2012 IP
  12. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #12
    No, it would retrieve individual prices from the table, multiply each by the quantity for that item, then add the amounts. You never store a value you can calculate from existing data, except possibly in an invoice table.

    A description of the program in words ia a lot more helpful to answer your questions than pretty pictures and code snippets not related to the question.

    As far as the variable name, it's whatever the programmer decides to call it - $a, $total and $total_amount_of_all_items_sold_on_this_invoice are all legal variable names, although if the name is really long it slows the processor down and it can make reading and debugging the code a nightmare. Especially if you have 2 variables named

    $total_amount_of_all_items_sold_on_this_invoice
    and
    $total_amount_of_all_items_sold_on_the_invoice

    or some such nonsense.

    The general rule used in computer programming is to make the name meaningful and as long as it needs to be but no longer. So the above could be $invoice_total and $invoice_total_other, for example. (Or even $invTotal and $invTotalOther. Use mixed case to make it easier to read if you don't like underlines.)

    (And it's "Your Total" - you're is a contraction of you are.)
     
    Rukbat, Dec 5, 2012 IP
  13. phpwreker

    phpwreker Greenhorn

    Messages:
    67
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #13
    [​IMG]

    [​IMG]

    thats what i am really trying to understand ... all i know is that the script i am looking for works like a form ... in an html page .. but i am not really sure how the code works inside the script ..

    i was thinking of something that takes a variable ( ice cream ) with a fixed price multiplies it with a few drop down menu option of 1 2 3 4 5 .. and displays the total sum in the page ....
     
    phpwreker, Dec 5, 2012 IP
  14. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #14
    In order to do it from a database you have to submit the form to the server, where the database is located. The script on the server gets the price and send it back to the browser, where the rest of the browser script calculates the price and displays it. (The server and browser script, say PHP and Javascript) may be in the same file (or they may be in separate files), but they aren't running at the same time. The server script runs (on the server), then sends the browser script to the browser to display. To talk back and forth between them you use AJAX, a technique that allows the browser to send data to the server and get data back. (Or you submit the form and the server script creates a new browser page with the total or whatever you're calculating, and sends that to the browser. To the user it looks as if the browser went to a different page.)

    You can't start by looking at a site, then looking at the script and hope to understand it. You start by learning programming and the server-side and client-side (browser) languages, and how the client and server interact. THEN you look at sites and scripts.

    You're reading a Russian novel before you learned Russian or the Cyrillic alphabet. Some of it looks familiar, but you have no hope of understanding any of it until you learn the language and the alphabet.
     
    Rukbat, Dec 5, 2012 IP
  15. phpwreker

    phpwreker Greenhorn

    Messages:
    67
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #15
    i dont want to use javascript ... i only want php and mysql
    could you explain this program in a bit more simpler terms ...

    i only have one type of icecream ..

    one icecream .. one fixed price .... drop down menu with 5 options ...the total sum

    ice cream type one with fxed price x 1 (drop down menu ) .. the total sum

    ice cream type one with fxed price x 2 (drop down menu ) .. the total sum

    ice cream type one with fxed price x 3 (drop down menu ) .. the total sum

    ice cream type one with fxed price x 4 (drop down menu ) .. the total sum

    ice cream type one with fxed price x 5 (drop down menu ) .. the total sum

    50 x 1

    50 x 2

    50 x 3

    50 x 4

    50 x 5

    php program multiplication by a constant ?
     
    Last edited: Dec 5, 2012
    phpwreker, Dec 5, 2012 IP
  16. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #16
    At the very least, you'll need HTML. PHP and SQL (MySQL is a program, not a language) don't display on the user's screen.

    echo $_POST['quantity'] * 0.5;

    (Work in dollars, not cents.)

    Of course you have to have an HTML <form> with a dropdown (named quantity in this case) and a submit button.
     
    Rukbat, Dec 5, 2012 IP
  17. phpwreker

    phpwreker Greenhorn

    Messages:
    67
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #17
    [​IMG]

    this is the kind of program i am looking for i think ....

    the ice cream price .. staying fixed ...

    then i need to create a drop down value from 1 to 5 ... which multiplies the constant value of ice cream price for every drop and submit

    i have never done this before ...





    What we are trying to do in the above html page is that we have created a HTML FORM that is going to POST (send) data to the PHP file table_results.php this file will be called by the web-server and processed after processing it will be sent to the browser.

    The PHP global array $_POST['variable name']


    Value from HTML drop down menu into php variable?

    value from html drop down menu into php variable ?

    <!DOCTYPE html>
    <html>
    <body>

    <form action="processicecreams.php">
    <select name="icecream">
    <option value="one">1</option>
    <option value="two">2</option>
    <option value="three">3</option>
    <option value="four">4</option>
    <option value="five">5</option>
    </select>
    </form>

    </body>
    </html>

    i cant understand a variable value or a variable name here



    the html form feild is a slut to deal with


    i am trying to find a variable name and variable value
    variable name .. variable value

    in a form ...


    variable name is the icecream
    variable value is the 1 2 3 4 5


    i am trying to send a variable name $_POST['variable name'] to the php script in the form action ... ok

     
    Last edited: Dec 6, 2012
    phpwreker, Dec 6, 2012 IP
  18. phpwreker

    phpwreker Greenhorn

    Messages:
    67
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #18
    $_POST['icecream']


    ok begining of a php script called processicecream.php

    this script should be able to multiply the variable value ( 1 2 3 4 5 ) to the ice cream fixed price ... and display the total



    [​IMG]



     
    Last edited: Dec 6, 2012
    phpwreker, Dec 6, 2012 IP
  19. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #19
    You think, but you think wrong. What you're looking for is instant understanding of something that takes months to begin to get a handle on. If you could read the code you'd see that it's full of errors.

    That's not what the code says.

    HTML isn't a programming language, so you won't find any variables (or any other programming things) in it.

    OK, then you'll have to invent your own web, because the one everyone else uses doesn't send $_POST['variable name'] to the php script in the form action, it has named elements in the form, and the form has an action, unlike the one in the example you gave.

    Since you don't understand programming, or how the client interacts with the server, none of this makes sense to you - and it won't until you put all this stuff away and study how it all works. You don't look at code until you know all the things you're asking here, and you learn them by studying books (or the content of well-written websites), not by looking at code.
     
    Rukbat, Dec 6, 2012 IP
  20. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #20
    You're not there yet. Start with Algorithms + Data Structures.pdf Don't just skim it, study it. You should be done with it by spring.
     
    Rukbat, Dec 6, 2012 IP