Mysql无法识别存储过程中的字段名称

时间:2017-03-28 22:35:17

标签: php mysql stored-procedures mysqli

我正在尝试创建一个存储过程,用户可以在前端选择如何对从mysql中提取的数据进行分组。但是由于某些原因,当我尝试执行查询时,MySql返回错误:

  

查询错误(exportEntries):未知列' NumeroProducto'在'字段列表'

我通过使用一些错误处理代码($ mysqli->错误)来解决此错误。

这是我用来在PHP中调用存储过程的代码:

xargs

这就是我的MySql存储过程的样子:

sed

function checkDistance(lat1,lon1,lat2,lon2) { var R = 6371; // Radius of the earth in km var dLat = deg2rad(lat2-lat1); // deg2rad below var dLon = deg2rad(lon2-lon1); var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLon/2) * Math.sin(dLon/2) ; var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); var d = R * c; // Distance in km return d; } function deg2rad(deg) { return deg * (Math.PI/180) } var fixedlat = 51.714236; var fixedlon = 50.710236; var miles = 20; var distanceLimit = miles * 1.6; //(km) var data = [ { "name": "Paul Brooks", "location": { "lat": 51.714236, "lon": 50.710236 } }, { "name": "Jason Orange", "location": { "lat": 52.030778298795856, "lon": 0.364888567109396 } }, { "name": "Mark Way", "location": { "lat": 53.41899784623413, "lon": -1.9138465628943413 } }, { "name": "Ben Bon", "location": { "lat": 52.30976192959104, "lon": -0.4014670363034498 } }, { "name": "Chris Col", "location": { "lat": 53.45301856182801, "lon": -1.8765834388107732 } }, { "name": "Von Van", "location": { "lat": 53.82771812914788, "lon": -0.7563793003592991 } } ]; for(var i = 0;i < data.length;i++){ var result = checkDistance(fixedlat,fixedlon,data[i].location.lat,data[i].location.lon); if(result <= distanceLimit){ var resultList = document.getElementById('resultList'); resultList.append(data[i].name + ', '); } }中包含的值为<div id="resultList"></div>,我也尝试使用该字段的实际值:$client = "CLT_6840"; $planta = $_GET['planta']; $agrupacion = $_GET['agrupadoPor']; $qry = "CALL exportEntradas('$cliente','$planta', $agrupacion)"; $stmt = $db->prepare($qry) or die('Prepare error (exportEntries): ' . $db->error); $stmt->bind_param('sss', $cliente, $planta, $agrupacion ); $stmt->execute() or die('Execute error (entradas_generales): ' . $db->error);

正如您所看到的,字段名称确实存在。知道为什么会发生这种情况..而且......我怎么能纠正它?

0 个答案:

没有答案