Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Help with my SQL and PHP

Options
  • 24-03-2010 5:27pm
    #1
    Registered Users Posts: 3,599 ✭✭✭


    This post has been deleted.


«1

Comments

  • Registered Users Posts: 2,379 ✭✭✭toiletduck


    I'm sure they haven't thrown you in as deep as it comes across.

    Where are you hosting the site? I assume some college server?

    If not and are just developing it on a local machine, check out LAMP or more likely WAMP (Windows Apache MySQL Php). A quick google of how to install the appropriate one and you'll be away with it to learn the basics.


  • Registered Users Posts: 515 ✭✭✭NeverSayDie


    This post has been deleted.

    Do a Google search for the name "my SQL". Do another Google search for "PHP". Read through the first few hits. Then do another Google search for "MySQL PHP", and read some more.


  • Registered Users Posts: 3,599 ✭✭✭sashafierce


    This post has been deleted.


  • Registered Users Posts: 2,472 ✭✭✭Sposs


    If it's being hosted on digiweb, PHP and MySql will already be installed on the server and makes things easier for you , you will also have access to a tool called phpmyadmin which will make creating the database very easy, all you have to do now is work out how to connect your PHP script to the database, there is a ton of websites that will take you through this step by step including http://www.w3schools.com/PHP/php_mysql_intro.asp


  • Registered Users Posts: 3,599 ✭✭✭sashafierce


    This post has been deleted.


  • Advertisement
  • Registered Users Posts: 1,127 ✭✭✭mossy464


    I had to learn mysql and php last year for a college project and began with a package called XAMPP. Google for it.

    XAMPP basically provides you with what you need to develop your dynamic php website and test it on your own machine. It provides you with apache, php and mysql along with other things but all you need yourself is these three components.

    Then there are loads of tutorials out there for php and mysql. Your php will basically be contained within your html pages or you can keep the scripts seperate depending what you want to do.


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    This post has been deleted.
    Yes, that's pretty much it. Dreamweaver is a tool for creating websites. Unlike MS Word where you create word documents which only work in MS Word, there is no such thing as a "Dreamweaver site" which only works in dreamweaver.

    When you're looking at a page in dreamweaver, have a look at the "Code" view. This will show you the HTML which actually defines how your page looks. Most people who build websites on any kind of serious scale write this code directly, they don't drag-and-drop or draw them using dreamweaver. Dreamweaver simply provides a shortcut for you so you don't have to type in all that HTML.

    What you've done in dreamweaver is a good template for how your site is going to look, but now you need to get down-and-dirty with the code behind that template.

    www.w3schools.com is the place to go. They have tutorials on all of these things. It won't tell you how to build a website using PHP and MySQL, however it will explain how HTML, PHP and MySQL are used to build websites. The tutorials are short, no more than 30 minutes. They don't go into the nitty-gritty, just a high-level boost to help you understand what's going on. Once you understand that, you start building your website, constantly referring to Google for help every time you get stuck.

    Start here:
    http://www.w3schools.com/html/default.asp
    http://www.w3schools.com/sql/default.asp
    http://www.w3schools.com/php/default.asp


  • Registered Users Posts: 1,127 ✭✭✭mossy464


    I have also found that youtube can be quite good for tutorials. So give it a gander


  • Registered Users Posts: 3,599 ✭✭✭sashafierce


    This post has been deleted.


  • Registered Users Posts: 3,599 ✭✭✭sashafierce


    This post has been deleted.


  • Advertisement
  • Registered Users Posts: 3,184 ✭✭✭Kenno90


    This post has been deleted.


    Ok so you've now made your table. congrats lets call the table 'DVD'.
    do i now copy and paste the code for them tables into my adobe dreamweaver?
    in a way yes, you now have a table,
    now you need to make some php code to allow the web page to connect to the mySQL database.
    Google php code to connect to mysql database. the first link looks like a good example:D

    Now i'm sure you know the basic commands of mySQL (Select,Update,Insert,Delete)

    the PHP code will use these commands to either view,add,edit or delete date in the table 'DVD'

    An example of viewing the whole table 'DVD'
    if (!($result = mysql_query('select * from DVD', $conn)))
        {
            showError();
        }
    
    The select basically means view, the * means all, from DVD means which table.

    This code will 'gather' all the data in the table DVD, you can display the data using something like this.
    while ($row =mysql_fetch_array($result))
        {
            echo $row[ID],$row[name],$row[price],$row[rating];
     }
    
    The ID,name,price and rating are variables I made up for the table DVD.(you'd add them when making the table)
    forgive me if the syntax is not 100% correct,i'm writing this off the top of my head.

    Hopefully you'll get it eventually.

    Good Luck with your Project;)


  • Registered Users Posts: 3,599 ✭✭✭sashafierce


    This post has been deleted.


  • Registered Users Posts: 3,184 ✭✭✭Kenno90


    This post has been deleted.

    A friend of mine had a similar problem a few weeks backs.
    What version of mySQL are you running?

    Did you create a database before you created the table ?


  • Registered Users Posts: 3,599 ✭✭✭sashafierce


    This post has been deleted.


  • Registered Users Posts: 414 ✭✭billiejosie


    I'm doing the same project and having major trouble with the PHP part. I have done the front end in dreamweaver and the tables in MySQL. Really thick question but in all the tutorials I have been looking at, they say to enter the code and upload, how do I do this?! I have been trying examples with notepad but they're just staying as they are even when I save them as .php. Sorry I am just very lost!


  • Registered Users Posts: 1,127 ✭✭✭mossy464


    I'm doing the same project and having major trouble with the PHP part. I have done the front end in dreamweaver and the tables in MySQL. Really thick question but in all the tutorials I have been looking at, they say to enter the code and upload, how do I do this?! I have been trying examples with notepad but they're just staying as they are even when I save them as .php. Sorry I am just very lost!

    Do you have php installed and running?

    If not, I would recommend installing xampp and this will give you what you need. If you want a walkthrough on how to get up and running with xampp pm me.


  • Registered Users Posts: 3,184 ✭✭✭Kenno90


    I'm doing the same project and having major trouble with the PHP part. I have done the front end in dreamweaver and the tables in MySQL. Really thick question but in all the tutorials I have been looking at, they say to enter the code and upload, how do I do this?! I have been trying examples with notepad but they're just staying as they are even when I save them as .php. Sorry I am just very lost!

    Ok when they say upload i think they mean upload it to the a server(on the internet).Which i assume you are not doing.

    If you are having trouble with PHP you need to start from the beginning and learn to do the very basic of stuff(Hello World:rolleyes:)(i recommend you try all the tutorials from here they'll start you off slow ;) )

    You say your using notepad to try examples. Why are you not using dreamweaver?. Dreamweaver will colour code the PHP and visually break it down for you.When your saving them save them as php files e.g example.php

    I hate using notepad because when i save a php file it always ends up like this example.txt.php :mad: .

    Now once you have your php file on dreamweaver you can't just press f12 and preview it in a browser.It won't work

    To show the functionality of PHP files you need to set up a WAMPP Server-Stack(I use server2go it's not the best but i learned everything i know on it)

    Once you set up server2go ( check the tutorials on the website on how to do this) you run the software and your browser starts up. Then your PHP files will run now.

    It's a lot to handle but once you get used to PHP and mySQL you'll get the hang of it:D
    Good Luck

    If ya need more help . PM me.


  • Registered Users Posts: 3,184 ✭✭✭Kenno90


    This post has been deleted.

    Ok i've never worked with phpdev425.exe before so i don't know the exact procedure on setting it up:o.

    Now i'm using mySQL server 5.1. I'm using this because i have a lot of different programs using the one database,

    But since your just setting a DVD website i'd recommend you look at WAMP stacks.
    A WAMP are bundles of different software. Most have
    Apache (which is a web server).
    MySQL (which is a database management software).
    PHP (is a scripting language).

    Check out this WAMP Stack it has all of the above features and also has phpmyadmin(which is a graphical interface for mySQL)Very handy to have.

    Let us know how you get on;)


  • Registered Users Posts: 414 ✭✭billiejosie


    Kenno90 wrote: »
    Ok when they say upload i think they mean upload it to the a server(on the internet).Which i assume you are not doing.

    If you are having trouble with PHP you need to start from the beginning and learn to do the very basic of stuff(Hello World:rolleyes:)(i recommend you try all the tutorials from here they'll start you off slow ;) )

    You say your using notepad to try examples. Why are you not using dreamweaver?. Dreamweaver will colour code the PHP and visually break it down for you.When your saving them save them as php files e.g example.php

    I hate using notepad because when i save a php file it always ends up like this example.txt.php :mad: .

    Now once you have your php file on dreamweaver you can't just press f12 and preview it in a browser.It won't work

    To show the functionality of PHP files you need to set up a WAMPP Server-Stack(I use server2go it's not the best but i learned everything i know on it)

    Once you set up server2go ( check the tutorials on the website on how to do this) you run the software and your browser starts up. Then your PHP files will run now.

    It's a lot to handle but once you get used to PHP and mySQL you'll get the hang of it:D
    Good Luck

    If ya need more help . PM me.

    Thanks Kenno, thats exactly what was happening when I was using notepad, so basically what I need to do is encase the php code within my dreamweaver pages and then view it on the local host? (I'm using XAMPP) Thanks everyone, I'll give it a shot :)


  • Registered Users Posts: 1,127 ✭✭✭mossy464


    Thanks Kenno, thats exactly what was happening when I was using notepad, so basically what I need to do is encase the php code within my dreamweaver pages and then view it on the local host? (I'm using XAMPP) Thanks everyone, I'll give it a shot :)

    You can still write your php in notepad if you want just when you are saving it click File>Save As

    Click the dropdown where it says --> Save as type: change to "All Files"

    Then write the name of your php file above as filename.php


  • Advertisement
  • Registered Users Posts: 414 ✭✭billiejosie


    mossy464 wrote: »
    You can still write your php in notepad if you want just when you are saving it click File>Save As

    Click the dropdown where it says --> Save as type: change to "All Files"

    Then write the name of your php file above as filename.php

    Thanks Mossy, it sounds so basic when its said! Really appreciate all yer help guys, fingers crossed! :)


  • Registered Users Posts: 3,184 ✭✭✭Kenno90


    Let us know how you get on;)


  • Registered Users Posts: 3,599 ✭✭✭sashafierce


    This post has been deleted.


  • Registered Users Posts: 3,184 ✭✭✭Kenno90


    This post has been deleted.

    Ok so you now have your tables set up. you now need to connect your page to the database check here once you have that you can now use some sql commands to view,add,edit the data.

    The small php icon on dreamweaver shows that dreamweaver knows it's php code though it may not be working properly

    your getting there :)


  • Registered Users Posts: 414 ✭✭billiejosie


    Hi Kenno,

    you know the link you put in above about connecting the database to the website? Does that go in between body tags in dreamweaver on each individual webpage? I'm sorry to keep asking such basic questions, I'm just really struggling and my lecturer won't reply to my emails!


  • Registered Users Posts: 3,184 ✭✭✭Kenno90


    Hi Kenno,

    you know the link you put in above about connecting the database to the website? Does that go in between body tags in dreamweaver on each individual webpage? I'm sorry to keep asking such basic questions, I'm just really struggling and my lecturer won't reply to my emails!

    Hi sorry about the delay(my own assignment deadlines are nearing :mad:)

    Yes i always put the php code (to connect it to the database) in between the body tags.(i'm sure you can have it else where . thats just what I've been thought)

    That PHP doesn't have to be in every webpage, only the pages which need to access the SQL databases.

    Let me know how you doing.:)


  • Registered Users Posts: 414 ✭✭billiejosie


    Sorry everyone, I'm back with more questions!

    Just regarding my localhosting for my website using the Xampp, I have saved all my html files and images in the htdocs folder within Xampp. My Xampp bundle is saved in my C drive, is this path right?

    http://localhost/xammp/htdocs/somethingpage.html?

    This is what i was doing until today it keeps telling me the object isnt found, what have I done? This project is a nightmare!


  • Registered Users Posts: 3,766 ✭✭✭Reku


    Sorry everyone, I'm back with more questions!

    Just regarding my localhosting for my website using the Xampp, I have saved all my html files and images in the htdocs folder within Xampp. My Xampp bundle is saved in my C drive, is this path right?

    http://localhost/xammp/htdocs/somethingpage.html?

    This is what i was doing until today it keeps telling me the object isnt found, what have I done? This project is a nightmare!

    Well if that is copied from your browser adress bar then one thing that leaps out at me is /xammp/
    Should it not be /xampp/?

    I just checked on my system as I used Xampp for php and sql too and the address is just http://localhost/somethingpage.html for files in the htdocs folder.


  • Registered Users Posts: 414 ✭✭billiejosie


    Reku wrote: »
    Well if that is copied from your browser adress bar then one thing that leaps out at me is /xammp/
    Should it not be /xampp/?

    I just checked on my system as I used Xampp for php and sql too and the address is just http://localhost/somethingpage.html for files in the htdocs folder.

    Sorry that was me submitting before I checked my spelling, I meant /xampp/ !

    So I dont put in the other folder names, thanks I'll try that :)


  • Advertisement
  • Registered Users Posts: 3,184 ✭✭✭Kenno90


    Sorry that was me submitting before I checked my spelling, I meant /xampp/ !

    So I dont put in the other folder names, thanks I'll try that :)

    Hi billie,

    What XAMPP are you using??

    I'm use Server2go to test my webpages and http://127.0.0.1:4001/myweb/name-of-folder-here/name-of-file-here.html

    would be the 'url' i'd use. with server2go being installed on the c drive


Advertisement