• (3 Pages)
  • +
  • 1
  • 2
  • 3

Text Based Mafia Game || Database with Connection Part 1. Setting up a database with simple Connection Rate Topic: ***** 3 Votes

#16 nyjatt  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 1
  • Joined: 16-April 11

Posted 16 April 2011 - 09:16 AM

Hi i have a little problem with the database well a question? what do i do with it like where do i add that code you gave? Do i make a database.php ? i am using 000webhost right now i looked around but i just dont get it. if yu can tell me where to put it and what to name it i would appreciate it. thanks in ahead
Was This Post Helpful? -1
  • +
  • -

#17 Denis1  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 32
  • View blog
  • Posts: 102
  • Joined: 29-July 09

Posted 22 May 2011 - 11:54 AM

View Postnyjatt, on 16 April 2011 - 05:16 PM, said:

Hi i have a little problem with the database well a question? what do i do with it like where do i add that code you gave? Do i make a database.php ? i am using 000webhost right now i looked around but i just dont get it. if yu can tell me where to put it and what to name it i would appreciate it. thanks in ahead


hi nyjatt,
The best answer i can give you is to learn php and starting making little php scripts, use the tutorials on this site to help you out. When you have finished all the basics this will make much sense. let me know how it all goes.
Was This Post Helpful? 0
  • +
  • -

#18 cornetto456  Icon User is offline

  • D.I.C Regular

Reputation: 21
  • View blog
  • Posts: 438
  • Joined: 03-January 11

Posted 15 June 2011 - 11:58 AM

View Postcreativecoding, on 24 October 2010 - 10:48 PM, said:

View PostThemitchel0, on 18 October 2010 - 04:46 PM, said:

is it possible to make a mysql database without using a server?, like can i make a local one? any help would be nice thank you!


Why did this get -rep?


Anyhow, I believe if you wanted to, you could set up a Virtual Machine (oracle has a good one) with some server software, you can add mysql to it and host your websites database. Although, your VM and computer would have to remain turned on...

Or even simpeler, WAMP :)
Was This Post Helpful? 0
  • +
  • -

#19 Shadowing  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 35
  • Joined: 26-November 11

Posted 26 November 2011 - 05:32 AM

Ive hit a wall its not working for me can you please help me out

my user database is all filled out. im using XAMPP
Created a folder called spacewars in the htdocs folder
This is the folder I placed connect.php and test.php in
On the connect.php script i wasnt sure what to put for connection and db? so I put mysq1_connect and mysql_database

My Database name is spacewars
server name is localhost
Username is shadowing

I type in http://localhost/spacewars/test
and I get a object not found error
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.



I really appreciate the help

Attached image(s)

  • Attached Image

Was This Post Helpful? 0
  • +
  • -

#20 Shadowing  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 35
  • Joined: 26-November 11

Posted 26 November 2011 - 09:35 PM

Im following another step by step tutor and there connection script works just fine but yours doesnt. Trying to figure and understand why.

<?php
mysql_connect("localhost", "shadowing", "eguitars8") or die(mysql_error());
echo "Connected to MySQL<br />";
?>

I named that script test.php and typed in localhost/test.php and it worked saying connect to mysql
but when I do yours and type localhost/connect/php I get a Object not found error "the request url was not found on this server.

This is what i have for your connection script. I understand there is no echo in this script but shouldnt it give me a white page at least saying nothing on it?

<?php
$mysql_server = "localhost"; // localhost is common on most hosts.

$mysql_user = "shadowing"; // this is the name of your username of the server.

$mysql_password = "eguitars8"; // the password connected to the username. MAKE IT COMPLEX.

$mysql_database = "spacewars"; // the database name of where to connect to and where the information will be help.

$connection = mysq1_connect("$mysql_server","$mysql_user","$mysql_password") or die ("Unable to establish a DB connection");

$db = mysql_database("$mysql_database") or die ("Unable to establish a DB connection");
?>
Was This Post Helpful? 0
  • +
  • -

#21 Shadowing  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 35
  • Joined: 26-November 11

Posted 27 November 2011 - 01:35 AM

Alright I solved my problem.
I was putting the connect and test php file in a folder with in the dir. I use xammp so i was putting it in the dir xampp/htdocs/spacewars which is the name of my project

Also the other reason it wasnt working was because mysql_connect had a 1 in it instead of a L
and i just noticed there is no differance from a 1 and a L on this site lol looks the same almost l1 crazy
Was This Post Helpful? 0
  • +
  • -

#22 Shadowing  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 35
  • Joined: 26-November 11

Posted 27 November 2011 - 03:04 AM

Oh great now i have another problem :(
I cant get the test page to do anything I get a HTTP 500 Internal Server Error and says Internet instead of intranet on the bottom of my broswer using IE8.

So for kicks I created a php file with only this line of code
<?php include_once("connect.php"); ?>
and saved it as aa.php
so i run http://localhost/aa.php in my browser and i get the same error.
Shouldnt I get a blank page that is all white? like as if I ran connect.php

so its like this code doesnt even work <?php include_once("connect.php"); ?>

I"m using XAMPP the test file and the connect file is in xampp/htdocs
Was This Post Helpful? 0
  • +
  • -

#23 Shadowing  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 35
  • Joined: 26-November 11

Posted 27 November 2011 - 04:13 AM

Alright I got everything working. I will state what happend incase anyone in the future does the same mistakes I did.

On the connect script I had $db = $mysql_database("$mysql_database") instead of having $db = mysql_select_db("$mysql_database")
I had errors shut off on my apache server so I didnt see the error. Which would of solved alot of my other problems seeing errors.

After I fixed that issue I was still getting a db error. Either using <?php instead of <? fixed that or adding a space between <html > and <?php include_once("connect.php"); ?> fixed it.

Either way i double checked and using <? or not putting a space between those two lines still makes everything work. For some reason it didnt at first but now it does. lol not sure why. now i can continue the rest of the tutor. Ya!
Was This Post Helpful? 0
  • +
  • -

#24 apx900  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 4
  • Joined: 18-February 12

Posted 18 February 2012 - 04:40 PM

View PostDenis1, on 09 September 2010 - 10:12 AM, said:

Ok this is a common error if you are using a localhost. Try using the full php tags. so instead of
<?  echo "Denis"; ?> 
you should use
<?php echo "Denis"; ?>
. Local-hosts like xampp confuse <? tage for xml and it all a big mess.



Thank you!! i spent 2 days trying to find the problem myself.
Was This Post Helpful? 0
  • +
  • -

#25 zukeru  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 152
  • Joined: 25-December 09

Posted 25 July 2012 - 07:36 PM

great post
Was This Post Helpful? 0
  • +
  • -

#26 fuzzx  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 25-September 12

Posted 25 September 2012 - 03:11 AM

Hi, I recently started programming and for starters this is the first reasonable tutorial how to learn anything Ive come by first and so far after stumbling into a lot of trouble. This is what Ive come by after 12 hours testing out this tutorial. Im having serious trouble setting up a database using wampserver (wampserver2.2e-php5.4.3-httpd2.2.22-mysql5.5.24-32b) to make it work adding users. If you want to help me on this part I would gladly take it. I studied java language and C++ about 3 years ago but just learned some basics before I smoked or drank away the past years but nothing like this really.

Im currently using xampp Apache and MySQL laters version, no longer wampserver. Dont know what Im going to do about that so far.

This is what I get using the crimson editor browser.

Posted Image

When Im opening the test file in localhost/myfiles/test.php

I get an error
Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\myfiles\test\test.php on line 98

When I remove the } nothing specials happens but it seems to gives some problem when I add money to non existing player so I guess it all looks like this because I have no real list.

Im going to try add a player with the phpmyadmin but not sure if it will work.

Just wanted to show my progress so far and might get some tip even if the thread is old.

Wish me luck :)
Was This Post Helpful? 0
  • +
  • -

#27 apx900  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 4
  • Joined: 18-February 12

Posted 25 September 2012 - 06:44 AM

View Postfuzzx, on 25 September 2012 - 03:11 AM, said:

Hi, I recently started programming and for starters this is the first reasonable tutorial how to learn anything Ive come by first and so far after stumbling into a lot of trouble. This is what Ive come by after 12 hours testing out this tutorial. Im having serious trouble setting up a database using wampserver (wampserver2.2e-php5.4.3-httpd2.2.22-mysql5.5.24-32b) to make it work adding users. If you want to help me on this part I would gladly take it. I studied java language and C++ about 3 years ago but just learned some basics before I smoked or drank away the past years but nothing like this really.

Im currently using xampp Apache and MySQL laters version, no longer wampserver. Dont know what Im going to do about that so far.

This is what I get using the crimson editor browser.

Posted Image

When Im opening the test file in localhost/myfiles/test.php

I get an error
Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\myfiles\test\test.php on line 98

When I remove the } nothing specials happens but it seems to gives some problem when I add money to non existing player so I guess it all looks like this because I have no real list.

Im going to try add a player with the phpmyadmin but not sure if it will work.

Just wanted to show my progress so far and might get some tip even if the thread is old.

Wish me luck :)


Hello would you mind posting the code you have on your test.php please. I'm no expert but it's seems like one of 3 things to me.
1. Missing bracket.
2. Extra bracket somewhere.
3. Bracket in the wrong location.

We should be able to help you more once we see the code.
Was This Post Helpful? 2
  • +
  • -

#28 fature  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 30-March 13

Posted 30 March 2013 - 04:31 PM

<?php include_once("connect.php"); ?>
<? require 'functions.php'; ?>
<? 
if (isset($_POST['Register'])) {


if(strlen($_POST['Username'])<3 || strlen($_POST['Username'])>32)
	{ // This check the characters of the username and it makes sure if it is longer that 3 letters.
		echo 'Your name must be between 3 and 32 characters!';
	
	}else{
	
	if(empty($_POST['Password'])){ // This checks the password field to see if it is empty
		echo 'You need to select a password!';
	}else{
	
	if(preg_match('/[^a-z0-9\-\_\.]+/i',$_POST['Username']))
	{// this checks the user for any symbols space etc .You can remove this is you choose
		echo 'Your name contains invalid characters!';
	}else{
	
	if(!checkEmail($_POST['Email']))
	{ // this is one of the functions we added on the function page. for this to work make sure the function is required on this page
		echo 'Your email is not valid!';
	}else{
	

if(empty($_POST['Agree'])){ // Check if the Checkbox is checked to agree with the terms of services
echo "You need to accept the Terms & conditions  in order to sign up.!";
}else{


// this check and makes sure that their are no duplication with the email
$sql = "SELECT id FROM users WHERE mail='".mysql_real_escape_string($_POST['Email'])."'";
$query = mysql_query($sql) or die(mysql_error());
$m_count = mysql_num_rows($query);
	  
if($m_count >= "1"){
echo 'This email has already been used.!';
}else{


// this makes sure that all the uses that sign up have their own names
$sql = "SELECT id FROM users WHERE name='".mysql_real_escape_string($_POST['Username'])."'";
$query = mysql_query($sql) or die(mysql_error());
$m_count = mysql_num_rows($query);
	  
if($m_count >= "1"){
echo 'This name has already been used.!';
}else{

$password = md5($_POST['Password']); // this is a md5 hash. its encrypt your password so it isnt easily hackable



// The id is blank because it is an auto_increment  which mean it will auto add a value to every user and the are all different. this is mainly so we dont have dupilcate. 
													
$sql = "INSERT INTO users SET id = '', name = '".$_POST['Username']."' , password= '$password', mail= '".$_POST["Email"]."'";
$res = mysql_query($sql);

$to = $_POST['Email'];
    $from = "no-reply@Game.co.uk";
    $subject = "Registration - Your Registration Details";

    $message = "<html>
   <body background=\"#4B4B4B\">
   <h1>Game Registration Details</h1>
   Dear ".$_POST['Username'].", <br>
    <center>
Your Username: ".$_POST['Username']."<p>

Your Password: ".$_POST['Password']."<p>

	  <p>
	  <font size=3> You recived this mail because someone used this mail to sign up to a game</font>
  </body>
</html>";
   
    $headers  = "From: Game Registration Details <no-reply@Game.co.uk>\r\n";
    $headers .= "Content-type: text/html\r\n";

	mail($to, $subject, $message, $headers);             

echo "".$_POST['Username'].", Welcome to the game.";
}}}
						}

					}
			}
	}
}

?>
<form method="post" >
  <center>
    <h1><strong>Registeer hier:</strong></h1>
    <p>Gebruikersnaam: 
      <input type="text" name="Username" id="Username">
    </p>
    <p>Wachtwoord:
      <input type="password" name="Password" id="Password">
    </p>
    <p>Emailadres: 
      <input type="text" name="Email" id="Email">
    </p>
    <p> Toon aan dat je geen BOT bent:
      <input type="checkbox" name="Agree" id="Agree">
      <br>
<input type="submit" name="Register" id="Register" value="Registeer">
    </p>
  </center>
</form>
<? 
if (isset($_POST['Register'])) {

$password = substr(md5($_SERVER['REMOTE_ADDR'].microtime().rand(1,100000)),0,6);
		// Generate a random password
}
		

?>

<? 
if (isset($_POST['Send'])) {

$password = substr(md5($_SERVER['REMOTE_ADDR'].microtime().rand(1,100000)),0,6);
		// Generate a random password

$nsql = "SELECT * FROM users WHERE mail='".mysql_real_escape_string($_POST['Email'])."'";
 $query = mysql_query($nsql) or die(mysql_error());
 $row = mysql_fetch_object($query);
 $name = htmlspecialchars($row->name);
 $pass = htmlspecialchars($row->password);
 $mail = htmlspecialchars($row->mail);

	
	
if((empty($_POST['Email']))){ // if the email field is empty there will be an error

		echo 'You one field empty.';
	}else{
		
	
	  if(empty($name)){ if // there is no name with the entered email
		echo 'Invalid information.';
	}else{
	
	  if($_POST['Email'] != $mail){
			echo 'Invalid information.'; // if their is no match in the email
	}else{
	
	if(!checkEmail($_POST['Email'])){ // the checkEmail function we have in our function that saves us time and sapce
		echo 'Your email is not valid!';
	}else{
		
	$result = mysql_query("UPDATE users SET password='$password' WHERE name='" .mysql_real_escape_string($name). "'") 
or die(mysql_error());	

			$to = $_POST['Email'];
    $from = "no-reply@Game.co.uk";
    $subject = "Registration - Your Registration Details";

    $message = "<html>
   <body background=\"#4B4B4B\">
   <h1>Game Registration Details</h1>
   Dear $name, <br>
    <center>
Your Username: $name <p>

Your Password: $password <p>

  </body>
</html>";
   
    $headers  = "From: Game Lost Details <no-reply@Game.co.uk>\r\n";
    $headers .= "Content-type: text/html\r\n";

	mail($to, $subject, $message, $headers);             

			echo 'We sent you an email with your Details!';
		
	}
}
}// check if name is unused.
}// check if accepted to the tos.
}// name check.
// if post register.		

?>




Keep getting: Parse error: syntax error, unexpected T_ECHO, expecting '(' in /home/a2156125/public_html/Register.php on line 145

please help!
Was This Post Helpful? 0
  • +
  • -

#29 Denis1  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 32
  • View blog
  • Posts: 102
  • Joined: 29-July 09

Posted 20 April 2013 - 04:04 AM

View Postfature, on 31 March 2013 - 12:31 AM, said:

<?php include_once("connect.php"); ?>
<? require 'functions.php'; ?>
<? 
if (isset($_POST['Register'])) {


if(strlen($_POST['Username'])<3 || strlen($_POST['Username'])>32)
	{ // This check the characters of the username and it makes sure if it is longer that 3 letters.
		echo 'Your name must be between 3 and 32 characters!';
	
	}else{
	
	if(empty($_POST['Password'])){ // This checks the password field to see if it is empty
		echo 'You need to select a password!';
	}else{
	
	if(preg_match('/[^a-z0-9\-\_\.]+/i',$_POST['Username']))
	{// this checks the user for any symbols space etc .You can remove this is you choose
		echo 'Your name contains invalid characters!';
	}else{
	
	if(!checkEmail($_POST['Email']))
	{ // this is one of the functions we added on the function page. for this to work make sure the function is required on this page
		echo 'Your email is not valid!';
	}else{
	

if(empty($_POST['Agree'])){ // Check if the Checkbox is checked to agree with the terms of services
echo "You need to accept the Terms & conditions  in order to sign up.!";
}else{


// this check and makes sure that their are no duplication with the email
$sql = "SELECT id FROM users WHERE mail='".mysql_real_escape_string($_POST['Email'])."'";
$query = mysql_query($sql) or die(mysql_error());
$m_count = mysql_num_rows($query);
	  
if($m_count >= "1"){
echo 'This email has already been used.!';
}else{


// this makes sure that all the uses that sign up have their own names
$sql = "SELECT id FROM users WHERE name='".mysql_real_escape_string($_POST['Username'])."'";
$query = mysql_query($sql) or die(mysql_error());
$m_count = mysql_num_rows($query);
	  
if($m_count >= "1"){
echo 'This name has already been used.!';
}else{

$password = md5($_POST['Password']); // this is a md5 hash. its encrypt your password so it isnt easily hackable



// The id is blank because it is an auto_increment  which mean it will auto add a value to every user and the are all different. this is mainly so we dont have dupilcate. 
													
$sql = "INSERT INTO users SET id = '', name = '".$_POST['Username']."' , password= '$password', mail= '".$_POST["Email"]."'";
$res = mysql_query($sql);

$to = $_POST['Email'];
    $from = "no-reply@Game.co.uk";
    $subject = "Registration - Your Registration Details";

    $message = "<html>
   <body background=\"#4B4B4B\">
   <h1>Game Registration Details</h1>
   Dear ".$_POST['Username'].", <br>
    <center>
Your Username: ".$_POST['Username']."<p>

Your Password: ".$_POST['Password']."<p>

	  <p>
	  <font size=3> You recived this mail because someone used this mail to sign up to a game</font>
  </body>
</html>";
   
    $headers  = "From: Game Registration Details <no-reply@Game.co.uk>\r\n";
    $headers .= "Content-type: text/html\r\n";

	mail($to, $subject, $message, $headers);             

echo "".$_POST['Username'].", Welcome to the game.";
}}}
						}

					}
			}
	}
}

?>
<form method="post" >
  <center>
    <h1><strong>Registeer hier:</strong></h1>
    <p>Gebruikersnaam: 
      <input type="text" name="Username" id="Username">
    </p>
    <p>Wachtwoord:
      <input type="password" name="Password" id="Password">
    </p>
    <p>Emailadres: 
      <input type="text" name="Email" id="Email">
    </p>
    <p> Toon aan dat je geen BOT bent:
      <input type="checkbox" name="Agree" id="Agree">
      <br>
<input type="submit" name="Register" id="Register" value="Registeer">
    </p>
  </center>
</form>
<? 
if (isset($_POST['Register'])) {

$password = substr(md5($_SERVER['REMOTE_ADDR'].microtime().rand(1,100000)),0,6);
		// Generate a random password
}
		

?>

<? 
if (isset($_POST['Send'])) {

$password = substr(md5($_SERVER['REMOTE_ADDR'].microtime().rand(1,100000)),0,6);
		// Generate a random password

$nsql = "SELECT * FROM users WHERE mail='".mysql_real_escape_string($_POST['Email'])."'";
 $query = mysql_query($nsql) or die(mysql_error());
 $row = mysql_fetch_object($query);
 $name = htmlspecialchars($row->name);
 $pass = htmlspecialchars($row->password);
 $mail = htmlspecialchars($row->mail);

	
	
if((empty($_POST['Email']))){ // if the email field is empty there will be an error

		echo 'You one field empty.';
	}else{
		
	
	  if(empty($name)){ // if there is no name with the entered email
		echo 'Invalid information.';
	}else{
	
	  if($_POST['Email'] != $mail){
			echo 'Invalid information.'; // if their is no match in the email
	}else{
	
	if(!checkEmail($_POST['Email'])){ // the checkEmail function we have in our function that saves us time and sapce
		echo 'Your email is not valid!';
	}else{
		
	$result = mysql_query("UPDATE users SET password='$password' WHERE name='" .mysql_real_escape_string($name). "'") 
or die(mysql_error());	

			$to = $_POST['Email'];
    $from = "no-reply@Game.co.uk";
    $subject = "Registration - Your Registration Details";

    $message = "<html>
   <body background=\"#4B4B4B\">
   <h1>Game Registration Details</h1>
   Dear $name, <br>
    <center>
Your Username: $name <p>

Your Password: $password <p>

  </body>
</html>";
   
    $headers  = "From: Game Lost Details <no-reply@Game.co.uk>\r\n";
    $headers .= "Content-type: text/html\r\n";

	mail($to, $subject, $message, $headers);             

			echo 'We sent you an email with your Details!';
		
	}
}
}// check if name is unused.
}// check if accepted to the tos.
}// name check.
// if post register.		

?>




Keep getting: Parse error: syntax error, unexpected T_ECHO, expecting '(' in /home/a2156125/public_html/Register.php on line 145

please help!


At line 144 you have an if that i presume should be commented.

if(empty($name)){ [b]if[/b] // there is no name with the entered email
        echo 'Invalid information.';

This post has been edited by Denis1: 20 April 2013 - 04:05 AM

Was This Post Helpful? 0
  • +
  • -

#30 CaMelToSiSss  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 07-March 09

Posted 22 April 2014 - 10:18 PM

Hello, I'm trying to do these tutorial series and I got stuck on second test file. I keep getting this error: Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\mafia_game\test.php on line 98
I was writing all code to get used to coding and I tought I missed something, but then i copied the code from tutorial and keep getting same error, heres my code:

<?php include_once("connect.php"); ?>
<html >
<head>
<title>Test</title>
</head>

<body>


<? 
if (isset($_POST['Submit'])) {
$sql = "INSERT INTO users SET id = '', name = '".$_POST['name']."'";
$res = mysql_query($sql);

echo "".$_POST['name']." ADDED";
}


// This is the bit that is new .The line below is just selecting data from users table and adding it to result
$result = mysql_query("SELECT name,id,money FROM users ORDER BY id DESC") or die(mysql_error());


// this is assingint som html for the drop down menu along with the some php and the data from result
$member_list = "";
	while($row = mysql_fetch_array( $result )) {
		if($row['name'] == $_POST['Name_list']){
		$member_list .= "<option selected=\"selected\" value=\"".$row['name']."\">".$row['name']."</option>";
		}else{
		$member_list .= "<option value=\"".$row['name']."\">".$row['name']."</option>";		
		}
	}


// the following below happend when you hit search and what it does is select data on the name you clicked on from the menu.
if(isset($_POST['Select']) or isset($_POST['update'])){

$sql = "SELECT * FROM users WHERE name='".mysql_real_escape_string($_POST['Name_list'])."'";
$query = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_object($query);
$select_money = htmlspecialchars($row->money);
}

// Updating the database with the information entered.
if(isset($_POST['update'])){
$result = mysql_query("UPDATE users SET money='".mysql_real_escape_string($_POST['money'])."' WHERE name='" .mysql_real_escape_string($_POST['Name_list']). "'") 
or die(mysql_error());	

echo "".$_POST['Name_list']."'s money have been changed.";
}
?>
<form method="post" >
  <p>
  <center>
    <p>ENTER NAME <br />
        <input type="text" name="name" id="name" />
        <br />
        <input type="submit" name="Submit" id="Submit" value="Submit" />
    </p>
    <p><br>
      <span class="cell">
      Select a Name
      <select name="Name_list" class="textbox" id="Name_list">
        <option value="<?php echo htmlspecialchars($_GET['user']);?>">Select.</option>
        <?php echo $member_list; ?>
      </select>
      </span>
      <input type="submit" name="Select" id="Select" onfocus="if(this.blur)this.blur()" value="Select">
      <br>
Change the Money
<input type="text" name="money" id="money" value="<?php echo $select_money; ?>">
    <br>
    <input type="submit" name="update" id="update" value="Update">
    <br>
    </p>
    <p>&nbsp;</p>
    <table width="50%" border="2" cellspacing="1" cellpadding="0">
      <tr align="center">
        <td colspan="3">Users Information</td>
      </tr>
      <tr align="center">
        <td>ID</td>
        <td>Name</td>
        <td>Money</td>
      </tr>
      <? 
$result = mysql_query("SELECT * FROM users") or die(mysql_error());
// keeps getting the next row until there are no more to get
	while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table?>
      <tr>
       <td><label for="<?php echo $row['id']; ?>"><?php
	$name2 = $row['id'];
	echo "$name2"; ?>
    </label></td>
        <td><? echo $row['name'] ?></td>
        <td><? echo $row['money'] ?></td>
      </tr>
        <?php } // while loop ?>
    </table>
    <p>&nbsp;</p>
  </center>
  </p>
</form>
</body>
</html>




Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3