我一直在为客户的 Facebook 页面开发一个推荐应用程序,她可以自己编辑!我在将其插入数据库时遇到问题!我已经在 MySQLi forst 中编写了它,但现在已经回到基础,我在这里使用此代码......
<?php
$testtitle = preg_replace('#[^a-z]#i', '', $_POST['ts_tt']);
$testbody = preg_replace('#[^a-z]#i', '', $_POST['ts_tb']);
$compowner = preg_replace('#[^a-z]#i', '', $_POST['ts_co']);
$ownertitle = preg_replace('#[^a-z]#i', '', $_POST['ts_ot']);
$compname = preg_replace('#[^a-z]#i', '', $_POST['ts_cn']);
$compwebsite = preg_replace('#[^a-z]#i', '', $_POST['ts_cw']);
include_once "../php_includes/db_conx.php";
$sql = "INSERT INTO testimonials (testtitle, testbody, compowner, ownertitle, compname, compwebsite)
VALUES ('$testtitle', '$testbody', '$compowner', '$ownertitle', '$compname', '$compwebsite')";
if (!mysql_query($sql, $connection)){
die('Error: ' . mysql_error());
}
exit();
?>
这是我正在使用的简单表格!是的,我知道它在桌子上!我只是想做一些快速简单的事情......
<form method="post" action="testimonial_new_parse.php" onsubmit="return validate_form ( );">
<tr>
<td width="12%" align="right" bgcolor="#F5E4A9">Testimonial Full Title</td>
<td width="88%" bgcolor="#F5E4A9"><input name="ts_tt" type="text" size="80" maxlength="64" /></td>
</tr>
<tr>
<td align="right" valign="top" bgcolor="#DAEAFA">Testimonial Body</td>
<td bgcolor="#DAEAFA"><textarea name="ts_tb" cols="60" rows="16"></textarea></td>
</tr>
<tr>
<td align="right" bgcolor="#D7EECC">Company Owner</td>
<td bgcolor="#D7EECC"><input name="ts_co" type="text" maxlength="64" size="80" /></td>
</tr>
<tr>
<td align="right" bgcolor="#D7EECC">Owner Title</td>
<td bgcolor="#D7EECC"><input name="ts_ot" type="text" maxlength="64" size="80"/></td>
</tr>
<tr>
<td align="right" bgcolor="#D7EECC">Company Name</td>
<td bgcolor="#D7EECC"><input name="ts_cn" type="text" maxlength="64" size="80" /></td>
</tr>
<tr>
<td align="right" bgcolor="#D7EECC">Company Website</td>
<td bgcolor="#D7EECC"><input name="ts_cw" type="text" maxlength="64" size="80" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="ts_button" value="Create this Testimonial now" /></td>
</tr>
</form>
问题是我一直在选择 Np 数据库!任何帮助,将不胜感激!