|
|
|
CODE PHP นี้ไม่สามารถ อัพเดทข้อมูลในฐานข้อมูลได้ครับไม่ทราบว่าผิดตรงไหนช่วยชี้แนะทีครับ |
|
|
|
|
|
|
|
ลอง echo $strSQL ออกมาดูหรือยังครับ ว่าได้แบบที่ต้องการหรือเปล่า
|
|
|
|
|
Date :
2011-08-02 14:04:14 |
By :
grandraftz |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$strSQL = "SELECT * FROM sitedata ORDER BY domain ASC";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$i =0;
while($objResult = mysql_fetch_array($objQuery))
{
$i = $i + 1;
?>
<html>
<head>
.
.
.
<?
}
?>
</table>
</form>
</body>
</html>
พินาศหละครับ แถมอย่างอื่นก้อคงพังตามด้วยคับ
|
|
|
|
|
Date :
2011-08-02 15:55:19 |
By :
zenix |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
include("../config/config.php");กก
เหน coed อาการ หนัก
ลบทิ้งเขียนดีกว่า
Code (PHP)
<?
include("./config/config.php");
//*** Update Condition ***//
if($_GET["Action"] == "Save")
{
for($i=1;$i<=$_POST["hdnLine"];$i++)
{
$strSQL = "UPDATE sitedata SET ";
$strSQL .="domain = '".$_POST["txtdomainname$i"]."' ";
$strSQL .=",title = '".$_POST["txttitle$i"]."' ";
$strSQL .=",description = '".$_POST["txtdescrip$i"]."' ";
$strSQL .=",tags = '".$_POST["txttags$i"]."' ";
$strSQL .=",whois = '".$_POST["txtwhois$i"]."' ";
$strSQL .="WHERE domain = '".$_POST["hdndomainname$i"]."' ";
$objQuery = mysql_query($strSQL);
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
$strSQL = "SELECT * FROM sitedata ORDER BY domain ASC";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<style type="text/css">
body
{
padding:0;
font-family:Tahoma;
font-size:12px;
}
td{background-color:#f8f6f2;}
table, th, td{border: solid 1px #f3efe6; align:right}
url {
text-transform:capitalize;}
.title1
{
font-size:13px;
margin-top:5px;
font-weight:bold;
text-align :right;
}
.title2
{
font-size:6px;
margin-top:5px;
text-align :right;
color:#999999;
}
input{
font-size:12px;
margin-top:3px;
margin-bottom:3px;
padding:4px 2px;
border:solid 1px #f3efe6;
}
textarea
{
font-size:12px;
margin-top:3px;
margin-bottom:3px;
padding:4px 2px;
border:solid 1px #f3efe6;
}
</style>
</head>
<body>
<form action="update.php?Action=Save" method="POST">
$i =0;
while($objResult = mysql_fetch_array($objQuery))
{
$i = $i + 1;
?>
<table cellspacing="0" table-layout="auto">
<tr>
<td width="152"><div class="title1">Domain name</div>
</td>
<td width="259">
<input name="hdndomainname<?=$i;?>" type="hidden" id="hdntxtdomainname" value="<?=$objResult["domain"];?>">
<input name="txtdomainname<?=$i;?>" type="text" id="txtdomainname" value="<?=$objResult["domain"];?>">
</td>
</tr>
<tr>
<td><div class="title1">Title</div><div class="title2">Edit/Update Title</div>
</td>
<td><textarea rows="2" cols="40" name="txttitle<?=$i;?>" id="txttitle"><?=$objResult["title"];?></textarea>
</td>
</tr>
<tr>
<td><div class="title1">Description</div><div class="title2">Edit/Update Description</div>
</td>
<td><textarea rows="3" cols="40" name="txtdescrip<?=$i;?>" id="txtdescrip"><?=$objResult["description"];?></textarea>
</td>
</tr>
<tr>
<td><div class="title1">Key</div><div class="title2">Edit/Update Key</div>
</td>
<td><textarea rows="5" cols="40" name="txttags<?=$i;?>" id="txttags"><?=$objResult["tags"];?></textarea>
</td>
</tr>
<tr>
<td><div class="title1">Whois</div> <div class="title2">Edit/Update Whois</div>
</td>
<td><textarea rows="10" cols="40" name="txtwhois<?=$i;?>" id="txtwhois"><?=$objResult["whois"];?>
</textarea>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="submit" value="submit">
<input type="hidden" name="hdnLine" value="<?=$i;?>">
</td>
</tr>
>
</table>
<?
}
?
</form>
</body>
</html>
เอา error มาโชว์ด้วยนะ
|
ประวัติการแก้ไข 2011-08-02 15:59:56 2011-08-02 16:01:51 2011-08-02 16:02:51
|
|
|
|
Date :
2011-08-02 15:58:00 |
By :
ckcr |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?
include('jsql/jsql.php');
//*** Update Condition ***//
if($_GET["Action"] == "Save")
{
for($i=1;$i<=$_POST["hdnLine"];$i++)
{
$strSQL = "UPDATE geography SET ";
$strSQL .="GEO_ID = '".$_POST["txtdomainname$i"]."' ";
$strSQL .=",GEO_NAME = '".$_POST["txttitle$i"]."' ";
$strSQL .="WHERE GEO_ID = '".$_POST["hdndomainname$i"]."' ";
$objQuery = mysql_query($strSQL);
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
$strSQL = "SELECT * FROM geography ORDER BY GEO_ID ASC";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<style type="text/css">
body
{
padding:0;
font-family:Tahoma;
font-size:12px;
}
td{background-color:#f8f6f2;}
table, th, td{border: solid 1px #f3efe6; align:right}
url {
text-transform:capitalize;}
.title1
{
font-size:13px;
margin-top:5px;
font-weight:bold;
text-align :right;
}
.title2
{
font-size:6px;
margin-top:5px;
text-align :right;
color:#999999;
}
input{
font-size:12px;
margin-top:3px;
margin-bottom:3px;
padding:4px 2px;
border:solid 1px #f3efe6;
}
textarea
{
font-size:12px;
margin-top:3px;
margin-bottom:3px;
padding:4px 2px;
border:solid 1px #f3efe6;
}
</style>
</head>
<body>
<form action="update.php?Action=Save" method="POST">
$i =0;
while($objResult = mysql_fetch_array($objQuery))
{
$i = $i + 1;
?>
<table cellspacing="0" table-layout="auto">
<tr>
<td width="152"><div class="title1">GEO_ID</div></td>
<td width="259">
<input name="hdndomainname<?=$i;?>" type="hidden" id="hdntxtdomainname" value="<?=$objResult["GEO_ID"];?>">
<input name="txtdomainname<?=$i;?>" type="text" id="txtdomainname" value="<?=$objResult["GEO_ID"];?>"></td>
</tr>
<tr>
<td><div class="title1">GEO_NAME</div><div class="title2">Edit/<span class="title1">GEO_NAME</span></div></td>
<td><textarea rows="2" cols="40" name="txttitle<?=$i;?>" id="txttitle"><?=$objResult["title"];?></textarea></td>
</tr>
<input type="submit" name="submit" value="submit">
<input type="hidden" name="hdnLine" value="<?=$i;?>"></td>
</tr>
>
</table>
<?
}
</form>
</body>
</html>
|
|
|
|
|
Date :
2011-08-02 17:45:10 |
By :
stark |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Parse error: syntax error, unexpected '<' in C:\AppServ\www\final\om.php on line 24
เอาของ No. 3 มาแก้ได้ความแบบนี้ครับ
|
|
|
|
|
Date :
2011-08-02 17:45:58 |
By :
stark |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
คุณกลับไปอ่านในบทเรียนก่อนน่ะครับ การเปิด ปิด Tag php ครับ
|
|
|
|
|
Date :
2011-08-02 20:45:52 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|