MySql and php using tables

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • horus
    Sergeant

    • Jan 2007
    • 29

    #16
    Re: MySql and php using tables

    Yes, what kind of script do I use to update the tables. I only want 1 column to be updated in both tables.

    Comment

    • bobs-pcmall
      Staff Sergeant

      • Dec 2006
      • 40

      #17
      Re: MySql and php using tables

      Sorry about the delay on getting back to you.

      We've created the database and tables on Access first.
      And then done the data entry.
      Next we've created the same database and tables with the mysqladmin in cpanel
      The one thing you need to be aware of is tables in mysqladmin seem to convert to lower case.
      Example 'Wireless_Networking' gets converted to 'wireless_networking'.
      Field names don't seem to be affected this way.
      And mysqladmin adds it's own ID field for record keepping.
      Emport fields must match data types.

      Updateing one or two colunms is the problem we are experiancing with Visual.
      Parseing the xml into the database to update records.
      Right now we're not sure if it's something here to do with the schema or mapping setup.
      When we get that figured out we'll be sure to post it in this forum.
      We're new at the sql part of this too. Have been working with static page for 5 years up till now.

      Hope this helps everyone out. I'll keep you all posted. Cheers.
      Bob the Builder
      www.bobs-pcmall.com
      Without Data, you're just another opinion.

      Comment

      • navaldesign
        General & Forum Moderator

        • Oct 2005
        • 12080

        #18
        Re: MySql and php using tables

        You cannot usethe "Import "feature of phpMyadmin to update only one column. However, you can upload the csv file onthe server, and then have a simple php script that will look into the uploaded file, and update the MySQL tables accordingly (obviously, you need to set at leat one fild as index key filed, so each value will go in the correct record. )
        Navaldesign
        Logger Lite: Low Cost, Customizable, multifeatured Login script
        Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
        DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
        Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

        Comment

        • navaldesign
          General & Forum Moderator

          • Oct 2005
          • 12080

          #19
          Re: MySql and php using tables

          Originally posted by horus View Post
          Yes, what kind of script do I use to update the tables. I only want 1 column to be updated in both tables.
          As i said, it can be done, but it requires a script. If you don't already have one, you could build it or have it built for you.
          Navaldesign
          Logger Lite: Low Cost, Customizable, multifeatured Login script
          Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
          DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
          Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

          Comment

          • bobs-pcmall
            Staff Sergeant

            • Dec 2006
            • 40

            #20
            Re: MySql and php using tables

            Thanks navadesign for you email;

            Wish we understood all this by now. Should have taken a college course last fall & didn’t.
            After reading your email and looking the implementation guidelines documentation over again. We see where we went wrong.
            We were trying to set it up similar to an RSS feed.
            When they said upload to FTP account. We thought they meant Web Site Server FTP account.
            Reason for this was the VARCHAR2 which seems to be an Oracle extension for SQL. In Oracle 10g, a VARCHAR2 column may be up to 4000 bytes and it may be up to 32767 bytes.
            We don’t have Oracle here and I’m not spending that kind of money on it either. Not for 4 user licenses.

            We assume we needed to set up a DOM or Cron Job to parse the xml file into the database early in the morning, Say around 3 to 5 am EST.
            So I guess it’s back to the drawning boards here.
            Bob the Builder
            www.bobs-pcmall.com
            Without Data, you're just another opinion.

            Comment

            • horus
              Sergeant

              • Jan 2007
              • 29

              #21
              Re: MySql and php using tables

              I have a php script and I'm trying to insert a date into my database, but I keep getting an error stating that it's missing an argument. I think I'm supposed to format it for the DB , but I don't know how.

              here's some of the code:

              $today = date("YYYY-MM-DD");
              /**
              * Inserts the given
              * into the database. Returns true on success,
              * false otherwise.
              */
              function addNewUser($Name, $Phone, $Email, $State, $City, $Address, $Address2, $Referredby, $today){
              global $conn;
              $q = "INSERT INTO members VALUES ('$Name', '$Phone', '$Email' , '$State' , '$City' , '$Address' , '$Address2' , '$Referredby', '$today')";
              return mysql_query($q,$conn);
              }

              Comment

              • bobs-pcmall
                Staff Sergeant

                • Dec 2006
                • 40

                #22
                Re: MySql and php using tables

                horus;
                I believe this will be what you want here looking at what code is available.
                $today = date("Y-m-d");
                Change to this Caps gives full year 2007, month caps gives Jun, Day caps gives Mon. Lower case gives 07,06,18
                Bob the Builder
                www.bobs-pcmall.com
                Without Data, you're just another opinion.

                Comment

                • Watdaflip
                  Major General

                  • Sep 2005
                  • 2116

                  #23
                  Re: MySql and php using tables

                  If you want a full list of the possible choices for formatting you date they are located here

                  PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.

                  Register/Login Script
                  Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

                  Comment

                  • horus
                    Sergeant

                    • Jan 2007
                    • 29

                    #24
                    Re: MySql and php using tables

                    OK thanks, but I still can't submit the date to the database.
                    The datatype for that column is varchar. When I changed the datatype to Date and tried to submit the date, nothing happens. Is there any more formatting that I have to use in order to enter it into the database?

                    Comment

                    • navaldesign
                      General & Forum Moderator

                      • Oct 2005
                      • 12080

                      #25
                      Re: MySql and php using tables

                      The field should be type "Date".

                      The formatting should be

                      $date = date("Y/m/d");

                      However, this is only important if you want to be able to format the date in any other format in your retrieval (display) script. Otherwise, you can simply use the varchar type and save the date as string, or also use a timestamp
                      Navaldesign
                      Logger Lite: Low Cost, Customizable, multifeatured Login script
                      Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
                      DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
                      Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

                      Comment

                      • horus
                        Sergeant

                        • Jan 2007
                        • 29

                        #26
                        Re: MySql and php using tables

                        Thanks, I realized that it was not inserting the date because I wasn't
                        asking it to submit the date. LOL

                        One question though, how can I make two columns relate to each other when they are in separate tables.

                        Ex.

                        Table 1
                        Name|Email

                        Table 2
                        Name | Password

                        How can I make it so that Name in both tables will be the same.

                        Comment

                        • Watdaflip
                          Major General

                          • Sep 2005
                          • 2116

                          #27
                          Re: MySql and php using tables

                          You would have to manually set them to be the same.

                          Although if you are trying to have like a user login for one table, and user information in another, it would be best to relate an id between the two. That way if the name gets changed the two tables are still connected by the id, which shouldn't ever need to be changed

                          Register/Login Script
                          Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

                          Comment

                          • navaldesign
                            General & Forum Moderator

                            • Oct 2005
                            • 12080

                            #28
                            Re: MySql and php using tables

                            To write the same data in two tables you need a script that will run two queries. But, as Watdaflip stated, there should be a common data in both tables so that you can "join" the tables in your display script.
                            A simple real life example: suppose you have three tables, One with Client details, one with Invoice numbers, and one with Invoice details. The first two are jointed through the Customer ID column, the second to the third through the Invoice number column.
                            Navaldesign
                            Logger Lite: Low Cost, Customizable, multifeatured Login script
                            Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
                            DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
                            Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

                            Comment

                            • horus
                              Sergeant

                              • Jan 2007
                              • 29

                              #29
                              Re: MySql and php using tables

                              That's what I want to know my tables have a common id but how do I join them? And if I join them will the 2 tables become one or will that column just link them?

                              Comment

                              • navaldesign
                                General & Forum Moderator

                                • Oct 2005
                                • 12080

                                #30
                                Re: MySql and php using tables

                                They are simply linked (joined) and as such they can be treated as one by the scripts. But they always remain two independent tables.

                                Please note that working with joined tables requires some coding experience, so can not pretend to create such scripts if you don't learn the correct syntax and use first. Google it, there are lots of tutorials on the net about MySQL tables.
                                Navaldesign
                                Logger Lite: Low Cost, Customizable, multifeatured Login script
                                Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
                                DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
                                Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

                                Comment

                                Working...
                                X