Created
November 21, 2012 22:38
-
-
Save alpham/4128314 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Created on Nov 20, 2012 | |
* | |
* To change the template for this generated file go to | |
* Window - Preferences - PHPeclipse - PHP - Code Templates | |
*/ | |
echo "You entered id : ",$_POST["id"]; | |
echo "<br /> and you want to add ",$_POST["points"]," points to this user ."; | |
$con = mysql_connect("127.0.0.1","root","root"); | |
if (!$con) | |
{ | |
die('Could not connect: ' . mysql_error()); | |
} | |
$ahmed=mysql_select_db('test', $c); | |
if (FALSE===$ahmed) | |
{ | |
die('error selecting DB :(' . mysql_error()); | |
} | |
else | |
{ | |
echo "selected :)"; | |
} | |
mysql_query("INSERT INTO test.fans VALUES ({$_POST['id']}, 'ahmed', {$_POST['points']})"); | |
$result=mysql_query("SELECT * FROM test.fans;"); | |
echo "<br />"; | |
while($row = mysql_fetch_array($result,MYSQL_BOTH)) | |
{ | |
echo $row['id'] . " " . $row['name'] . " " . $row['points']; | |
echo "<br />"; | |
} | |
mysql_close($con); | |
echo "DONE"; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Add new member</title> | |
</head> | |
<body> | |
<form action="add.php" method="post"> | |
user id : <input type="text" name="id" value="Enter the ID here" size="20" /><br /> | |
bonus points : <input type="text" class="text" name="points" value="0" size="3" /><br /> | |
<input type="submit" value="OK" /> <input type="reset" value="Reset" /> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment