This is the archive of the old Colorless! Go to the new Colorless →

PHP and MySQL (Thread)


A quick introduction - Well I'm Kairna and I'm an incoming 3rd year college student taking up Computer Science as my major.

Recently I got interested in studying PHP and MySQL for self-indulgence. Maybe because I'm considering taking a web science category for my thesis, if I don't get accepted for the game development laboratory. So I decided that I would study PHP and MySQL over the vacation (April - May). The problem is, I do not know where to start.

I know you would probably say, "just Google it" or something, but then Google is so awesome that it will just give me tons of website about PHP and MySQL.

I know that there are a lot of programmers here in The Colorless (and as far as I know, The Colorless runs on some PHP and MySQL) so I thought that asking you guys will help me somehow~

So, any advice / comments / suggestions / violent reactions?

Thank you in advance!


Thank you for the heads-up. I guess that code above simply outputs "Hello World". (or am I wrong? D:)

Hopefully, I can start studying by next week. Too bad, I can't start this week because of the remaining final exams that I have to take.

From what I read on, I need to install Apache and PHP (and MySQL as well).


Okay, I mean to reply before, but better late than never. xD

So... Before diving into code, preapre your environment. If you're on Windows, you can use WAMP, it's painless and will get the ball rolling with PHP + Apache + MySQL.

What's next... databases... I'd suggest getting a blogging system or something like that. Can be Wordpress. Install the database and analyze it. How it's laid out, etc. Make some posts to see how it works. There are tables, columns, how are tables interconnected?

Also, learn a bit of HTML, and how the HTTP model works: query strings, GET vs POST, cookies. HTTP is very simple and the more you understand the better your apps will be. Just try to use the Chrome/Safari Inspector or Firefox's Firebug and see what's happening!

Then dive into programming. Either books or tutorials. Here's a series of tutorials I find an easy read and cover a lot of ground:


After you're doing your queries, writing to the database and showing stuff on screen, remember that there's a lot to cover, but it only gets better from here as you start doing more with less. Try moving to some advanced tools like RedBeans (for accessing the database), or Smarty templates (to separate code from logic) or Mustache (same as smarty but easier) or even whole frameworks like CodeIgniter, Synfony or Zend.

This is awesome, I was just contemplating creating a thread on the very same thing!
I'm somewhat educated in MySQL and HTML, but have never really gotten into linking the two together yet. I think I'll install Wordpress on the site I'm working on at the moment, see how that works out.

I really can't wait to start studying. Three more days. Actually, when I was in 4th year high school, we discussed PHP and MySQL but not in-depth. So yeah, just the basics. But I forgot everything about it since it was just a quick discussion >_>


Yeah, better late than never xD

From the looks of it, I think I must clean my PC again. I thought of switching to Ubuntu for studying PHP but since I'm not yet used to Ubuntu (which I have yet to study too), maybe I'll just stick to Windows then. Also, I need to review my HTML since the last time I encounter it was in high school.


Let's study together! Haha.

I think XAMPP is good too, for installing APACHE+MYSQL with PHP support. :)
I'm also interested in studying PHP and MYSQL too. Yay let's team up together! :DD

Edit: You could also download Notepad++ from here. :) It will really help you a lot, as there is color coding for 'everything'. Hope it helped you. :)

Been meaning to start to dive deeper into development. This certainly helps a lot thanks.

This is quite useful. Especially given how the only PHP code I've ever really used for web development has been

<?php include("someotherpageorsomething.php"); ?>

which granted has a lot of use but isn't nearly as advanced as I should be on the subject.

My CSS work left me frustrated, because different browsers have different regulations for implementation of nearly everything I want to do (like gradients) so I just get pissy at the end of the day more or less.

Still, I'm probably going to be building a larger scale website this summer (not as large as this) so I'm glad to know there's a place I can go to if I run into stupid coding errors. XD

Unfortunately, I haven't started studying OTL

So I have a question, I installed WAMP on my PC. Then I went over the tutorial that @glassx gave me. I made a .php file from the example of the tutorial, but I don't know how to run the .php file D:

Sorry because I know this sounds so newbie :(

Place the file in your www directory. (Left-click the Wamp icon and click "www directory").

Then open the file with your browser.

Oh shit! Gargron is right. My mistake ;o)

@Gargron and @RangleGoose: Oh dear, I should have tried doing that. /feels stupid. Anyway, thank you! :) I think I can proceed with the tutorials now. xD

iono. i feel like i should bump this thread. yay for bumping!
nah, actually I need some help, my brain isn't working properly today so I thought I should ask you guys about this:

What I'm trying to make is a pagination system, usually, pagination examples are using MySQL or a database, which isn't what I really need. I'm making a pagination for news content that only shows 3 items per page. This news system read files from a directory and show them the content.

$list = $this->getNewsList();
global $form;
$i = 1;
$per_page = 3; //Number of News per page

$page = intval(@<a href="/user/" rel="nofollow"></a>$_GET["page"]);       
if (0 == $page){  
    $page = 1;  

$len = count($list); //Number of News in the Directory    
$page_count = ceil ($len/$per_page); //Number of pages  

  echo "<div id=\"content\"><div class=\"content_in\">";  
  foreach ($list as $value) {  
    $newsData = file($this->newsDir.DIRECTORY_SEPARATOR.$value);  
    $newsTitle  = $newsData[0];  

     $submitDate = $newsData[1];      
     unset ($newsData['0']);  
     unset ($newsData['1']);  
     unset ($newsData['2']);  

     $newsContent = "";  
     foreach ($newsData as $value) {  
           $newsContent .= $value;  

    if ($i <= $per_page) {  
    echo "  
                <div id=\"set_title\">$newsTitle</div><div class=\"hr\"><hr /><br/><br/></div>  
<span id=\"set_date\">$submitDate</span>  
<span id=\"set_content\">$newsContent</span>";  


  if (sizeof($list) == 0){  
     echo "<span id=\"set_content\" style=\"text-align:center;\">".htmlentities(LANG_NO_NEWS)."</span>";  

  echo "<div id=\"pagination\">";  
  echo "test";  
  echo "</div></div></div>";  

dunno what to do. :'( someone help me please?

You are on the old site. New site is here:

The site has been updated on the 24th December 2011. Please go there when you are finished with the archives.

  • 481,435 posts
  • 2,075 threads
  • 23,121 users