mysqli_stmt_bind_param不能处理时间类型吗?
报错的这条语句
mysqli_stmt_bind_param($stmt, 'idii', $c, $a, $t, $w);
完整代码
<?php<br />require ('inc/config.php');<br />$page_title = '住宅数据添加-feige数据中心';<br />include ('inc/header.php');<br />require (MYSQL);<br />if ($_SERVER['REQUEST_METHOD'] == 'POST') { <br /> $trimmed = array_map('trim', $_POST);<br /> $errors = array();<br /> if(empty($trimmed['wdate'])) {<br /> $errors[] = '日期不能为空';<br /> } else {<br /> $w = mysqli_real_escape_string ($conn, $trimmed['wdate']);<br /> }<br /> <br /> if ( isset($trimmed['city']) && filter_var($trimmed['city'], FILTER_VALIDATE_INT, array('city' => 1)) ) {<br /> $c = mysqli_real_escape_string ($conn, $trimmed['city']);;<br /> } else {<br /> $errors[] = '请选择区域';<br /> }<br /> <br /> if (is_numeric($trimmed['taoshu']) && ($trimmed['taoshu'] > 0)) {<br /> $t = mysqli_real_escape_string ($conn, (int) $trimmed['taoshu']);<br /> } else {<br /> $errors[] = '请输入一个正确的套数';<br /> }<br /> if (is_numeric($trimmed['area']) && ($trimmed['area'] > 0)) {<br /> $a = mysqli_real_escape_string ($conn, (float) $trimmed['area']);<br /> } else {<br /> $errors[] = '请输入一个正确的面积';<br /> }<br /> <br /> <br /> if (empty($errors)) {<br /> $q = 'INSERT INTO f_chengjiao (city_id, area, taoshu, fang_time, os_time) VALUES (?, ?, ?, ?, ?, NOW())';<br /> $stmt = mysqli_prepare($conn, $q);<br /> mysqli_stmt_bind_param($stmt, 'idii', $c, $a, $t, $w);<br /> mysqli_stmt_execute($stmt);<br /><br /> if (mysqli_stmt_affected_rows($stmt) == 1) {<br /> echo '<p>这条数据已经被添加</p>';<br /> $_POST = array(); <br /> } else {<br /> echo '<p style="font-weight: bold; color: #C00">程序发生错误,请重新添加</p>'; <br /> } <br /> mysqli_stmt_close($stmt); <br /> } <br />} <br /><br />if ( !empty($errors) && is_array($errors) ) {<br /> echo '<p style="font-weight: bold; color: #C00">发生下列错误:<br />';<br /> foreach ($errors as $msg) {<br /> echo " - $msg<br />\n";<br /> }<br /> echo '请在试一遍</p>';<br />}<br /><br />?><br /><div class="portlet wrap mT50"><br /> <div class="portlet-title">住宅数据添加</div><br /> <div class="portlet-body"><br /> <form action="zhuzhai_add.php" method="post"><br /> <div class="control-group"><br /> <label class="control-label">时间</label><br /> <div class="controls"><br /> <input type="text" name="wdate" class="add-in" onClick="WdatePicker()" value="" />时间格式例如:2014-12-12<br /> </div><br /> </div> <br /> <div class="control-group"><br /> <label class="control-label">区域</label><br /> <div class="controls"><br /> <select name="city" class="select-city"><br /> <?php <br /> $q = "SELECT city_id, city_name FROM f_city ORDER BY city_id ASC"; <br /> $r = mysqli_query ($conn, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($conn));<br /> if (@mysqli_num_rows($r) > 0) {<br /> while ($row = mysqli_fetch_array ($r, MYSQLI_NUM)) {<br /> echo "<option value=\"$row[0]\"";<br /> if (isset($trimmed['city']) && ($trimmed['city'] == $row[0]) ) echo ' selected="selected"';<br /> echo ">$row[1]</option>\n";<br /> }<br /> mysqli_free_result ($r);<br /> } else {<br /> echo '<option>暂无区域,请添加一个新地区</option>';<br /> }<br /> mysqli_close($conn);<br /> ?><br /> </select><br /> </div><br /> </div><br /> <div class="control-group"><br /> <label class="control-label">套数</label><br /> <div class="controls"><br /> <input type="text" name="taoshu" class="add-in" value="" />套<br /> </div><br /> </div> <br /> <div class="control-group"><br /> <label class="control-label">面积</label><br /> <div class="controls"><br /> <input type="text" name="area" class="add-in" value="" />平方<br /> </div><br /> </div> <br /> <div class="form-actions"><br /> <button class="btn" name="submit" type="submit">提交</button><br /> </div> <br /> </form><br /> </div><br /></div><br /><?php<br />include ('inc/footer.php');<br />?>
报错提示
出错文件是 'D:\wamp\www\zhuzhai_add.php' 出错行号是 36: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given<div class="clear"> </div>

ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
