PHP错误mysqli_real_escape_string()....在注册表单上

时间:2017-05-30 08:25:53

标签: php

我一直试图解决我遇到的这个问题,但我无法弄清楚如何。这是我目前的代码:

mysqli

不幸的是,这给了我4个完全相同的错误:

  

class Solution{ public static void main(String []argh){ Scanner in = new Scanner(System.in); int n = in.nextInt(); for(int i = 0; i < n; i++){ String name = in.next(); int phone = in.nextInt(); // Write code here } while(in.hasNext()){ String s = in.next(); // Write code here } in.close(); } } 期望参数1为 <b>Number of items</b> (between 2 and 50): <input type="number" name="numbItem" min="2" max="50" id="numbItem"> &nbsp&nbsp <button id='createItem' type="button">Create</button> <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script> <script type="text/javascript"> document.getElementById("createItem").onclick = function() { var numItems= document.getElementById("numbItem").value; //alert (price); //alert (numItems + " items created.") if (numItems < 2) { alert("Can't create just 1 Item;" + "\n" + "Please make sure to enter a number betwen 2 and 50."); document.body.innerHTML = ""; // Clear Screen document.location.reload(); // Refresh Page } else if (numItems > 50) { alert("Can't create more than 50 Items;" + "\n" + "Please make sure to enter a number betwen 2 and 50."); document.body.innerHTML = ""; // Clear Screen document.location.reload(); // Refresh Page } else { alert(numItems + " Items being created. . ."); } }; </script> <div id=userForms></div> <br> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="sumValue" id="sumValueId" readonly style="background:#bdf584" size="13"> <input type="submit" value="Sum" id="btnSumValueId"> &nbsp&nbsp<input type="text" name="sumTaxe" id="sumTaxeId" readonly style="background:#bdf584" size="13"> <input type="submit" value="Sum" id="btnSumTaxeId"> &nbsp&nbsp&nbsp&nbsp<input type="submit" value="Get Totals" id="btnGetTotals" style="width: 140px; position: absolute; left: 550x;"> <br><br>Total Monthly Expenditure&nbsp&nbsp<input type="text" name="totalExpend" id="totalExpValueId" readonly style="background:#bdf584" size="13"> <input type="submit" value="Total" id="btnTotalExpValueId"> <br><br>Effective Tax Rate as %&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="EffectivTaxRate" id="EffectivTaxRateId" readonly style="background:#bdf584" size="13"> <input type="submit" value="Total" id="btnEffectivTaxRateId"> <script type="text/javascript"> $( document ).ready(function() { console.log( "ready!" ); $( "#createItem" ).click(function() { var totalRows = $('#numbItem').val(); var formHtml = ''; for (var i = 1; i <= totalRows; i++) { formHtml += '&nbsp;<input type="text" name="item'+i+'" placeholder="E.g.: Gross Salary" />&nbsp;&nbsp;<input type="text" name="value'+i+'" placeholder="E.g.: 12000" id="ValueId'+i+'"/>&nbsp;&nbsp;<input type="text" name="tax'+i+'" value="" readonly style="color:#f00;background:#ccc" id="TaxeId'+i+'">&nbsp;&nbsp;<input type="number" name="vat'+i+'" min="0" max="100" id="VatId'+i+'">&nbsp;&nbsp;<input name="btnItem'+i+'" value="Calculate" type="button" id="btnCalcId'+i+'"><br><br>'; } $('#userForms').html(formHtml); }); }); $('#btnGetTotals').bind('click', function() { student(); }); $('#btnGetTotals').bind('click', function() { calculate(); }); function calculate(){ //alert("Good Morning"); //alert('FRONT !!!'); var total = 10; for( var i = 3; i <= 50; i++ ) { var val = parseInt(document.getElementById("ValueId" + i).value); //alert(document.getElementById("ValueId" + i).value); document.getElementById("ValueId" + i).value; if(val>0) { total += val; } document.getElementById("sumValueId").value = total; } } function student(){ //alert("Hi my name is Sunny"); //alert('FRONT !!!'); var total1 = 55; for( var i1 = 2; i1 <= 50; i1++ ) { var val1 = parseInt(document.getElementById("TaxeId" + i1).value); //alert(document.getElementById("ValueId" + i).value); document.getElementById("TaxeId" + i1).value; if(val1>0) { total1 += val1; } document.getElementById("sumTaxeId").value = total1; } } </script> </body>,在....中给出为空

你们中的任何一个人能够解决这个问题吗?非常感谢!

1 个答案:

答案 0 :(得分:0)

首先检查$ con

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

$username = mysqli_real_escape_string($con, $username);
echo $username;