Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: I Need help!

  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question 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
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,634
    Thanks
    4
    Thanked 148 Times in 139 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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.

  • #4
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,634
    Thanks
    4
    Thanked 148 Times in 139 Posts
    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.

  • #5
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,634
    Thanks
    4
    Thanked 148 Times in 139 Posts
    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.

  • #7
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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!

  • #8
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,947
    Thanks
    79
    Thanked 4,424 Times in 4,389 Posts
    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://codingforums.com/web-projects/

  • Users who have thanked Old Pedant for this post:

    kyleh55y (08-18-2011)

  • #9
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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?

  • #10
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Unhappy

    Quote 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

  • #11
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,947
    Thanks
    79
    Thanked 4,424 Times in 4,389 Posts
    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.

  • #12
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Could not connect:

    I'm guessing that's my problem!

  • #13
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,947
    Thanks
    79
    Thanked 4,424 Times in 4,389 Posts
    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?

  • #14
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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!

  • #15
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Does it matter that its a 123-reg hosting and domain?


  •  
    Page 1 of 2 12 LastLast

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •