I'm New To Php.

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > PHP Programming

I'm New To Php.

coolcat50
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.

Reply

sonesay
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.

CODE
<?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);

?>



Reply

shadowx
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

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Similar Topics
Looking for im, php,

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for im, php,

*MORE FROM TRAP17.COM*
advertisement



I'm New To Php.



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE