You're database table would just include an extra column called 'type' to designate if they were a Doctor, Nurse, etc....

I agree with ardav, a simple login script will do just fine. Upon the sql query include a check for their 'type' and you're set.

Undefined index errors normally come from variables being called for but don't necessarily exist yet.

I edited your code:
[code]
<?php
$drinks = $_POST['drink']; //here is your error, change to:
if(isset($_POST['drink'])) {
$drinks = $_POST['drink'];
$drink1 = $drinks[0];
$drink2 = $drinks[1];
}

if(isset($_POST['first_name'])) { $first_name = $_POST['first_name']; }

} else {
$first_name = "unknown";
echo $first_name;
}
[/code]

Hope this clears things up for you.

inni2626 commented: thanks +1

I don't think you HAVE to make it that complicated with an algorithm. Instead, you could try using PHPs str_replace() function, where if a string "possesses" the keyword, add some css styling to it.

str_replace('haystack', 'needle', 'replace with what');

[code]
$keyword = "awesome";
$string = "This website article is awesome!";
$highlight = str_replace($string, $keyword, "<strong>$keyword</strong");

print $highlight;
[/code]

I haven't tested this code, but off the top of my head this will hopefully lead you in the right direction. Happy coding.

asif49 commented: Gave me great help, saved me hours of time! +3

Zero, for something like this, you'll start learning MySQL Operators.

[code]
SELECT * FROM actiongames ORDER BY RAND()
[/code]

If you want to designate how many rows to gather

[code]
SELECT * FROM actiongames ORDER BY RAND() Limit 5
[/code]

Hope this helps!

-==Zero==- commented: Thanks Mate :) +2

All better
[code]
<?php
// dBase file
include "dbConfig.php";
if(isset($_POST['submit'])) { //if the login button is pushed
if(isset($_POST['username'])) {
$username = mysql_real_escape_string($_POST['username']);
}

if(isset($_POST['password'])) {
$password = mysql_real_escape_string($_POST['password']);
}

$sql = "Select COUNT(*) from `dbusers` where username = '$username' AND password = '$password'";

$result=mysql_query($sql);

//check that at least one row was returned

$rowCheck = mysql_result($result, 0);

if($rowCheck > 0) {

$_SESSION['username'] = $username;

header ("Location: index.php");

//we will redirect the user to another page where we will make sure they're logged in

} else {
//if nothing is returned by the query, unsuccessful login code goes here...

echo 'Incorrect login name or password. Please try again.<br>';

echo "$username - $password";

}

} else { //show login form
//If all went right the Web form appears and users can log in
echo "<form action=\"?op=login\" method=\"POST\">";
echo "Username: <input name=\"username\" size=\"15\"><br />";
echo "Password: <input type=\"password\" name=\"password\" size=\"8\"><br />";
echo "<input type=\"submit\" name=\"submit\" value=\"Login\">";
echo "</form>";
}

?>

[/code]

Replace it with this:

[code]
<?php
// dBase file
include "dbConfig.php";
if(isset($_POST['submit'])) { //if the login button is pushed
if(isset($_POST['username'])) {
$username = mysql_real_escape_string($_POST['username']);
}

if(isset($_POST['password'])) {
$password = mysql_real_escape_string($_POST['password']);
}

$sql = "Select COUNT(*) from `dbusers` where username = '$username' AND password = '$password'";

$result=mysql_query($sql);

//check that at least one row was returned

$rowCheck = mysql_result($result, 0);

if($rowCheck > 0) {

$_SESSION['username'] = $username;

header ("Location: index.php");

//we will redirect the user to another page where we will make sure they're logged in

} else {
//if nothing is returned by the query, unsuccessful login code goes here...

echo 'Incorrect login name or password. Please try again.<br>';

echo "$username - $password";

}
{

} else { //show login form
//If all went right the Web form appears and users can log in
echo "<form action=\"?op=login\" method=\"POST\">";
echo "Username: <input name=\"username\" size=\"15\"><br />";
echo "Password: <input type=\"password\" name=\"password\" size=\"8\"><br />";
echo "<input type=\"submit\" name=\"submit\" value=\"Login\">";
echo "</form>";
}
}
?>
[/code]

You need to add a form for people to login through. All you have now is a register form, but no login form.

Set the login forms action to login.php to process the form data.

take out the line that says $password = md5($password);

Here is a basic login script I use:

'login.php'
[code]
<?php

include('config.php');

if(isset($_POST['username'])) {
$username = mysql_real_escape_string($_POST['username']);
}

if(isset($_POST['password'])) {
$password = mysql_real_escape_string($_POST['password']);
}

$password = md5($password);

$sql = "Select COUNT(*) from users where username = '$username' AND password = '$password'";

$result=mysql_query($sql);

//check that at least one row was returned

$rowCheck = mysql_result($result, 0);

if($rowCheck > 0) {

$_SESSION['username'] = $username;

header ("Location: index.php");

//we will redirect the user to another page where we will make sure they're logged in

} else {
//if nothing is returned by the query, unsuccessful login code goes here...

echo 'Incorrect login name or password. Please try again.<br>';

echo "$username - $password";

}

?>
[/code]

Glad I could help, please mark the thread as SOLVED if you could.

Replace
[code]
// Fields are clear, add user to database
// Setup query
$q = "INSERT INTO dbusers (username,password,email) "
."VALUES ('".$_POST["username"]."', "
."PASSWORD('".$_POST["password"]."'), "
."'".$_POST["email"]."')";
[/code]
With the script I wrote and see if that works.

The above script will check to see if the $_POST data is filled, otherwise it'll return an error. I also added the escape string function to prevent SQL injection, and try to never use raw $_POST data in your SQL queries.

Try:
[code]
if(isset($_POST['username'])) {
$username = mysql_real_escape_string($_POST['username']);
} else {
echo "No username detected<br>";
}

if(isset($_POST['password'])) {
$password = mysql_real_escape_string($_POST['password']);
} else {
echo "No password detected<br>";
}

if(isset($_POST['email'])) {
$email = mysql_real_escape_string($_POST['email']);
} else {
echo "No email detected";
}

$q = "INSERT INTO dbusers SET username = '$username', password = '$password', email = '$email'";
[/code]

Post the code for your form processing

If you're planning on storing md5 data as your password, you need to set your varchar to a higher integer. Pretty sure md5 are 30+ character strings, so change it to varchar(40) and you should be safe.

Depending on where your dbconfig file is saved, you may want to change:
[code]include ("/dbConfig.php");[/code]
to:
[code]include ("dbConfig.php");[/code]
If your connection to the database is rejected, it's either your include line, or your sql connect information is wrong.