2

I want to build a simple CMS system that would be directly connected to my remote database (mysql) and be able to add,delete/update fields/records.

Are there any examples of this, tutorials? where should I start?

I'm assuming the language would be php? (Are there any free scripts that does this already?). I would like to build my own regardless.

Lawrence Cherone
  • 46,049
  • 7
  • 62
  • 106
Spike Lee
  • 411
  • 2
  • 11
  • 23

3 Answers3

4

Use adminer or phpMyAdmin

You don't need to make your own. They are both opensource so you can go through it and browser around code

Easy example code (show tables & allow to delete tables)

<?php
if ($_GET['del']){
    mysql_query("DROP TABLE ".$_GET['del']);
    echo "done";
}

if ($_POST['password']){
    $con = mysql_connect('localhost', $_POST['username'], $_POST['password']) or die("Wrong details");
    mysql_select_db($_POST['db']) or die("Wrong database");
}


if ($con){
    $result = mysql_query("SHOW TABLES");
    while($row = mysql_fetch_row($result)){
        echo "<br/>Table ".$row[0]." (<a href='?del=".$row[0]."'>Delete</a>)";
    }
    die();
}
?>

<form method="post" action="">
Username: <input name="username" /><br />
Password: <input name="password" /><Br />
Database: <input name="db" /><br />
<input type="submit" />
</form>
genesis
  • 50,477
  • 20
  • 96
  • 125
  • I already have phpMyAdmin but want something simpler, maybe a login form then a view with the actual table where the player can add/remove tables (something really simple). – Spike Lee Jul 28 '11 at 23:10
  • @SpikeLee: added code for you. show, delete tables – genesis Jul 28 '11 at 23:21
  • As i said i'm new to this however - when i run that script i get prompted to enter the username,password and db. Then a message saying "delete" appears without showing any tables. You have any tutorials i could look at - helping me achieve something that can display the table fields, add/delete and update? (or pointing me on the right path). – Spike Lee Jul 28 '11 at 23:35
  • you will see list of tables if you have any tables in that database. Edited my script – genesis Jul 28 '11 at 23:38
0

You need to make sure you read up on MySQL injection to ensure a undesirable visitor cannot inject malicious queries into your database.

I would recommend PHP as I find it goes hand in hand with MySQL

Take a look at this to get you started: http://phpminiadmin.sourceforge.net/

Brad Morris
  • 365
  • 2
  • 12
-1

If you still want to make your own tools for managing MySQL dbs start by making a decision about what language you want to develop these tools with.

.NET/C# combined with WPF can be a great a solution a desktop based one of course but it will do.

Learning is never annoying.

  • I was thinking of going with php, although i never done it before it seems rather simple. But as i said it would be much simpler if i could have a look at some tutorials/examples of implementations? (if such a thing exists) – Spike Lee Jul 28 '11 at 23:11
  • If you want a desktop-based solution, go with HeidiSQL. http://www.heidisql.com/ – TRiG Aug 23 '11 at 11:06