Hi guyz, i'm aiming for a php and My SQL dabase website, can anybody guide me plz?

appreciate the help:)

Hey.

Have you searched online for tutorials? There are probably hundreds of PHP/MySQL tutorials available online.

I always liked the one at w3schools.com.

commented: Couldn't have said it any better. +1
Member Avatar for diafol

The tutorials are fine if you want something quick (and possibly dirty!). You'll probably benefit more from buying a book on "php5 and MySQL 5". There are loads of good books out there, but an unbelievably large number of poor online tutorials. Books are usually peer-reviewed, but any idiot (including myself) can write a tutorial and post it online.

In my experience, books are essential for the "basics", whereas online resources tend to be good for "quirky" or "experimental/cutting-edge" stuff - but only if you know what's going on.

I'd suggest learning the basics before jumping in with both feet and incorporating free online scripts. Being a "script bunny" will end in tears - your SQL statements will be full of security holes and your php will be pure spaghetti.

O'Reilly usually have good resources as well as Wrox (think they've died recently?). Although a boring subject, security is an essential aspect of learning the basics - XSS/sql injections etc. You won't believe how many tutorials I've read or scripts I've seen that don't pay the slightest attention to security.

BTW: Atli is right, as far as it goes, W3Schools is a decent resource.

Happy hunting.

commented: Excellent points there. +3

thanx guyz, i'm nt a complete nobie, i have basic PHP knowledge.

Member Avatar for diafol

So why the q?

Dear ardav, i asked bcoz i want to start designing my own CMS in PHP, that's why i was wondering what does it need to start designing my own CMS.

regardz

Well I'm a starter too, but I did my own cms, and has a lot of features!

Depending on what site it is, i can help you:
I can help you with the User Authentication/Login System, Admin Panel with User Managment, Comments etc...

yes please.........i'll appreciate it

Member Avatar for diafol

Dear ardav, i asked bcoz i want to start designing my own CMS in PHP, that's why i was wondering what does it need to start designing my own CMS.

regardz

Ah, I see. In order to make a good CMS, get a good wysiwyg editor (or write your own - not for the faint-hearted!). Spaw2, Yahoo, TinyMCE, FCKeditor etc etc. These have a good solid user base with good support. Your DB design will be the key area for your development. You'll need to identify your static elements from your variable ones and ensure that they are placed in separate tables (unless using templates).

ya, i know about editors, i have no problem, can u clarify it more please, i'm not using any template engine like Rain TPL or any other, so what do u mean by:

"You'll need to identify your static elements from your variable ones and ensure that they are placed in separate tables (unless using templates)."

Member Avatar for diafol

Sorry - that was a bit cryptic.

Your main html sections will probably be "static", e.g. navbars, sidebars, footers, banners etc etc

If you want to give total control - you'll probably need to created 'template' files to hold the various 'static' elements. You don't need a templating system - you can create your own. The following example is just that - not to be taken too seriously - just one way. There are far better ways of doing things I'm sure.

In /templates/main.php

<?php
  include("{$_SERVER['DOCUMENT_ROOT']}/includes/config.php");
  include("{$_SERVER['DOCUMENT_ROOT']}/includes/functions.php");
  include("{$_SERVER['DOCUMENT_ROOT']}/includes/dtd.php");
  include("{$_SERVER['DOCUMENT_ROOT']}/includes/head_n_body.php");
  include("{$_SERVER['DOCUMENT_ROOT']}/includes/bannerarea.php");
  include("{$_SERVER['DOCUMENT_ROOT']}/includes/nav.php");
  include("{$_SERVER['DOCUMENT_ROOT']}/includes/side.php");
  include("{$_SERVER['DOCUMENT_ROOT']}/includes/main_content.php");
  include("{$_SERVER['DOCUMENT_ROOT']}/includes/footer_n_end.php");
?>

Then in your actual displayed page, you could have something like:

<?php
  include("{$_SERVER['DOCUMENT_ROOT']}/templates/main.php");
?>

And that's it. The static content (structural html and the odd piece of static text/logos etc) can be drawn from the individual include files AND/OR from a DB, which is handled by the include files.

The dynamic data from the DB can be placed into placeholder variables within the include files.

<?php
  $navlist = getNavItems($_SERVER['PHP_SELF']);
//there are better ways of doing this - the function could spit out parsed html containing the navlist (from the DB) pertaining to that page
 ?>
<ul id="nav">
  <?php echo $navlist;?>
</ul>

thank u that was really helpful, one more ques plz, how can make my login script appear in index page (i mean the the user area in home page) in other words how to include, so that the member can login and how can i show the status in index page as well?

thanx in advance

Member Avatar for diafol

depends how deep you want to go.

A simple solution would be to login and use a $_SESSION variable to store the verified details.

Each page will have:

<?php
include('includes/login.php');
?>

The login.php file could have something like this:

if(isset($_SESSION['username'])){
  echo "<p>{$_SESSION['username']} logged in <a href='logout.php' title='log out from site'>[logout]</a></p>";
}else{
?>
<form action="includes/authenticate.php" method="post">
  <label for="username">Username:</label>
  <input type="text" name="username" id="username" />
  <label for="pw">Username:</label>
  <input type="password" name="pw" id="pw" />
<?php
   if(isset($_SESSION['login_error'])){
     echo "<p class='beware'>Username and/or password not correct</p>";
   }
?>
  <input type="submit" name="login" id="login" value="Login" />
</form>
<?php
}
?>

The above is a very simple login form / logout link display based on $_SESSION variables. The authentication.php page accepts the data from the form and uses this (via $_POST variables) to check against users in the DB. If OK, set the session variables and kill the $_SESSION variable if set. If not OK, set the $_SESSION = 1.
Then return the user to the referring page with the header() command.

Please read up on php/mysql security BEFORE going live with an authentication script. Data validation/verification/sanitizing are essential.

Member Avatar for diafol

It's better if you use ready classes... try: phpclasses.org

Easier, not necessarily better. Learning should be an active experience, rather than passive. If we take the 'classes is better' stance, we'd use Wordpress or similar. Of course some elements of app building will have to rely on ready-made scripts, e.g. wysiwyg editors.

I don't know about his Skills, but a starter can't Code everything from scratch! Classes are coded by more experienced coders, and they are provided with examples...

If he (phpangel) wants to learn php & mysql, i would suggest Lynda.com:
1. PHP with MySQL Essential Training (you will learn how to code a php/mysql a simple article site, form the scratch)
2. PHP with.MySQL Beyond the Basics (PHP gallery/OOP)

Member Avatar for diafol

I don't know about his Skills, but a starter can't Code everything from scratch! Classes are coded by more experienced coders, and they are provided with examples...

If he (phpangel) wants to learn php & mysql, i would suggest Lynda.com:
1. PHP with MySQL Essential Training (you will learn how to code a php/mysql a simple article site, form the scratch)
2. PHP with.MySQL Beyond the Basics (PHP gallery/OOP)

I agree - you can't do everything from scratch - the above links you note are good places to do some effective learning. My quibble is that a beginner will get very little from professional-level classes as they are usually OOPed and use the most efficient way of presenting conditionals (e.g. ternaries) - this is baffling for many!

Script bunnies can build decent sites, but if something goes wrong, they have little to no idea of how to fix it. As I mentioned a mix of ready-mades for things like wysiwyg editors and novel coding should be encouraged.

first of all, thank u all for the support, let me make life easy 4 u guyz, i'm beginner in PHP, and what i want from PHP now is:

to design a Web driven Database website and possibly with CMS, without having to use ready made open source CMS's.

thnax again:)

Member Avatar for diafol

Croeso (you're welcome) - good hunting.
BTW - you can't go far wrong with a decent book on PHP5/MySQL5. I won't go on and on, but books are peer-reviewed and are usually full of good practice. O'Reilly and Wrox have good publications.

first of all, thank u all for the support, let me make life easy 4 u guyz, i'm beginner in PHP, and what i want from PHP now is:

to design a Web driven Database website and possibly with CMS, without having to use ready made open source CMS's.

thnax again:)

Hi,
I'm doing the same!

lynda.com is REALLY good for learning new things.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.