Homework Assignment
Read This Guide to PHP and MySQL: http://freewebmasterhelp.com/tutorials/phpmysqlThen explain each line of this code as best you can:
$dbuser = "test";
$dbpass = "test";
$dbname = "test";
mysql_connect(localhost,$dbuser,$dbpass);
@mysql_select_db($dbname) or die ('Unable to select database.');
echo "Connected successfully.";
$sqlinsert = "INSERT INTO mark_table VALUES ('','David F','cool')";
mysql_query($sqlinsert) or die("DIDnT WORK");
$sqlview = "SELECT * FROM mark_table";
$result = mysql_query($sqlview);
$num=mysql_numrows($result);
$i=0;
while($i < $num) {
$id=mysql_result($result,$i,"id");
$user=mysql_result($result,$i,"user");
$pass=mysql_result($result,$i,"pass");
echo $id .' '. $user .' '. $pass .' '; $i=$i+1;
}
mysql_close;
This is due tomorrow.
0 Comments:
Post a Comment
<< Home