添加数据库这里总是出问题
if($fun==3){ $row=mysql_fetch_array(mysql_query("SELECT * FROM production ORDER BY proNo DESC LIMIT 0, 30 ")); $num=$row['proNo']; $num++; $nums=$num*10+3; echo" 添加编号为:$num 的商品:</br> <form action='admfun.php?fun=$nums' method='post'> <table border='1'> <tr><td>商品名称:</td><td><input class='input' type='text' name='iproName'></td></tr> <tr><td>关键字:</td><td><input class='input' type='text' name='iproKey'></td></tr> <tr><td>价格:</td><td><input class='input' type='text' name='iproPrice'></td></tr> <tr><td>生产地:</td><td><input class='input' type='text' name='iproPlace'></tr> <tr><td>库存量:</td><td><input class='input' type='text' name='isumNum'></td></tr> <tr><td>是否含糖:</td><td><input class='input' type='text' name='isugar'></td></tr> <tr><td>是否包邮:</td><td><input class='input' type='text' name='ifee'></td></tr> <tr><td>卡路里:</td><td><input class='input' type='text' name='icalorie'></td> </tr> <tr><td>图片路径:</td><td><input class='input' type='text' name='ipicture'></td></tr> <tr><td>净含量:</td><td><input class='input' type='text' name='iproWeight'></td></tr> <tr><td>分类:</td><td><input class='input' type='text' name='iproType'></td></tr> </table> <input type='submit' value='添加' class='submitBtn'/> </form>"; }
if($fun%10==3&&$fun!=3){ $num=$_GET['fun'];$num=($num-3)/10; $itime=date("Ymd"); if(!empty($_POST['iproName'])){ echo $itime; $result="INSERT INTO prodution(proNo,proName,proKey,proPrice,proPlace,sumNum,sugar,fee,calorie,time,picture,proWeight,proType) VALUES ('$num','$_POST[iproName]','$_POST[iproKey]','$_POST[iproPrice]','$_POST[iproPlace]','$_POST[isumNum]','$_POST[isugar]','$_POST[ifee]','$_POST[icalorie]','$itime','$_POST[ipicture]','$_POST[iproWeight]','$_POST[iproType]')"; } if (!mysql_query($result,$corn)) echo"<font size=5> 添加失败!!</font>"; else echo"<font size=5> 添加成功!!</font>"; }
数据库:
回复讨论(解决方案)
int型不要加 ' ' 字符型要加 ' ' 你好好查查吧
mysql_error 提供相关错误信息,你不去看,怪哪个?
$result="INSERT INTO prodution(proNo,proName,proKey,proPrice,proPlace,sumNum,sugar,fee,calorie,time,picture,proWeight,proType) VALUES ('$num','$_POST[iproName]','$_POST[iproKey]','$_POST[iproPrice]','$_POST[iproPlace]','$_POST[isumNum]','$_POST[isugar]','$_POST[ifee]','$_POST[icalorie]','$itime','$_POST[ipicture]','$_POST[iproWeight]','$_POST[iproType]')";
echo $result;
输出sql放在mysql工具执行看看
或者
mysql_query($result,$corn) or die(mysql_error());

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

TomakePHPapplicationsfaster,followthesesteps:1)UseOpcodeCachinglikeOPcachetostoreprecompiledscriptbytecode.2)MinimizeDatabaseQueriesbyusingquerycachingandefficientindexing.3)LeveragePHP7 Featuresforbettercodeefficiency.4)ImplementCachingStrategiessuc

ToimprovePHPapplicationspeed,followthesesteps:1)EnableopcodecachingwithAPCutoreducescriptexecutiontime.2)ImplementdatabasequerycachingusingPDOtominimizedatabasehits.3)UseHTTP/2tomultiplexrequestsandreduceconnectionoverhead.4)Limitsessionusagebyclosin

Dependency injection (DI) significantly improves the testability of PHP code by explicitly transitive dependencies. 1) DI decoupling classes and specific implementations make testing and maintenance more flexible. 2) Among the three types, the constructor injects explicit expression dependencies to keep the state consistent. 3) Use DI containers to manage complex dependencies to improve code quality and development efficiency.

DatabasequeryoptimizationinPHPinvolvesseveralstrategiestoenhanceperformance.1)Selectonlynecessarycolumnstoreducedatatransfer.2)Useindexingtospeedupdataretrieval.3)Implementquerycachingtostoreresultsoffrequentqueries.4)Utilizepreparedstatementsforeffi


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 Linux new version
SublimeText3 Linux latest version

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

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.
