pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

  • <legend id='FQzfH'><style id='FQzfH'><dir id='FQzfH'><q id='FQzfH'></q></dir></style></legend>
      <bdo id='FQzfH'></bdo><ul id='FQzfH'></ul>

    <small id='FQzfH'></small><noframes id='FQzfH'>

      <tfoot id='FQzfH'></tfoot>
      1. <i id='FQzfH'><tr id='FQzfH'><dt id='FQzfH'><q id='FQzfH'><span id='FQzfH'><b id='FQzfH'><form id='FQzfH'><ins id='FQzfH'></ins><ul id='FQzfH'></ul><sub id='FQzfH'></sub></form><legend id='FQzfH'></legend><bdo id='FQzfH'><pre id='FQzfH'><center id='FQzfH'></center></pre></bdo></b><th id='FQzfH'></th></span></q></dt></tr></i><div class="j77rh7l" id='FQzfH'><tfoot id='FQzfH'></tfoot><dl id='FQzfH'><fieldset id='FQzfH'></fieldset></dl></div>
      2. mysqli_real_escape_string() 需要 2 個參數,1 個給定致

        mysqli_real_escape_string() expects exactly 2 parameters, 1 given Fatal Error(mysqli_real_escape_string() 需要 2 個參數,1 個給定致命錯誤)
        <legend id='PEZtQ'><style id='PEZtQ'><dir id='PEZtQ'><q id='PEZtQ'></q></dir></style></legend>
        <i id='PEZtQ'><tr id='PEZtQ'><dt id='PEZtQ'><q id='PEZtQ'><span id='PEZtQ'><b id='PEZtQ'><form id='PEZtQ'><ins id='PEZtQ'></ins><ul id='PEZtQ'></ul><sub id='PEZtQ'></sub></form><legend id='PEZtQ'></legend><bdo id='PEZtQ'><pre id='PEZtQ'><center id='PEZtQ'></center></pre></bdo></b><th id='PEZtQ'></th></span></q></dt></tr></i><div class="5px7h77" id='PEZtQ'><tfoot id='PEZtQ'></tfoot><dl id='PEZtQ'><fieldset id='PEZtQ'></fieldset></dl></div>
          <tbody id='PEZtQ'></tbody>
              • <small id='PEZtQ'></small><noframes id='PEZtQ'>

                  <bdo id='PEZtQ'></bdo><ul id='PEZtQ'></ul>
                • <tfoot id='PEZtQ'></tfoot>

                  本文介紹了mysqli_real_escape_string() 需要 2 個參數,1 個給定致命錯誤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我不斷收到這個錯誤,我在修復這個錯誤時遇到了問題,我在 PHP 方面并不擅長,因為我還在學習.我正在處理注冊表并使用 PHP 5.6.我查看了有關較舊問題的其他答案,但沒有成功.

                  I keep getting this errors and I am having problems fixing that, am not good in PHP because am still learning. I am working on a registration form and am using PHP 5.6. I have looked at other answers on older questions but I haven't succeeded.

                  這是我的代碼:

                  <?php
                  session_start();
                  if (isset($_SESSION['user']) != "") {
                      header("Location: index.html");
                  }
                  include_once 'dbconnect.php';
                  
                  if (isset($_POST['signup'])) {
                      $fname  = mysqli_real_escape_string($_POST['fullname']);
                      $tphone = mysqli_real_escape_string($_POST['telephone']);
                      $uemail = mysqli_real_escape_string($_POST['email']);
                      $urole  = mysqli_real_escape_string($_POST['role']);
                      $upass  = md5(mysqli_real_escape_string($_POST['upass']));
                      
                      $uname  = trim($uname);
                      $tphone = trim($tphone);
                      $email  = trim($email);
                      $urole  = trim($role);
                      $upass  = trim($upass);
                      
                      // email exist or not
                      $query  = "SELECT email FROM users WHERE email='$uemail'";
                      $result = mysqli_query($query);
                      
                      $count = mysqli_num_rows($result); // if email not found then register
                      
                      if ($count == 0) {
                          
                          if (mysqli_query("INSERT INTO users(firstname,telephone,email,role,pass) VALUES('$fname','$tphone','$uemail','$urole',$upass')")) {
                  ?>
                             <script>alert('successfully registered ');</script>
                              <?php
                          } else {
                  ?>
                             <script>alert('error while registering you...');</script>
                              <?php
                          }
                      } else {
                  ?>
                             <script>alert('Sorry Email ID already taken ...');</script>
                              <?php
                      }
                      
                  }
                  ?> 
                  

                  我不斷收到的錯誤是:

                  警告:mysqli_real_escape_string() 需要 2 個參數,1 個在 C:Apache24htdocsTimewiselandinglogin.php 第 12 行

                  Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in C:Apache24htdocsTimewiselandinglogin.php on line 12

                  警告:mysqli_real_escape_string() 需要 2 個參數,1 個在 C:Apache24htdocsTimewiselandinglogin.php 第 13 行

                  Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in C:Apache24htdocsTimewiselandinglogin.php on line 13

                  警告:mysqli_query() 需要至少 2 個參數,其中 1 個在 C:Apache24htdocsTimewiselandinglogin.php 第 18 行

                  Warning: mysqli_query() expects at least 2 parameters, 1 given in C:Apache24htdocsTimewiselandinglogin.php on line 18

                  警告:mysqli_fetch_array() 期望參數 1 為 mysqli_result,C:Apache24htdocsTimewiselandinglogin.php 第 19 行給出的 null

                  Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in C:Apache24htdocsTimewiselandinglogin.php on line 19

                  警告:mysqli_num_rows() 期望參數 1 為 mysqli_result,C:Apache24htdocsTimewiselandinglogin.php 第 21 行給出的 null

                  Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in C:Apache24htdocsTimewiselandinglogin.php on line 21

                  你能幫我解決這個問題嗎,我需要知道我應該如何實際解決這個問題.

                  Can you please help me on this, I need to know how I should fix this practically.

                  推薦答案

                  技術上回答這個問題,根據手冊,這兩個函數都需要傳遞一個數據庫連接并作為第一個參數:

                  To technically answer this, both of these functions require a db connection be passed and as the first parameter, as per the manuals:

                  • http://php.net/manual/en/mysqli.query.php
                  • http://php.net/manual/en/mysqli.real-escape-string.php

                  然后在評論中聲明您正在使用 PDO 進行連接.

                  Then in comments you state that you are using PDO to connect with.

                  那些不同的 MySQL API 不會混合使用.從連接到查詢,您需要使用相同的方法.因此,如果您想繼續使用 PDO 連接,您將需要使用 PDO 函數來查詢,而不是 mysqli_*.

                  Those different MySQL APIs do not intermix. You need to use the same one from connecting to querying. Therefore, if you want to continue to use a PDO connection, you will need to use the PDO functions to query with and not mysqli_*.

                  • 從手冊開始:http://php.net/manual/en/book.pdo.php 都在里面.
                  • Start with the manual: http://php.net/manual/en/book.pdo.php it's all in there.

                  對于 PDO 準備好的語句:

                  And for PDO prepared statements:

                  • http://php.net/pdo.prepared-statements

                  還要檢查錯誤:

                  • http://php.net/manual/en/pdo.error-handling.php (PDO)
                  • http://php.net/manual/en/function.error-reporting.php (PHP)
                  • http://php.net/manual/en/pdo.error-handling.php (PDO)
                  • http://php.net/manual/en/function.error-reporting.php (PHP)

                  密碼

                  我還注意到您正在嘗試存儲密碼 MD5.不建議這樣做,因為將其用作密碼存儲功能不再被認為是安全的.

                  I also noticed that you are attemtpting to store passwords MD5. This is not recommended as it is no longer considered safe to use as a password storing function.

                  • 如果您打算使用此功能進行直播,不要.

                  使用以下方法之一:

                  • CRYPT_BLOWFISH
                  • crypt()
                  • bcrypt()
                  • scrypt()
                  • 開放式墻
                  • PBKDF2
                  • PHP.net 上的 PBKDF2
                  • PHP 5.5 的 password_hash() 函數.
                  • 兼容包(如果 PHP <5.5)https://github.com/ircmaxell/password_compat/

                  其他鏈接:

                  • PBKDF2 對于 PHP

                  關于列長度的重要旁注:

                  如果您決定使用 password_hash() 或 crypt,請務必注意,如果您當前密碼列的長度小于 60,則需要將其更改為(或更高).手冊建議長度為 255.

                  If and when you do decide to use password_hash() or crypt, it is important to note that if your present password column's length is anything lower than 60, it will need to be changed to that (or higher). The manual suggests a length of 255.

                  您需要更改列的長度并使用新的散列重新開始以使其生效.否則,MySQL 將靜默失敗.

                  You will need to ALTER your column's length and start over with a new hash in order for it to take effect. Otherwise, MySQL will fail silently.

                  我也說過:

                  if (isset($_SESSION['user']) != "") 會給你一個誤報.

                  語法是:if isset AND equals to,而不是if isset equals to,這是它目前被解釋為的內容.

                  The syntax is: if isset AND equals to, and not if isset equals to which is what it is presently being interpreted as.

                  使用:

                  if (isset($_SESSION['user']) && $_SESSION['user'] != "")

                  關于你的 POST 數組.

                  In regards to your POST arrays.

                  確保您使用的 HTML 表單確實使用了 POST 方法,并且所有元素都擁有各自的名稱屬性.

                  Make sure the HTML form you are using does use a POST method and that all elements hold their respective name attributes.

                  即:

                  請注意,name="fullname"name="FullName" 是兩種不同的動物.

                  Note that name="fullname" and name="FullName" are two different animals.

                  • 那些區分大小寫.

                  還建議在每個header后面加上exit;,否則你的代碼可能想繼續執行.

                  It is also suggested to add exit; after each header, otherwise your code may want to continue to execute.

                  header("Location: index.html");
                  exit;
                  

                  這篇關于mysqli_real_escape_string() 需要 2 個參數,1 個給定致命錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)
                  <tfoot id='G5CbG'></tfoot>
                    <tbody id='G5CbG'></tbody>

                      <bdo id='G5CbG'></bdo><ul id='G5CbG'></ul>

                      1. <legend id='G5CbG'><style id='G5CbG'><dir id='G5CbG'><q id='G5CbG'></q></dir></style></legend>
                        <i id='G5CbG'><tr id='G5CbG'><dt id='G5CbG'><q id='G5CbG'><span id='G5CbG'><b id='G5CbG'><form id='G5CbG'><ins id='G5CbG'></ins><ul id='G5CbG'></ul><sub id='G5CbG'></sub></form><legend id='G5CbG'></legend><bdo id='G5CbG'><pre id='G5CbG'><center id='G5CbG'></center></pre></bdo></b><th id='G5CbG'></th></span></q></dt></tr></i><div class="t7jbhf7" id='G5CbG'><tfoot id='G5CbG'></tfoot><dl id='G5CbG'><fieldset id='G5CbG'></fieldset></dl></div>
                          • <small id='G5CbG'></small><noframes id='G5CbG'>

                          • 主站蜘蛛池模板: 蜘蛛车-登高车-高空作业平台-高空作业车-曲臂剪叉式升降机租赁-重庆海克斯公司 | 北京租车公司_汽车/客车/班车/大巴车租赁_商务会议/展会用车/旅游大巴出租_北京桐顺创业租车公司 | 北京燃气公司 用户服务中心 | 成都网站建设制作_高端网站设计公司「做网站送优化推广」 | 纳米二氧化硅,白炭黑,阴离子乳化剂-臻丽拾科技 | 气弹簧定制-气动杆-可控气弹簧-不锈钢阻尼器-工业气弹簧-可调节气弹簧厂家-常州巨腾气弹簧供应商 | 仪器仪表网 - 永久免费的b2b电子商务平台 | 根系分析仪,大米外观品质检测仪,考种仪,藻类鉴定计数仪,叶面积仪,菌落计数仪,抑菌圈测量仪,抗生素效价测定仪,植物表型仪,冠层分析仪-杭州万深检测仪器网 | 联系我们老街华纳娱乐公司官网19989979996(客服) | 耐酸碱胶管_耐腐蚀软管总成_化学品输送软管_漯河利通液压科技耐油耐磨喷砂软管|耐腐蚀化学软管 | 不锈钢轴流风机,不锈钢电机-许昌光维防爆电机有限公司(原许昌光维特种电机技术有限公司) | 防火窗_耐火窗_防火门厂家_防火卷帘门-重庆三乐门业有限公司 | 剪刃_纵剪机刀片_分条机刀片-南京雷德机械有限公司 | 北京晚会活动策划|北京节目录制后期剪辑|北京演播厅出租租赁-北京龙视星光文化传媒有限公司 | 订做不锈钢_不锈钢定做加工厂_不锈钢非标定制-重庆侨峰金属加工厂 | 瓶盖扭矩仪(扭力值检测)-百科| 钢格板|镀锌钢格板|热镀锌钢格板|格栅板|钢格板|钢格栅板|热浸锌钢格板|平台钢格板|镀锌钢格栅板|热镀锌钢格栅板|平台钢格栅板|不锈钢钢格栅板 - 专业钢格板厂家 | 直流大电流电源,燃料电池检漏设备-上海政飞 | 次氯酸钠厂家,涉水级次氯酸钠,三氯化铁生产厂家-淄博吉灿化工 | 美的商用净水器_美的直饮机_一级代理经销商_Midea租赁价格-厂家反渗透滤芯-直饮水批发品牌售后 | 土壤有机碳消解器-石油|表层油类分析采水器-青岛溯源环保设备有限公司 | 光纤测温-荧光光纤测温系统-福州华光天锐光电科技有限公司 | 全自动五线打端沾锡机,全自动裁线剥皮双头沾锡机,全自动尼龙扎带机-东莞市海文能机械设备有限公司 | ★济南领跃标识制作公司★济南标识制作,标牌制作,山东标识制作,济南标牌厂 | 采暖炉_取暖炉_生物质颗粒锅炉_颗粒壁炉_厂家加盟批发_烟台蓝澳采暖设备有限公司 | 细石混凝土泵_厂家_价格-烟台九达机械有限公司 | 波纹补偿器_不锈钢波纹补偿器_巩义市润达管道设备制造有限公司 | 安徽合肥项目申报咨询公司_安徽合肥高新企业项目申报_安徽省科技项目申报代理 | 百方网-百方电气网,电工电气行业专业的B2B电子商务平台 | 深圳律师咨询_深圳律师事务所_华荣【免费在线法律咨询】网 | 中医中药治疗血小板减少-石家庄血液病肿瘤门诊部 | 北京印刷厂_北京印刷_北京印刷公司_北京印刷厂家_北京东爵盛世印刷有限公司 | 飞扬动力官网-广告公司管理软件,广告公司管理系统,喷绘写真条幅制作管理软件,广告公司ERP系统 | 河南橡胶接头厂家,河南波纹补偿器厂家,河南可曲挠橡胶软连接,河南套筒补偿器厂家-河南正大阀门 | 电动球阀_不锈钢电动球阀_电动三通球阀_电动调节球阀_上海湖泉阀门有限公司 | 金属雕花板_厂家直销_价格低-山东慧诚建筑材料有限公司 | 清水-铝合金-建筑模板厂家-木模板价格-铝模板生产「五棵松」品牌 | 包装盒厂家_纸盒印刷_礼品盒定制-济南恒印包装有限公司 | DDoS安全防护官网-领先的DDoS安全防护服务商 | 铝合金线槽_铝型材加工_空调挡水板厂家-江阴炜福金属制品有限公司 | 带锯机|木工带锯机圆木推台锯|跑车带锯机|河北茂业机械制造有限公司| |