<?
require("mysql_funktioner.php");
include ("mysql.php");
?>
<?php
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($database);
$result = mysql_query("SELECT * FROM nyhed ORDER BY id DESC") or die(mysql_error());
while ($row = mysql_fetch_array($result)) { ?>
<?
$tekst = $row["besked"];
$tekst = htmlentities($tekst);
?>
<form name="form1" method="post" action="retnyhed.php?action=updatenews">
<table align="center" width="500" cellpadding="0" cellspacing="0" style="border: 1px solid black">
<tr>
<td align="left" style="border-bottom: 1px solid black"> <font color="white">
<input type="text" name="textfield" value="<?=$row["title"]?>">
</font> </td> <td align="right" style="border-bottom: 1px solid black"><font color="white">
<input type="text" name="textfield2" value="<?=$row["dato"]?>">
</font> </td>
</tr>
<tr>
<td colspan=3 align=center>
<textarea name="textfield3" cols="85" rows="15"><?=$tekst?></textarea>
</td>
</tr>
<tr>
<td colspan=3 align=right>
<input type="text" name="textfield5" value="<?=$row["email"]?>">
<input type="text" name="textfield4" value="<?=$row["navn"]?>">
</td>
</tr>
</table><br>
<center>
<input type="submit" class="button" value="Send Besked" name="send">
<input type="reset" class="button" value="Slet Besked" name="reset">
</center>
</form>
<?php
}
?>
<?
if ($action == "updatenews") {
start_sql();
sql_spoerg("update nyhed (navn, email, title, besked, dato) values('$brugernavn', '$email', '$title', '$besked', now())");
stop_sql();
echo "<center><br><br><b>Nyhed oprettet<br><a href=\\"index.php\\">Se News</a></center>";
}
?>
den ret nyhed jeg har prøvet som ik virker
<% mode = request("mode") %>
<% Response.buffer = true %>
<% if mode = "" then %>
<%
'Connection til databasen
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath ("database/db.mdb")
strSQL = "select* from nyheder ORDER BY ID DESC"
set rs = Conn.execute(strSQL)
if rs.EOF then
Response.write "<font face=""Verdana"" size=""2"">Der er ingen Nyheder!</font>"
else
Do Until rs.EOF
besked = rs("besked")
besked = Replace(besked,vbcrlf,"<br>")
%>
<form method="POST" action="?mode=update">
<input type="hidden" name="id" size="50" value="<%=RS("id")%>">
<div align="center">
<center>
<table border="1" width="83%" cellspacing="0" cellpadding="0" style="border: 1 solid #000000" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#000000">
<tr>
<td width="50%" height="13" background="overskrift2.gif"
style="border-bottom: 1 solid #000000">
<div align="center">
<center>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<td width="50%"><b><font
color="#FFFFFF" face="Trebuchet MS"><input type="text" name="overskrift" size="20" value="<%=rs("overskrift")%>"></font></b></td>
</center>
<td width="50%" valign="top">
<p align="right"><font color="#FFFFFF" face="Trebuchet MS" size="1">Af: <input type="text" name="navn" size="20" value="<%=rs("navn")%>"> Dato: <input type="text"name="dato" size="20" value="<%=rs("dato")%>"></font></td>
</table>
</div>
</td>
</tr>
<tr>
<td width="50%" bgcolor="#6699FF" valign="top" colspan="2">
<p align="center"><font color="#FFFFFF" face="Trebuchet MS"><textarea rows="3" name="besked" cols="65"><%=besked%></textarea><br>
Slet?<input type="checkbox" name="delete" value="ON"><input type="submit" value="opdater/slet" name="send"></font></td>
</tr>
</table>
</form>
<font color="#FFFFFF" face="Trebuchet MS">
<br>
<%RS.MoveNext
Loop
end if
Conn.Close
Set Conn = Nothing%>
<% end if %>
<% if mode = "update" then %>
<%
Const adOpenKeyset = 1
Const adLockOptimistic = 3
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("database/db.mdb") & ";UID=admin;PWD=;"
Set rs = Server.CreateObject("ADODB.RecordSet")
strSQL = "Select * FROM nyheder WHERE id=" & request.form("id")
rs.Open strSQL, Conn, adOpenKeyset, adLockOptimistic
%>
<% if Request.form("delete") = "ON" then
Rs.delete
Response.Redirect "retnyhed.asp"
%><% end if %>
<%
rs.Update
rs("navn") = Request.form("navn")
rs("besked") = Request.form("besked")
rs("dato") = Request.form("dato")
rs("overskrift") = Request.form("overskrift")
rs.Update
rs.Close
Set rs = Nothing
Conn.Close
set Conn = Nothing
Response.Redirect "retnyhed.asp"
%>
<% end if %>
asp koden som jeg vil have den bare i php :]
<---//----------------------------->
Simon Karberg
icq: kommer
mail: zyxep@twinz.dk
url:
http://zyxep.h4f.dk<-----------------------------//--->