Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> I'm New To Php.
coolcat50
post Oct 10 2007, 08:57 PM
Post #1


Super Member
*********

Group: Members
Posts: 298
Joined: 5-October 07
From: Random Places
Member No.: 51,171
Spam Patrol
myCENT:30.84



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.
Go to the top of the page
 
+Quote Post
sonesay
post Oct 10 2007, 09:21 PM
Post #2


|||[ n00b King ]|||
*********

Group: [HOSTED]
Posts: 732
Joined: 20-June 07
From: Auckland
Member No.: 45,102
myCENT:7.62



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

?>


Go to the top of the page
 
+Quote Post
shadowx
post Oct 11 2007, 08:32 AM
Post #3


Look around, what do you see? Incorrect.
***********

Group: [HOSTED]
Posts: 1,126
Joined: 12-April 06
From: Essex, UK
Member No.: 21,719
myCENT:29.25



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
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics


 



- Lo-Fi Version Time is now: 2nd December 2008 - 11:18 AM