海信家电”换帅 “ 高玉玲接替代慧忠出任新任董事长
2024-11-22
typedef struct DulNode{ struct DulNode *priou; ElemType data; struct DulNode *next; }DulNode,*DuLinkList; |
d->next->priou=d->priou->next=d |
CREATE DATABASE Test; CREATE TABLE test ( ID int(30) DEFAULT '0' NOT NULL auto_increment, Next_id int(30) DEFAULT '0' NOT NULL, Priou_id int(30) DEFAULT '0' NOT NULL, Data_title varchar(60) NOT NULL, Data text NOT NULL, KEY Id (Id), UNIQUE Id_2 (Id) ); |
<? //Date :2001/10/13 //Author: nica@263.net //注:加粗字体的为PHP函数库中定义的函数 $Dbname="Test"; $Tablename="test"; $my_link=mysql_connect('localhost','root',''); //与数据库服务器建立连接 $db=mysql_select_db($Dbname,$my_link); //插入数据的代码: Insert Data Code /**** 执行插入数据操作,并且获取到ID ******/ $Insertquery="INSERT INTO $Tablename (Data_title,Data) VALUES('$datatitle','$data')"; $I_result=mysql_query($Insertquery) or die(mysql_error()); $id=mysql_insert_id(); //获得ID /*****定义本记录的指针链接******/ $Priou_id=$id+1; $Next_id=$id-1; $Updatequery="UPDATE $Tablename SET Priou_id=$Priou_id,Next_id=$Next_id WHERE ID=".$id; $U_result= mysql_query($Updatequery) or die(mysql_error()); #p#分页标题#e# //删除数据的操作代码:Detele Data Code $id="n"; //即将被删除的某条数据记录的ID,根据具体情况获取 /*****获得当前要被删除记录的两个指针值*****/ $Selectquery2="SELECT * FROM $Tablename WHERE ID=".$id; $S_result2= mysql_query($Selectquery2) or die(mysql_error()); $Priou_id=mysql_result($S_result2,0,"Priou_id"); $Next_id=mysql_result($S_result2,0,"Next_id"); /***** 更改上一条记录的右指针使其指向本记录的右指针***/ $UpdatePriouquery="UPDATE $Tablename SET Next_id=$Next_id WHERE ID=".$Priou_id; $UP_result= mysql_query($UpdatePriouquery) or die(mysql_error()); /***** 更改下一条记录的左指针使其指向本记录的左指针***/ $UpdateNextquery="UPDATE $Tablename SET Priou_id=$Priou_id WHERE ID=".Next_id; $UN_result= mysql_query($UpdateNextquery) or die(mysql_error()); /******执行删除操作*******/ $Deletequery="DELETE FROM $Tablename WHERE ID=".$id; $D_result= mysql_query($Deletequery) or die(mysql_error()); mysql_close(); ?> |
评论 {{userinfo.comments}}
{{child.content}}
{{question.question}}
提交