Page 1 of 1

Creating a simple system.

Posted: Thu Aug 28, 2008 1:28 am
by al3x8730
I wanted to create something simple, I already made a base, but I'm not sure it would fit with what I need help with.

I was thinking something like this: You can type in a name and it will display information that people wrote about that person. And you can have the option to add a paragraph or whatever about that person. I know php somewhat, but I'm not good with MySql.

I did something SUPER basic.


Code: Select all

<?php
 
$username = $_POST['username'];
 
 
 
if ($username == "example") {
 
echo "information about this user";
 
} else {
 
echo "No user was found"; 
 
}
 
?>

Re: Creating a simple system.

Posted: Thu Aug 28, 2008 3:02 am
by matthijs
So what is your question?

And you should post this in the Code forum if you have a question about the code

Re: Creating a simple system.

Posted: Thu Aug 28, 2008 6:14 am
by greyhoundcode
Not entirely sure what it is you are asking, however here are some ideas for you:

My personal taste is to use a wrapper class to access the database - I feel it makes my code more readable, and consequently easier to debug:

Code: Select all

 
$database = new DatabaseHandler();
$database->Query("SELECT `name`,`city` FROM `userinfo` WHERE `identity`='$userID'");
 
foreach ($database->Rows as $item)
{
  echo "$item <br>";
}
 
Where of course $database is an instance of DatabaseHandler - a class that handles database queries and tidies away unsightly mysql_connect statements etc.