The code is as follows |
Copy Code |
Session_Start (); $conn =mysql_connect (' localhost ', ' root ', ' root ') or Die (' Database connection error '); mysql_select_db (' demo ', $conn); mysql_query ("Set names ' GBK '"); $US =$_session[' username ']; $selequery =mysql_query ("SELECT * from blog where author= ' $US ' ORDER by id desc") or Die ("Query failed"); ?> <?php while ($selerow =mysql_fetch_array ($selequery)) {
?> <form action= "" method= "Post" name= "Modform" > <table width= "100%" border= "1" > <tr> <TD width= > Author:</td> <td><?php echo $_session[' username '. " ". $selerow [' redate '];? ></td> </tr> <tr> <TD width= > Message title:</td> <td><?php echo $selerow [' title '];? ></td> </tr> <tr> <td> Message Content:</td> <td><?php echo $selerow [' content '];? ></td> </tr> <tr> <TD colspan= "2" align= "center" ><input type= "Submit" value= "Modify" name= "sub" ></input></td> </tr> </table> </form> <br>
<?php}?> <!--<?php For ($i =1 $i < $selerow =mysql_num_rows ($selequery); $i + +) { if ($i < $selerow =mysql_num_rows ($selequery)) {?>
<table><tr><td><?php echo $selerow [' title '];? ></td></tr></table> <HR color= "Red" ><?php }else{?> <table></table> <?php }}
|
/*
drop table if exists ' blog ';
CREATE TABLE ' blog ' (
' ID ' int (a) NOT NULL auto_increment,
' Author ' varchar NOT NULL,
' title ' varchar NOT NULL,
' Content ' text,
' redate ' date not NULL,
Primary KEY (' ID ')
) Engine=innodb auto_increment=5 default CHARSET=GBK;
------------------------------
--Records of blog
------------------------------
insert INTO ' blog ' Valu Es (' 1 ', ' admin ', ' i ', ' <p> woo hoo </p> ', ' 2010-07-31 ');
INSERT INTO ' blog ' Values (' 2 ', ' admin ', ' V ', ' <p> my </p> ', ' 2010-07-31 ');
INSERT INTO ' blog ' Values (' 3 ', ' admin ', ' my ', ' <p> go to authoritative property law </p> ', ' 2010-07-31 ');
INSERT INTO ' blog ' Values (' 4 ', ' 111111 ', ' big arms ', ' <p> ' curved million </p> ', ' 2010-07-31 ');
*/