Getting started : designing a web front end for mysql?

I have never programmed in the Linux environment before, and need a few pointers really.

I have a mySQL database on CENTOS and need to produce a simple web page able to query and SQL table, and update one field, thats all!

Where do I start?

  • is ECLIPSE the best IDE to use?
  • are there any demo PHP projects that I can start from, and hack?

Thanks, Peter

Personally, I use Notepad++. Not really an IDE, but for what PHP is, it works.

Where do you start.
Step 1: Design the HTML. (Take your pick on HTML editors)
Step 2: Add the PHP to make it work.

Consider that unless you’re modifying only 1 record in 1 row of 1 table, you’re going to need something a -wee- bit more complex than what you described.

@[B][COLOR=#0071D8][URL=“http://www.sitepoint.com/forums/member.php?510226-theasarius”]theasarius

[/COLOR][/B]I have development machines in Debian and in OpenSuse - (the tumbleweed versions) and I love using Eclipse with the rse target management http://jpablobr.com/past/install-eclipse-rse-target-management-project-plug-in[COLOR=#000000] to connect to various remote servers.

You should learn about the different methods to connecting to your database from PHP. I like using the PDO (PHP Data Objects [/COLOR]http://www.php.net/manual/en/book.pdo.php) for connections it is also helpful for using prepared statements and if you are not using INNODB tables in MySQL (that have their own transactions) you can use PDO’s transactions.

So if you where using PDO you would connect to it like:

$db = new PDO("mysql:host=localhost;dbname=myDb", "user", "secretPassword");

You would then query the database like:


<?php
 $sql = null;
 $sql = "SELECT communication_type, communication_category_id FROM `communication_types`;";  
 $stmt = null;
  $stmt = $db->prepare($sql);
  $stmt->execute();
  $result = null;
// Fetch as an Associative Array// then loop through the results and display in a page
  $result = $stmt->fetch(PDO::FETCH_ASSOC); 
?>
<html>
<body>
    <ul>
    <?php
        foreach($result as $key => $value){
           echo "<li>$key: $value</li>
        }
     ?>
     </ul>
</body>
</html>

This will output the mysql stored values in a list

I hope this helps.
Steve

Thanks Steve, thats exactly the pointers I needed. I’ll download and start building code
Thanks again!

Peter