Jump to content
xisto Community
Sign in to follow this  
coolcat50

I'm New To Php.

Recommended Posts

I currently have taught myself PHP using w3schools and I am at the ending of the beginner tutorials. Should I go on to the Advance tutorials or try to learn some more PHP from another site or what.Also, using CPanel on the Wii, how would I link a PHP file to a MySQL database for a comment system. A example code would be sweet. I myself have written a code on paper, but it seems like crap.Thank you.

Share this post


Link to post
Share on other sites

You need to know a few things first before you can start connecting to a mysql database. host, username, password, database name. Once you know that you can set it up with the code below and if all is correct you can execute queries with mysql_query("query goes here", $link); There should be plenty of examples out there just do a search.

<?php		$db_host = 'localhost';		$db_user = '';		$db_pass = '';		$db_name = '';		// if user has submitted anything then validate.		$link = mysql_connect($db_host, $db_user, $db_pass)			or die("Could not connect to Database > ". $db_name);		mysql_select_db($db_name,$link)			or die("Could not find Database > ". $db_name);?>

Share this post


Link to post
Share on other sites

I think the best way to learn, at least for myself, is to do. what i mean is take what you have learned already and make a website with it and when you want to do something and you dont know how to either ask for help or search on the internet, thats what i did and i consider myself a mid-level coder and still learning when i can be bothered!Im not sure if the tutorial you followed included databases but there are really great tutorials on tizag.com, just google "PHP mysql tutorial tizag.com" and you should find some good ones there. sonesay also posted some good code there so try to understand each line of that so you are able to create the code yourself and add or change things

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.