Web Analytics Made Easy -
StatCounter I Need help! - CodingForum

Announcement

Collapse
No announcement yet.

I Need help!

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

  • I Need help!

    Firstly, I am new to this website and appreciate your patience. I recently took over the running of my webpage from a professional to save money and have only so far caused my self so much stress....

    I was wondering if there was a way to create a MySQL database and have my HTML site extract data from the database and display it on my site.

    For Example:

    Database will hold: Company name, Address and Contact Details...

    using MySQL and PHP or something is there a way to display

    Company
    Address
    Tel
    Web

    on my site?

    Thanks in advance

    Kyleh55y

  • #2
    Yes there is. Do a web search on PHP, MySQL and web forms.

    Note that saving money can often come with headaches particularly if you have no knowledge of how to do any programming.

    Comment


    • #3
      Thanks

      Thank you for your help! Tell me about it i have one now. I know HTML and CSS but the rest bugs the hell out of me.

      Comment


      • #4
        I recently took over the running of my webpage from a professional to save money
        Sounds like that may not have been the best decision then.

        Comment


        • #5
          Yeah , on my site at the moment i have to manually type in every detail and i thought i could make it easier by inserting PHP or something even asp to import the data into my site from a database or excel speadsheet... I wish i could have learned this instead if HTML.

          Comment


          • #6
            HTML is like graduating Kindergarten, PHP/MySQL is like starting high school, not difficult by any means just further down the road in your education.

            So you are either going to have to learn how to do it OR find someone to pay to get them to do it for you. But you've been down that road before and what you needed to get done didn't get done from the sounds of it.

            Comment


            • #7
              Thats right, and i had to pay £100 to update it everytime i needed to add another piece of information! I was spending about £1000 a month just adding a few contact details to our customer page!

              Comment


              • #8
                Well, you were probably being overcharged, but we can't tell that for sure from your description. I would think that for £1000 you could get a complete-forever-with-peanut-butter-and-pickles-on-it contact page.

                You might want to look at the Web Projects forum here
                http://www.codingforum.net/forumdisplay.php?f=47
                Be yourself. No one else is as qualified.

                Comment


                • #9
                  ok,

                  I have my form connected to my SQL Database but when submitted it shows

                  "Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''test','etsy','kjlk','njkln','nn;;l','nln;','lknnlkkl','lknlk'' at line 3

                  can anyone tell me what this means?

                  Comment


                  • #10
                    Originally posted by kyleh55y View Post
                    ok,

                    I have my form connected to my SQL Database but when submitted it shows

                    "Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''test','etsy','kjlk','njkln','nn;;l','nln;','lknnlkkl','lknlk'' at line 3

                    can anyone tell me what this means?
                    Just thought you might need somemore details
                    ''test','etsy','kjlk','njkln','nn;;l','nln;','lknnlkkl','lknlk'' are fake entries i placed in my form to test it.

                    The form is basic HTML/PHP as below

                    <form action="insert.php" method="post">

                    Section: <input type="text" name="section" /><br />
                    Company Name: <input type="text" name="companyname" />
                    <br />
                    Address Line 1: <input type="text" name="addressline1" />
                    <br />
                    Address Line 2: <input type="text" name="addressline2" />
                    <br />
                    Address Line 3: <input type="text" name="addressline3" />
                    <br />
                    Town: <input type="text" name="town" />
                    <br />
                    County: <input type="text" name="county" />
                    <br />
                    Postal Code: <input type="text" name="postcode" />
                    <br />
                    Tel: <input type="text" name="tel" />
                    <br />
                    Fax: <input type="text" name="fax" />
                    <br />
                    E-mail: <input type="text" name="email" />
                    <br />
                    Webpage: <input type="text" name="web" />
                    <br />
                    Submit to site: <input type="submit" />
                    </form>


                    and the insert.php is below

                    <?php
                    $con = mysql_connect("server","username","passport");
                    if (!$con)
                    {
                    die('Could not connect: ' . mysql_error());
                    }

                    mysql_select_db("n1stopadvertisercou_621555_db1", $con);

                    $sql="INSERT INTO Company (section, companyname, addressline1, addressline2, addressline3, town, county, postcode, tel, fax, email, web)
                    VALUES
                    ('$_POST[section]','$_POST[companyname]','$_POST[addressline1]','$_POST[addressline2]'),'$_POST[addressline3]','$_POST[town]','$_POST[county]','$_POST[postcode]','$_POST[tel]','$_POST[fax]','$_POST[email]','$_POST[web]'";

                    if (!mysql_query($sql,$con))
                    {
                    die('Error: ' . mysql_error());
                    }
                    echo "1 record added";

                    mysql_close($con)
                    ?>

                    I hope this helps!

                    Kyleh55y

                    Comment


                    • #11
                      Add one line of code:
                      Code:
                      $sql="INSERT INTO Company (section, companyname, addressline1, addressline2, addressline3, town, county, postcode, tel, fax, email, web)
                      VALUES
                      ('$_POST[section]','$_POST[companyname]','$_POST[addressline1]','$_POST[addressline2]'),'$_POST[addressline3]','$_POST[town]','$_POST[county]','$_POST[postcode]','$_POST[tel]','$_POST[fax]','$_POST[email]','$_POST[web]'";
                      
                      echo "<hr/>DEBUG SQL: " . $sql . "<hr/>";
                      Tell us what that DEBUG line shows you.
                      Be yourself. No one else is as qualified.

                      Comment


                      • #12
                        Could not connect:

                        I'm guessing that's my problem!

                        Comment


                        • #13
                          Yep. But if you have other pages that *CAN* connect, then clone their connection code.
                          Code:
                          $con = mysql_connect("server","username","passport");
                          You *do* realize that you need the *actual* name of the server in there, along with the *actual* username and password values?
                          Be yourself. No one else is as qualified.

                          Comment


                          • #14
                            yes thanks, I need to just figure out which server i put either "localhost" or server side host name

                            Thanks for your support you are very helpful!

                            Comment


                            • #15
                              Does it matter that its a 123-reg hosting and domain?

                              Comment

                              Working...
                              X