users details

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
ericburnard
Forum Contributor
Posts: 104
Joined: Wed Jun 15, 2005 5:11 pm
Location: Chesterfield, UK

users details

Post by ericburnard »

hi there. i have a database set up and a login scrip working ok :D now i am looking for a script that will insert the users details into the page.

I have looked on the net and had a play around but it dosnt seem to be working

help would be great thanks
Eric
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Could you post the code you have so far?

This is a really vague question since it all depends on what you want to show and how you want to show it.

Essentially, run a SELECT query on your database WHERE the user ID is the same as who logged in then loop over the results to show what you got.
User avatar
ericburnard
Forum Contributor
Posts: 104
Joined: Wed Jun 15, 2005 5:11 pm
Location: Chesterfield, UK

Post by ericburnard »

Code: Select all

<?php

$dbhost = "localhost";
$dbname = "madashat_users";
$dbuser = "madashat_eric";
$dbpass = "********";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = ("SELECT * FROM users WHERE username = '$username'"); 

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
   $message  = 'Invalid query: ' . mysql_error() . "\n";
   $message .= 'Whole query: ' . $query;
   die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
   echo $row['name'];
   echo $row['age'];
   echo $row['website'];
   echo $row['email'];
   echo $row['username;quote;madashat_users";
$dbuser = "madashat_eric";
$dbpass = "********";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = ("SELECT * FROM users WHERE username = '$username'"); 

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
   $message  = 'Invalid query: ' . mysql_error() . "\n";
   $message .= 'Whole query: ' . $query;
   die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
   echo $row['name'];
   echo $row['age'];
   echo $row['website'];
   echo $row['email'];
   echo $row['username'];
}

// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
?>
Sorry for being to vague. This is where the user get sent after they have logged in. Bas"Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = ("SELECT * FROM users WHERE username = '$username'&quote;);

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
$message .= 'Whole query: ' . $query;
die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $rowї'name'];
echo $rowї'age'];
echo $rowї'website'];
echo $rowї'email'];
echo $rowї'username'];
}

// Free the resources associated with the result set
// This is done automser = "madashat_eric";
$dbpass = "********";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = ("SELECT * FROM users WHERE username = '$username'&quote;);

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
$message .= 'Whole query: ' . $query;
die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $rowї'name'];
echo $rowї'age'];
echo $rowї'website'];
echo $rowї'email'];
echo $ote;localhost";
$dbname = "madashat_users";
$dbuser = "madashat_eric";
$dbpass = "********";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;);

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
$message .= 'Whole query: ' . $query;
die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $rowї'name'];
echo $rowї'age'];
echo $rowї'website'];
echo $rowї'email'];
echo $rowї'username'];
}

// Free the resources associated with the result set
// This is done automat<?php

$dbhost = "localhost";
$dbname = "madashat_users";
$dbuser = "madashat_eric";
$dbpass = "********";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;);

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
$message .= 'Whole query: ' . $query;
die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $rowї'name'];
echo $rowї'age'];
echo $rowї'website'];
echo $rowї'email'];
echo $rowї'username'];
}

// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_f<?php

$dbhost = "localhost";
$dbname = "madashat_users";
$dbuser = "madashat_eric";
$dbpass = "********";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;);

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
$message .= 'Whole query: ' . $query;
die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $rowї'name'];
echo $rowї'age'];
echo $rowї'website'];
echo $rowї'email'];
echo $rowї'username'];
}

// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
?&gt;

Sat_users";
$dbuser = "madashat_eric";
$dbpass = "********";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = ("SELECT * FROM users WHERE username = '$username'");

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $row['name'];
echo $row['age'];
echo $row['website'];
echo $row['email'];
echo $row['username'];
}

// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
?>

Sorry for being to vague. This is where the user get sent after they have logged in. Basicly what i am wanting is for ther = "madashat_eric";
$dbpass = &quote;********&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = ("SELECT * FROM users WHERE username = '$username'&quote;);

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
$message .= 'Whole query: ' . $query;
die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $rowї'name'];
echo $rowї'age'];
echo $rowї'website'];
echo $rowї'email'];

$dbhost = "localhost";
$dbname = "madashat_users";
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;********&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = ("SELECT * FROM users WHERE username = '$username'");

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $rowї'name'];
echo $rowї'age'];
echo $rowї'website'];
echo $rowї'email'];
echo $rowї'username'];
}

/;
mysql_select_db($dbname) or die(mysql_error());

$query = ("SELECT * FROM users WHERE username = '$username'");

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $row['name'];
echo $row['age'];
echo $row['website'];
echo $row['email'];
echo $row['username'];
}

// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
?>

Sorry for being to vague. This is where the user get sent after they have logged in. Basicly what i am wanting is for this page to show the user their details that are in the database. (am i still to vague??)

Ericcalhost";
$dbname = "madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;********&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;);

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
$message .= 'Whole query: ' . $query;
die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $rowї'name'];
echo $rowї'age'];
echo $rowї'website'];
echo $rowї'email'];
echo $rowї'username'];
}

// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
?&gt;

Sorry for being to vague. This is where the user get sent after they have logged in. Basicly what i am wanting is for this page to show the user their details that are in the database. (am i still to vague??)

Ericote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = ("SELECT * FROM users WHERE username = '$username'");

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $row['name'];
echo $row['age'];
echo $row['website'];
echo $row['email'];
echo $row['username'];
}

// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
?>

Sorry for being to vague. This is where the user get sent after they have logged in. Basicly what i am wanting is for this page to show the user their details that are in the database. (am i still to vague??)

Ericashat_eric";
$dbpass = "********";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;);

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
$message .= 'Whole query: ' . $query;
die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $rowї'name'];
echo $rowї'age'];
echo $rowї'website'];
echo $rowї'email'];
echo $rowї'username'];
}

// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
?&gt;

Sorry for being to vague. dbname = "madashat_users";
$dbuser = "madashat_eric&quote;;
$dbpass = &quote;********&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;);

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
$message .= 'Whole query: ' . $query;
die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $rowї'name'];
echo $rowї'age'];
echo $rowї'website'];
echo $rowї'email'];
echo $rowї'username'];
}

// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
?&gt;

Sorry for being to vague. This is where the user get sent after they have logge<?php

$dbhost = "localhost";
$dbname = "madashat_users";
$dbuser = "madashat_eric";
$dbpass = "********";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = ("SELECT * FROM users WHERE username = '$username'");

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $row['name'];
echo $row['age'];
echo $row['website'];
echo $row['email'];
echo $row['username'];
}

// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
?>

Sorry for being to vague. This is where the user get sent after they have logged in. Basicly what i am wanting is for this page to show the user their details that are in the database. (am i still to vague??)

Eric
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Show us the login script, or where do you save the username?

Code: Select all

ini_set('error_reporting', E_ALL);
ini_set('display_errors', TRUE);
Normally PHP will issue a warning that $username is not initialised...ror_reporting', E_ALL);
ini_set('display_errors', TRUE);


Normally PHP will issue a warning that $username is not initialised...ay_errors', TRUE);


Normally PHP will issue a warning that $username is not initialised...name?

Code: Select all

ini_set('error_reporting', E_ALL);
ini_set('display_errors', TRUE);
Normally PHP will issue a warning that $username is not initialised...script, or where do you save the username?

Code: Select all

ini_set('error_reporting', E_ALL);
ini_set('display_errors', TRUE);
Normally PHP will issue a warning that $username is not initialised...script, or where do you save the username?

Code: Select all

ini_set('error_reporting', E_ALL);
ini_set('display_errors', TRUE);
Normally PHP will issue a warning that $username is not initialised...', E_ALL);
ini_set('display_errors', TRUE);


Normally PHP will issue a warning that $username is not initialised...y_errors', TRUE);


Normally PHP will issue a warning that $username is not initialised...o you save the username?

Code: Select all

ini_set('error_reporting', E_ALL);
ini_set('display_errors', TRUE);
Normally PHP will issue a warning that $username is not initialised...

Code: Select all

ini_set('error_reporting', E_ALL);
ini_set('display_errors', TRUE);
Normally PHP will issue a warning that $username is not initialised...

Normally PHP will issue a warning that $username is not initialised...
ini_set('error_reporting', E_ALL);
ini_set('display_errors', TRUE);


Normally PHP will issue a warning that $username is not initialised...
User avatar
ericburnard
Forum Contributor
Posts: 104
Joined: Wed Jun 15, 2005 5:11 pm
Location: Chesterfield, UK

Post by ericburnard »

This is where they login which works fine.

login.html

Code: Select all

&lt;form name="login" method="post" action="login.php">
<table border="0" width="225" align="center">
   <tr>
       <td width="219" bgcolor="#999999">
           &lt;p align=&quote;center&quote;&gt;&lt;font color=&quote;white&quote;&gt;&lt;span style=&quote;font-size:12pt;&quote;&gt;&lt;b&gt;Login&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote;&gt;
           &lt;table border=&quote;0&quote; width=&quote;220&quote; align=&quote;center&quote;&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Username:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;text&quote; name=&quote;username&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Password:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;password&quote; name=&quote;password&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&amp;nbsp;&lt;/td&gt;
                       &lt;td width=&quote;139&quote;&gt;
                           &lt;p align=&quote;right&quote;&gt;&lt;input type=&quote;submit&quote; name=&quote;submit&quote; value=&quote;Submit&quote;&gt;&lt;/p&gt;
                       &lt;/td&gt;
               &lt;/tr&gt;
           &lt;/table&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote; bgcolor=&quote;#999999&quote;&gt;&lt;font color=&quote;white&quote;&gt;Not Registered? &lt;/font&gt;&lt;a href=&quote;register.html&quote; target=&quote;_self&quote;&gt;&lt;font color=&quote;white&quote;&gt;Register&lt;/font&gt;&lt;/a&gt;&lt;font color=&quote;white&quote;&gt; &lt;/font&gt;&lt;b&gt;&lt;i&gt;&lt;font color=&quote;white&quote;&gt;Now!&lt;/font&gt;&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;
   &lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
login.php

Code: Select all

<?php

$dbhost = "localhost";
$dbname = "madashat_users";
$dbuser = "madashat_eric";
$dbpass = "gateway2";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

session_start();
$username = $_POST['username'];
$password = $_POST['password'];

$query = "select * from users where username='$username' and password='$password'";

$result = mysql_query($query);

if (mysql_num_rows($result) != 1) {
$error = "Bad Login";
include "login.html";

} else {
$_SESSION[‘username’] = $username;
include ('http://eric.madashatters.com/memberspage.php?');
}

?>
memberspage.php

Code: Select all

&lt;?php

$dbhost = &quote;localhost&quote;;
$dbname = &quote;madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;gateway2&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;); 

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
   $message  = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
   $message .= 'Whole query: ' . $query;
   die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysqm name="login" method="post" action="login.php">
<table border=&quote;0&quote; width=&quote;225&quote; align=&quote;center">
   <tr>
       <td width="219&quote; bgcolor=&quote;#999999&quote;&gt;
           &lt;p align=&quote;center&quote;&gt;&lt;font color=&quote;white&quote;&gt;&lt;span style=&quote;font-size:12pt;&quote;&gt;&lt;b&gt;Login&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote;&gt;
           &lt;table border=&quote;0&quote; width=&quote;220&quote; align=&quote;center&quote;&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Username:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;text&quote; name=&quote;username&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Password:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;password&quote; name=&quote;password&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&amp;nbsp;&lt;/td&gt;
                       &lt;td width=&quote;139&quote;&gt;
                           &lt;p align=&quote;right&quote;&gt;&lt;input type=&quote;submit&quote; name=&quote;submit&quote; value=&quote;Submit&quote;&gt;&lt;/p&gt;
                       &lt;/td&gt;
               &lt;/tr&gt;
           &lt;/table&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote; bgcolor=&quote;#999999&quote;&gt;&lt;font color=&quote;white&quote;&gt;Not Registered? &lt;/font&gt;&lt;a href=&quote;register.html&quote; target=&quote;_self&quote;&gt;&lt;font color=&quote;white&quote;&gt;Register&lt;/font&gt;&lt;/a&gt;&lt;font color=&quote;white&quote;&gt; &lt;/font&gt;&lt;b&gt;&lt;i&gt;&lt;font color=&quote;white&quote;&gt;Now!&lt;/font&gt;&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;
   &lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
login.php

Code: Select all

&lt;?php

$dbhost = &quote;localhost&quote;;
$dbname = &quote;madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;gateway2&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

session_start();
$username = $_POST&#1111;'username'];
$password = $_POST&#1111;'password'];

$query = &quote;select * from users where username='$username' and password='$password'&quote;;

$result = mysql_query($query);

if (mysql_num_rows($result) != 1) {
$error = &quote;Bad Login&quote;;
include &quote;login.html&quote;;

} else {
$_SESSION&#1111;‘username’] = $username;
include ('http://eric.madashatters.com/memberspage.php?');
}

?&gt;
memberspage.php

Code: Select all

&lt;?php

$dbhost = &quote;localhost&quote;;
$dbname = &quote;madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;gateway2&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;); 

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
   $message  = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
   $message .= 'Whole query: ' . $query;
   die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
   echo $row&#1111;'firstname'];
   echo $row&#1111;'lastname'];
   echo $row&#1111;'address'];
   echo $row&#1111;'age'];
}

// Free the resources associated with the result set
// This is done automatically at the end of the script
mysqlalign="center">
   <tr>
       <td width="219" bgcolor="#999999&quote;&gt;
           &lt;p align=&quote;center&quote;&gt;&lt;font color=&quote;white&quote;&gt;&lt;span style=&quote;font-size:12pt;&quote;&gt;&lt;b&gt;Login&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote;&gt;
           &lt;table border=&quote;0&quote; width=&quote;220&quote; align=&quote;center&quote;&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Username:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;text&quote; name=&quote;username&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Password:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;password&quote; name=&quote;password&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&amp;nbsp;&lt;/td&gt;
                       &lt;td width=&quote;139&quote;&gt;
                           &lt;p align=&quote;right&quote;&gt;&lt;input type=&quote;submit&quote; name=&quote;submit&quote; value=&quote;Submit&quote;&gt;&lt;/p&gt;
                       &lt;/td&gt;
               &lt;/tr&gt;
           &lt;/table&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote; bgcolor=&quote;#999999&quote;&gt;&lt;font color=&quote;white&quote;&gt;Not Registered? &lt;/font&gt;&lt;a href=&quote;register.html&quote; target=&quote;_self&quote;&gt;&lt;font color=&quote;white&quote;&gt;Register&lt;/font&gt;&lt;/a&gt;&lt;font color=&quote;white&quote;&gt; &lt;/font&gt;&lt;b&gt;&lt;i&gt;&lt;font color=&quote;white&quote;&gt;Now!&lt;/font&gt;&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;
   &lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
login.php

Code: Select all

&lt;?php

$dbhost = &quote;localhost&quote;;
$dbname = &quote;madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;gateway2&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

session_start();
$username = $_POST&#1111;'username'];
$password = $_POST&#1111;'password'];

$query = &quote;select * from users where username='$username' and password='$password'&quote;;

$result = mysql_query($query);

if (mysql_num_rows($result) != 1) {
$error = &quote;Bad Login&quote;;
include &quote;login.html&quote;;

} else {
$_SESSION&#1111;‘username’] = $username;
include ('http://eric.madashatters.com/memberspage.php?');
}

?&gt;
memberspage.php

Code: Select all

&lt;?php

$dbhost = &quote;localhost&quote;;
$dbname = &quote;madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;gateway2&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;); 

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
   $message  = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
   $message .= 'Whole query: ' . $query;
   die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
   echo $row&#1111;'firstname'];
   echo $row&#1111;'lastod="post" action="login.php">
<table border="0" width="225&quote; align=&quote;center&quote;&gt;
   &lt;tr&gt;
       <td width="219" bgcolor="#999999"&gt;
           &lt;p align=&quote;center&quote;&gt;&lt;font color=&quote;white&quote;&gt;&lt;span style=&quote;font-size:12pt;&quote;&gt;&lt;b&gt;Login&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote;&gt;
           &lt;table border=&quote;0&quote; width=&quote;220&quote; align=&quote;center&quote;&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Username:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;text&quote; name=&quote;username&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Password:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;password&quote; name=&quote;password&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&amp;nbsp;&lt;/td&gt;
                       &lt;td width=&quote;139&quote;&gt;
                           &lt;p align=&quote;right&quote;&gt;&lt;input type=&quote;submit&quote; name=&quote;submit&quote; value=&quote;Submit&quote;&gt;&lt;/p&gt;
                       &lt;/td&gt;
               &lt;/tr&gt;
           &lt;/table&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote; bgcolor=&quote;#999999&quote;&gt;&lt;font color=&quote;white&quote;&gt;Not Registered? &lt;/font&gt;&lt;a href=&quote;register.html&quote; target=&quote;_self&quote;&gt;&lt;font color=&quote;white&quote;&gt;Register&lt;/font&gt;&lt;/a&gt;&lt;font color=&quote;white&quote;&gt; &lt;/font&gt;&lt;b&gt;&lt;i&gt;&lt;font color=&quote;white&quote;&gt;Now!&lt;/font&gt;&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;
   &lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
login.php

Code: Select all

&lt;?php

$dbhost = &quote;localhost&quote;;
$dbname = &quote;madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;gateway2&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

session_start();
$username = $_POST&#1111;'username'];
$password = $_POST&#1111;'password'];

$query = &quote;select * from users where username='$username' and password='$password'&quote;;

$result = mysql_query($query);

if (mysql_num_rows($result) != 1) {
$error = &quote;Bad Login&quote;;
include &quote;login.html&quote;;

} else {
$_SESSION&#1111;‘username’] = $username;
include ('http://eric.madashatters.com/memberspage.php?');
}

?&gt;
memberspage.php

Code: Select all

&lt;?php

$dbhost = &quote;localhost&quote;;
$dbname = &quote;madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;gateway2&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;); 

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
   $message  = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
   $message .= 'Whole query: ' . $query;
   die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
l

Code: Select all

<form name="login" method="post" action="login.php">
<table border="0" width="225" align="center"&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote; bgcolor=&quote;#999999&quote;&gt;
           &lt;p align=&quote;center&quote;&gt;&lt;font color=&quote;white&quote;&gt;&lt;span style=&quote;font-size:12pt;&quote;&gt;&lt;b&gt;Login&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote;&gt;
           &lt;table border=&quote;0&quote; width=&quote;220&quote; align=&quote;center&quote;&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Username:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;text&quote; name=&quote;username&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Password:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;password&quote; name=&quote;password&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&amp;nbsp;&lt;/td&gt;
                       &lt;td width=&quote;139&quote;&gt;
                           &lt;p align=&quote;right&quote;&gt;&lt;input type=&quote;submit&quote; name=&quote;submit&quote; value=&quote;Submit&quote;&gt;&lt;/p&gt;
                       &lt;/td&gt;
               &lt;/tr&gt;
           &lt;/table&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote; bgcolor=&quote;#999999&quote;&gt;&lt;font color=&quote;white&quote;&gt;Not Registered? &lt;/font&gt;&lt;a href=&quote;register.html&quote; target=&quote;_self&quote;&gt;&lt;font color=&quote;white&quote;&gt;Register&lt;/font&gt;&lt;/a&gt;&lt;font color=&quote;white&quote;&gt; &lt;/font&gt;&lt;b&gt;&lt;i&gt;&lt;font color=&quote;white&quote;&gt;Now!&lt;/font&gt;&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;
   &lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
login.php

Code: Select all

&lt;?php

$dbhost = &quote;localhost&quote;;
$dbname = &quote;madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;gateway2&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

session_start();
$username = $_POST&#1111;'username'];
$password = $_POST&#1111;'password'];

$query = &quote;select * from users where username='$username' and password='$password'&quote;;

$result = mysql_query($query);

if (mysql_num_rows($result) != 1) {
$error = &quote;Bad Login&quote;;
include &quote;login.html&quote;;

} else {
$_SESSION&#1111;‘username’] = $username;
include ('http://eric.madashatters.com/memberspage.php?');
}

?&gt;
memberspage.php

Code: Select all

&lt;?php

$dbhost = &quote;localhost&quote;;
$dbname = &quote;madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;gateway2&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;); 

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
   $message  = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
   $message .= 'Whole query: ' . $query;
   die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
   echo $row&#1111;'firstname'];
   echo $row&#1111;'lastna login which works fine.

login.html

Code: Select all

<form name="login" method="post" action="login.php">
<table border="0" width="225&quote; align=&quote;center&quote;&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote; bgcolor=&quote;#999999&quote;&gt;
           &lt;p align=&quote;center&quote;&gt;&lt;font color=&quote;white&quote;&gt;&lt;span style=&quote;font-size:12pt;&quote;&gt;&lt;b&gt;Login&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote;&gt;
           &lt;table border=&quote;0&quote; width=&quote;220&quote; align=&quote;center&quote;&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Username:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;text&quote; name=&quote;username&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Password:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;password&quote; name=&quote;password&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&amp;nbsp;&lt;/td&gt;
                       &lt;td width=&quote;139&quote;&gt;
                           &lt;p align=&quote;right&quote;&gt;&lt;input type=&quote;submit&quote; name=&quote;submit&quote; value=&quote;Submit&quote;&gt;&lt;/p&gt;
                       &lt;/td&gt;
               &lt;/tr&gt;
           &lt;/table&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote; bgcolor=&quote;#999999&quote;&gt;&lt;font color=&quote;white&quote;&gt;Not Registered? &lt;/font&gt;&lt;a href=&quote;register.html&quote; target=&quote;_self&quote;&gt;&lt;font color=&quote;white&quote;&gt;Register&lt;/font&gt;&lt;/a&gt;&lt;font color=&quote;white&quote;&gt; &lt;/font&gt;&lt;b&gt;&lt;i&gt;&lt;font color=&quote;white&quote;&gt;Now!&lt;/font&gt;&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;
   &lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
login.php

Code: Select all

&lt;?php

$dbhost = &quote;localhost&quote;;
$dbname = &quote;madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;gateway2&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

session_start();
$username = $_POST&#1111;'username'];
$password = $_POST&#1111;'password'];

$query = &quote;select * from users where username='$username' and password='$password'&quote;;

$result = mysql_query($query);

if (mysql_num_rows($result) != 1) {
$error = &quote;Bad Login&quote;;
include &quote;login.html&quote;;

} else {
$_SESSION&#1111;‘username’] = $username;
include ('http://eric.madashatters.com/memberspage.php?');
}

?&gt;
memberspage.php

Code: Select all

&lt;?php

$dbhost = &quote;localhost&quote;;
$dbname = &quote;madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;gateway2&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;); 

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
   $message  = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
   $message .= 'Whole query: ' . $query;
   die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
   echo $row&#1111;'firstname'];
   echo $row&#1111;'lastname'];
   echo $row&#1111;'address'];
  login which works fine.

login.html

Code: Select all

<form name="login" method="post" action="login.php">
<table border="0" width="225" align="center&quote;&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote; bgcolor=&quote;#999999&quote;&gt;
           &lt;p align=&quote;center&quote;&gt;&lt;font color=&quote;white&quote;&gt;&lt;span style=&quote;font-size:12pt;&quote;&gt;&lt;b&gt;Login&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote;&gt;
           &lt;table border=&quote;0&quote; width=&quote;220&quote; align=&quote;center&quote;&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Username:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;text&quote; name=&quote;username&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Password:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;password&quote; name=&quote;password&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&amp;nbsp;&lt;/td&gt;
                       &lt;td width=&quote;139&quote;&gt;
                           &lt;p align=&quote;right&quote;&gt;&lt;input type=&quote;submit&quote; name=&quote;submit&quote; value=&quote;Submit&quote;&gt;&lt;/p&gt;
                       &lt;/td&gt;
               &lt;/tr&gt;
           &lt;/table&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote; bgcolor=&quote;#999999&quote;&gt;&lt;font color=&quote;white&quote;&gt;Not Registered? &lt;/font&gt;&lt;a href=&quote;register.html&quote; target=&quote;_self&quote;&gt;&lt;font color=&quote;white&quote;&gt;Register&lt;/font&gt;&lt;/a&gt;&lt;font color=&quote;white&quote;&gt; &lt;/font&gt;&lt;b&gt;&lt;i&gt;&lt;font color=&quote;white&quote;&gt;Now!&lt;/font&gt;&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;
   &lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
login.php

Code: Select all

&lt;?php

$dbhost = &quote;localhost&quote;;
$dbname = &quote;madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;gateway2&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

session_start();
$username = $_POST&#1111;'username'];
$password = $_POST&#1111;'password'];

$query = &quote;select * from users where username='$username' and password='$password'&quote;;

$result = mysql_query($query);

if (mysql_num_rows($result) != 1) {
$error = &quote;Bad Login&quote;;
include &quote;login.html&quote;;

} else {
$_SESSION&#1111;‘username’] = $username;
include ('http://eric.madashatters.com/memberspage.php?');
}

?&gt;
memberspage.php

Code: Select all

&lt;?php

$dbhost = &quote;localhost&quote;;
$dbname = &quote;madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;gateway2&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;); 

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
   $message  = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
   $message .= 'Whole query: ' . $query;
   die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
   echo $row&#1111;'firstname'];
   echo $row&#1111;'lastname'];
   echo $row&#1111;'address'];
   echo $row&#1111;'age'];
}

// Free the resources associuote;login" method="post" action="login.php">
<table border="0" width="225" align="center">
   <tr>
       <td width="219" bgcolor="#999999">
           <p align="center"><font color="white"><span style="font-size:12pt;"><b>Login</b></span></font></p>
       </td>
   </tr>
   <tr>
       <td width="219">
           <table border="0" width="220" align="center">
               <tr>
                   <td width="71"><span style="font-size:10pt;">Username:</span></td>
                   <td width="139"><input type="text&quote; name=&quote;username&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Password:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;password&quote; name=&quote;password&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&amp;nbsp;&lt;/td&gt;
                       &lt;td width=&quote;139&quote;&gt;
                           &lt;p align=&quote;right&quote;&gt;&lt;input type=&quote;submit&quote; name=&quote;submit&quote; value=&quote;Submit&quote;&gt;&lt;/p&gt;
                       &lt;/td&gt;
               &lt;/tr&gt;
           &lt;/table&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote; bgcolor=&quote;#999999&quote;&gt;&lt;font color=&quote;white&quote;&gt;Not Registered? &lt;/font&gt;&lt;a href=&quote;register.html&quote; target=&quote;_self&quote;&gt;&lt;font color=&quote;white&quote;&gt;Register&lt;/font&gt;&lt;/a&gt;&lt;font color=&quote;white&quote;&gt; &lt;/font&gt;&lt;b&gt;&lt;i&gt;&lt;font color=&quote;white&quote;&gt;Now!&lt;/font&gt;&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;
   &lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
login.php

Code: Select all

&lt;?php

$dbhost = &quote;localhost&quote;;
$dbname = &quote;madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;gateway2&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

session_start();
$username = $_POST&#1111;'username'];
$password = $_POST&#1111;'password'];

$query = &quote;select * from users where username='$username' and password='$password'&quote;;

$result = mysql_query($query);

if (mysql_num_rows($result) != 1) {
$error = &quote;Bad Login&quote;;
include &quote;login.html&quote;;

} else {
$_SESSION&#1111;‘username’] = $username;
include ('http://eric.madashatters.com/memberspage.php?');
}

?&gt;
memberspage.php

Code: Select all

&lt;?php

$dbhost = &quoted="post" action="login.php&quote;&gt;
&lt;table border=&quote;0&quote; width="225" align="center">
   <tr>
       <td width="219" bgcolor="#999999&quote;&gt;
           &lt;p align=&quote;center&quote;&gt;&lt;font color=&quote;white&quote;&gt;&lt;span style=&quote;font-size:12pt;&quote;&gt;&lt;b&gt;Login&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote;&gt;
           &lt;table border=&quote;0&quote; width=&quote;220&quote; align=&quote;center&quote;&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Username:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;text&quote; name=&quote;username&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Password:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;password&quote; name=&quote;password&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&amp;nbsp;&lt;/td&gt;
                       &lt;td width=&quote;139&quote;&gt;
                           &lt;p align=&quote;right&quote;&gt;&lt;input type=&quote;submit&quote; name=&quote;submit&quote; value=&quote;Submit&quote;&gt;&lt;/p&gt;
                       &lt;/td&gt;
               &lt;/tr&gt;
           &lt;/table&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote; bgcolor=&quote;#999999&quote;&gt;&lt;font color=&quote;white&quote;&gt;Not Registered? &lt;/font&gt;&lt;a href=&quote;register.html&quote; target=&quote;_self&quote;&gt;&lt;font color=&quote;white&quote;&gt;Register&lt;/font&gt;&lt;/a&gt;&lt;font color=&quote;white&quote;&gt; &lt;/font&gt;&lt;b&gt;&lt;i&gt;&lt;font color=&quote;white&quote;&gt;Now!&lt;/font&gt;&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;
   &lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
login.php

Code: Select all

&lt;?php

$dbhost = &quote;localhost&quote;;
$dbname = &quote;madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;gateway2&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

session_start();
$username = $_POST&#1111;'username'];
$password = $_POST&#1111;'password'];

$query = &quote;select * from users where username='$username' and password='$password'&quote;;

$result = mysql_query($query);

if (mysql_num_rows($result) != 1) {
$error = &quote;Bad Login&quote;;
include &quote;login.html&quote;;

} else {
$_SESSION&#1111;‘username’] = $username;
include ('http://eric.madashatters.com/memberspage.php?');
}

?&gt;
memberspage.php

Code: Select all

&lt;?php

$dbhost = &quote;localhost&quote;;
$dbname = &quote;madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;gateway2&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;); 

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
   $message  = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
   $message .= 'Whole query: ' . $query;
   die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row() fine.

login.html

Code: Select all

<form name="login" method=&quote;post&quote; action=&quote;login.php&quote;&gt;
<table border="0" width="225" align="center">
   &lt;tr&gt;
       &lt;td width=&quote;219" bgcolor="#999999">
           <p align=&quote;center&quote;&gt;&lt;font color="white"><span style="font-size:12pt;"><b>Login</b>&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote;&gt;
           &lt;table border=&quote;0&quote; width=&quote;220&quote; align=&quote;center&quote;&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Username:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;text&quote; name=&quote;username&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Password:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;password&quote; name=&quote;password&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&amp;nbsp;&lt;/td&gt;
                       &lt;td width=&quote;139&quote;&gt;
                           &lt;p align=&quote;right&quote;&gt;&lt;input type=&quote;submit&quote; name=&quote;submit&quote; value=&quote;Submit&quote;&gt;&lt;/p&gt;
                       &lt;/td&gt;
               &lt;/tr&gt;
           &lt;/table&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote; bgcolor=&quote;#999999&quote;&gt;&lt;font color=&quote;white&quote;&gt;Not Registered? &lt;/font&gt;&lt;a href=&quote;register.html&quote; target=&quote;_self&quote;&gt;&lt;font color=&quote;white&quote;&gt;Register&lt;/font&gt;&lt;/a&gt;&lt;font color=&quote;white&quote;&gt; &lt;/font&gt;&lt;b&gt;&lt;i&gt;&lt;font color=&quote;white&quote;&gt;Now!&lt;/font&gt;&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;
   &lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
login.php

Code: Select all

&lt;?php

$dbhost = &quote;localhost&quote;;
$dbname = &quote;madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;gateway2&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

session_start();
$username = $_POST&#1111;'username'];
$password = $_POST&#1111;'password'];

$query = &quote;select * from users where username='$username' and password='$password'&quote;;

$result = mysql_query($query);

if (mysql_num_rows($result) != 1) {
$error = &quote;Bad Login&quote;;
include &quote;login.html&quote;;

} else {
$_SESSION&#1111;‘username’] = $username;
include ('http://eric.madashatters.com/memberspage.php?');
}

?&gt;
memberspage.php

Code: Select all

&lt;?php

$dbhost = &quote;localhost&quote;;
$dbname = &quote;madashat_users&quote;;
$dbuser = &quote;madashat_eric&quote;;
$dbpass = &quote;gateway2&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;); 

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
   $message  = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
   $message .= 'Whole query: ' . $query;
   die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assamp;lt;tr>
       <td width="219" bgcolor="#999999">
           <p align="center"><font color="white"><span style="font-size:12pt;"><b>Login</b></span></font></p>
       </td>
   </tr>
   <tr>
       <td width="219">
           <table border="0" width="220" align="center">
               <tr>
                   <td width="71"><span style="font-size:10pt;">Username:</span></td>
                   <td width="139"><input type=&quote;text&quote; name=&quote;username&quote;&gt;</td>
               </tr>
               <tr>
                   <td width="71"><span style="font-size:10pt;">Password:</span></td>
                   <td width="139"><input type="password" name="password"></td>
               </tr>
               <tr>
                   <td width="71">&nbsp;</td>
                       <td width="139">
                           <p align="right"><input type="submit" name="submit" value=&quote;Submit&quote;&gt;&lt;/p&gt;
                       &lt;/td&gt;
               &lt;/tr&gt;
           &lt;/table&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote; bgcolor=&quote;#999999&quote;&gt;&lt;font color=&quote;white&quote;&gt;Not Registered? &lt;/font&gt;&lt;a href=&quote;register.html&quote; target=&quote;_self&quote;&gt;&lt;font color=&quote;white&quote;&gt;Register&lt;/font&gt;&lt;/a&gt;&lt;font color=&quote;white&quote;&gt; &lt;/font&gt;&lt;b&gt;&lt;i&gt;&lt;font color=&quote;white&quote;&gt;Now!&lt;/font&gt;&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;
code]
<form name="login&quote; method=&quote;post&quote; action=&quote;login.php&quote;&gt;
&lt;table border=&quote;0&quote; width=&quote;225&quote; align=&quote;center&quote;&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote; bgcolor=&quote;#999999&quote;&gt;
           &lt;p align=&quote;center&quote;&gt;&lt;font color=&quote;white&quote;&gt;&lt;span style=&quote;font-size:12pt;&quote;&gt;&lt;b&gt;Login&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote;&gt;
           &lt;table border=&quote;0&quote; width=&quote;220&quote; align=&quote;center&quote;&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Username:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;text&quote; name=&quote;username&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&lt;span style=&quote;font-size:10pt;&quote;&gt;Password:&lt;/span&gt;&lt;/td&gt;
                   &lt;td width=&quote;139&quote;&gt;&lt;input type=&quote;password&quote; name=&quote;password&quote;&gt;&lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                   &lt;td width=&quote;71&quote;&gt;&amp;nbsp;&lt;/td&gt;
                       &lt;td width=&quote;139&quote;&gt;
                           &lt;p align=&quote;right&quote;&gt;&lt;input type=&quote;submit&quote; name=&quote;submit&quote; value=&quote;Submit&quote;&gt;&lt;/p&gt;
                       &lt;/td&gt;
               &lt;/tr&gt;
           &lt;/table&gt;
       &lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
       &lt;td width=&quote;219&quote; bgcolor=&quote;#999999&quote;&gt;&lt;font color=&quote;white&quote;&gt;Not Registered? &lt;/font&gt;&lt;a href=&quote;register.html&quote; target=&quote;_self&quote;&gt;&lt;font color=&quote;white&quote;&gt;Register&lt;/font&gt;&lt;/a&gt;&lt;font color=&quote;white&quote;&gt; &lt;/font&gt;&lt;b&gt;&lt;i&gt;&lt;font color=&quote;white&quote;&gt;Now!&lt;/font&gt;&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;
   &lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
login.php

Code: Select all

<?php

$dbhost = "localhost";
$dbname = "madashat_users";
$dbuser = "madashat_eric";
$dbpass = "gateway2";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

session_start();
$username = $_POST['username'];
$password = $_POST['password'];

$query = "select * from users where username='$username' and password='$password'";

$result = mysql_query($query);

if (mysql_num_rows($result) != 1) {
$error = "Bad Login";
include "login.html";

} else {
$_SESSION[‘username’] = $username;
include ('http://eric.madashatters.com/memberspage.php?');
}

?>
memberspage.php

Code: Select all

<?php

$dbhost = "localhost";
$dbname = "madashat_users";
$dbuser = "madashat_eric";
$dbpass = "gateway2";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$query = ("SELECT * FROM users WHERE username = '$username'"); 

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
   $message  = 'Invalid query: ' . mysql_error() . "\n";
   $message .= 'Whole query: ' . $query;
   die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
   echo $row['firstname'];
   echo $row['lastname'];
   echo $row['address'];
   echo $row['age'];
}

// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
?>
I am wanting their details displayed on the memberspage.php

Eric
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Code: Select all

$_SESSION[‘username’] = $username;
include ('http://eric.madashatters.com/memberspage.php?');
Should be

Code: Select all

if (!isset($_SESSION)) session_start();
$_SESSION['username'] = $username;
include ('http://eric.madashatters.com/memberspage.php?');

Code: Select all

$query = ("SELECT * FROM users WHERE username = '$username'")/eric.madashatters.com/memberspage.php?');
Should be

Code: Select all

if (!isset($_SESSION)) session_start();
$_SESSION['username'] = $username;
include ('http://eric.madashatters.com/memberspage.php?');

Code: Select all

$query = ("SELECT * FROM users WHERE username = '$username'");
Should be

Code: Select all

if (!isset($_SESSION)) session_start();
$username = $_SESSclude ('http://eric.madashatters.com/memberspage.php?');

Code: Select all

$query = ("SELECT * FROM ');
Should be

Code: Select all

if (!isset($_SESSION)) session_start();
$_SESSION['username'] = $username;
include ('http://eric.madashatters.com/memberspage.php?');

Code: Select all

$query = ("SELECT * FROM users WHERE username = 'username’] = $username;
include ('http://eric.madashatters.com/memberspage.php?');
Should be

Code: Select all

if (!isset($_SESSION)) session_start();
$_SESSION['username'] = $username;
include ('http://eric.madashatters.com/memberspage.php?');

Code: Select all

$query = (&quote;SELECT * FR

Code: Select all

$_SESSION[‘username’] = $username;
include ('http://eric.madashatters.com/memberspage.php?');
Should be

Code: Select all

if (!isset($_SESSION)) session_start();
$_SESSION['username'] = $username;
include ('http://eric.madashatters.com/memberspage.php?');

Code: Select all

$query = (&quote;SELECT * FROM users WHERE username = '$username'&am

Code: Select all

$_SESSION[‘username’] = $username;
include ('http://eric.madashatters.com/memberspage.php?');
Should be

Code: Select all

if (!isset($_SESSION)) session_start();
$_SESSION['username'] = $username;
include ('http://eric.madashatters.com/memberspage.php?');

Code: Select all

$query = ("SELECT * FROM users WHERE username = '$username'");
Shoultters.com/memberspage.php?');
[/quote]

Should be

Code: Select all

if (!isset($_SESSION)) session_start();
$_SESSION['username'] = $username;
include ('http://eric.madashatters.com/memberspage.php?');

Code: Select all

$query = ("SELECT * FROM users WHERE username = '$username'");
Should be

Code: Select all

if (!isset($_SESSION)) session_start();
$username = $_SESSION['username'];
$query = ("SELECT * FROM users WHERE username = '$username'");
);
[/quote]

Should be

Code: Select all

if (!isset($_SESSION)) session_start();
$_SESSION['username'] = $username;
include ('http://eric.madashatters.com/memberspage.php?');

Code: Select all

$query = ("SELECT * FROM users WHERE 
$_SESSION[‘username’] = $username;
include ('http://eric.madashatters.com/memberspage.php?');
Should be

Code: Select all

if (!isset($_SESSION)) session_start();
$_SESSION['username'] = $username;
include ('http://eric.madashatters.com/memberspage.php?');

Code: Select all

$query = ("SELECT * FROM users WHERE username = '$username'");
Should be

Code: Select all

if (!isset($_SESSION)) session_start();
$username = $_SESSION['username'];
$query = ("SELECT * FROM users WHERE username = '$username'");
User avatar
ericburnard
Forum Contributor
Posts: 104
Joined: Wed Jun 15, 2005 5:11 pm
Location: Chesterfield, UK

Post by ericburnard »

I am still getting nothing shown on my memberspage.php

the code i have for it now is

Code: Select all

<?php

$dbhost = "localhost";
$dbname = "madashat_users";
$dbuser = "madashat_eric";
$dbpass = "********";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

if (!isset($_SESSION)) session_start();$username = $_SESSION['username'];
$query = ("SELECT * FROM users WHERE username = '$username'"); 

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
   $message  = 'Invalid query: ' . mysql_error() . "\n";
   $message .= 'Whole query: ' . $query;
   die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
   echo $row['name'];
   echo $row['age'];
   echo $row['email'];1]
<?php

$dbhost = "localhost";
$dbname = "madashat_users";
$dbuser = "madashat_eric";
$dbpass = "********";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

if (!isset($_SESSION)) session_start();$username = $_SESSION['username'];
$query = ("SELECT * FROM users WHERE username = '$username'"); 

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
   $message  = 'Invalid query: ' . mysql_error() . "\n";
   $message .= 'Whole query: ' . $query;
   die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
   echo $row['name'];
   echo $row['age'];
   echo $row['email'];
   echo $row['website'];
}

// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
?>
Eric

d11wtq | I've just edited y***";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

if (!isset($_SESSION)) session_start();$username = $_SESSIONї'username'];
$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;);

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
$message .= 'Whole query: ' . $query;
die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $rowї'name'];
echo $rowї'age'];
echo $rowї'email'];
echo $rowї'website'];
}

// Free the resources associated with the resuost = "localhost";
$dbname = "madashat_users";
$dbuser = "madashat_eric";
$dbpass = "********&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

if (!isset($_SESSION)) session_start();$username = $_SESSIONї'username'];
$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;);

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
$message .= 'Whole query: ' . $query;
die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $rowї'name'];
echo $rowї'age'];
echo $

the code i have for it now is

Code: Select all

<?php

$dbhost = "localhost";
$dbname = "madashat_users";
$dbuser = "madashat_eric";
$dbpass = "********";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

if (!isset($_SESSION)) session_start();$username = $_SESSION&#1111;'username'];
$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;); 

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
   $message  = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
   $message .= 'Whole query: ' . $query;
   die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
   echo $row&#1111;'name'];
   echo $row&#1111;'age'];
   echo $row&#1111;'email'];
   echo $row&#1111;'website'];
}

// Free the resources associated with the result nothing shown on my memberspage.php

the code i have for it now is

Code: Select all

<?php

$dbhost = "localhost";
$dbname = "madashat_users";
$dbuser = "madashat_eric";
$dbpass = "********&quote;;

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die(&quote;Could not connect: &quote;.mysql_error());
mysql_select_db($dbname) or die(mysql_error());

if (!isset($_SESSION)) session_start();$username = $_SESSION&#1111;'username'];
$query = (&quote;SELECT * FROM users WHERE username = '$username'&quote;); 

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
   $message  = 'Invalid query: ' . mysql_error() . &quote;\n&quote;;
   $message .= 'Whole query: ' . $query;
   die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
   echo $row&#1111;'name'];
   echo $row&#1111;'age'];
   echo $row&#1111;'email'];
   echo $row&#1111;'website'];
}

// Free the resources associated with the result set
// This is done automatically at t nothing shown on my memberspage.php

the code i have for it now is

Code: Select all

<?php

$dbhost = "localhost";
$dbname = "madashat_users";
$dbuser = "madashat_eric";
$dbpass = "********";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

if (!isset($_SESSION)) session_start();$username = $_SESSION['username'];
$query = ("SELECT * FROM users WHERE username = '$username'"); 

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
   $message  = 'Invalid query: ' . mysql_error() . "\n";
   $message .= 'Whole query: ' . $query;
   die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
   echo $row['name'];
   echo $row['age'];
   echo $row['email'];
   echo $row['website'];
}

// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
?&amp
<?php

$dbhost = "localhost";
$dbname = "madashat_users";
$dbuser = "madashat_eric";
$dbpass = "********";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

if (!isset($_SESSION)) session_start();$username = $_SESSION['username'];
$query = ("SELECT * FROM users WHERE username = '$username'"); 

// Perform Query
$result = mysql_query($query);

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
   $message  = 'Invalid query: ' . mysql_error() . "\n";
   $message .= 'Whole query: ' . $query;
   die($message);
}

// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
   echo $row['name'];
   echo $row['age'];
   echo $row['email'];
   echo $row['website'];
}

// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
?>
Eric

d11wtq | I've just edited your last 3 posts. Please use

Code: Select all

tags [b]not[/b]

Code: Select all

tags when posting PHP code [/color]
User avatar
ericburnard
Forum Contributor
Posts: 104
Joined: Wed Jun 15, 2005 5:11 pm
Location: Chesterfield, UK

Post by ericburnard »

OMG thank you very much Burrito that is the simplist anyone has made it for me. It works now :D

and im sorry Jcart i totaly forgot i had posted this one :p sorry

thanks again

Eric
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

ericburnard wrote:OMG thank you very much Burrito that is the simplist anyone has made it for me. It works now :D

and im sorry Jcart i totaly forgot i had posted this one :p sorry

thanks again

Eric
huh? I didn't even post in here lol

EDIT: doh! just realized this thread was tied to the other one that was LOCKED...my bad, damn it, I knew those cookies were baked weird....
Post Reply