mySQLi数据库错误,我不知道,首先这个查询运行良好,但现在不工作


mySQLi database error which i don't know , First this query run fine but now not working

我之前已经运行了这个查询,并在数据库中插入了记录,但现在不能正常工作。我搜索了解决方案,我的数据库大小是1.6MB,我也增加了php.ini中的xampp的默认大小从2Mb到20mb,刷新apache和mysql服务器。但没有解决方案

这是我的代码

        function saveProduct($myproductName , $myproductType , $mymyimage , $techInfo , $charactristics , $specifications , $properties)
        {
            $mycon = mysqli_connect("localhost","root","") or die ("could not connected to database");
            mysqli_select_db($mycon, "zic_app");
            $qry="INSERT INTO zic_catalog (productName, productImage, productType, vhviTech, generalCharactristics, specifications, properties) VALUES ('".$myproductName."' , '".$mymyimage."' , '".$myproductType."' , '".$techInfo."'  , '".$charactristics."' , '".$specifications."' , '".$properties."')";
            ?>
            <br /><br /><br />
            <?php
            $result=mysqli_query($mycon, $qry);
            if($result)
            {
                echo( "publish successfully...");
            }
            else
            {
                echo "Product Not published: " . mysqli_error($mycon);
            }
        }

,这是错误

你的SQL语法有错误;查看手册对应于您的MariaDB服务器版本以使用正确的语法近的手动变速箱油规格和其他主要汽车制造商当'在行1

如果数据中有apostrophe,它将打破sql -在sql中使用转义双引号代替或使用htmlentities转换数据

$qry="INSERT INTO zic_catalog (productName, productImage, productType, vhviTech, generalCharactristics, specifications, properties) 
VALUES 
('"{$myproductName}'" , '"{$mymyimage}'" , '"{$myproductType}'" , '"{$techInfo}'"  , '"{$charactristics}'" , '"{$specifications}'" , '"{$properties}'")";
相关文章: