返回时间mysql php jquery
我有以下问题。我在MySql数据库中有一个表,其中有一些时间列,一周中的每一天有两个。当我试图从php查询中读取表中的数据时,我有一个错误,但是如果我复制查询并将其执行到phpMyAdmin中,查询会给出结果 错误消息是 警告:mysqli_free_result()要求参数1为mysqli_result, 在 我尝试使用date_格式格式化结果(这里是结果值,,'H:I:s'),但它不起作用 代码如下: Javascript:返回时间mysql php jquery,php,jquery,mysql,Php,Jquery,Mysql,我有以下问题。我在MySql数据库中有一个表,其中有一些时间列,一周中的每一天有两个。当我试图从php查询中读取表中的数据时,我有一个错误,但是如果我复制查询并将其执行到phpMyAdmin中,查询会给出结果 错误消息是 警告:mysqli_free_result()要求参数1为mysqli_result, 在 我尝试使用date_格式格式化结果(这里是结果值,,'H:I:s'),但它不起作用 代码如下: Javascript: var area_id = $('#slkt_areas').va
var area_id = $('#slkt_areas').val();
if(area_id != 0)
{
$.post("libs/php/jquery/cfg/get_distinct_areas_info.php",{
area: area_id
},
function(data)
{
if(data!= '')
{
var resultado = data.split('&:&');
var largo = resultado.length;
var link_genera_qr='';
var contador = 0;
$('#txtbx_nombre').val(resultado[contador]); //nombre
$('#txtbx_abbref').val(resultado[contador+1]); //letra
$('#txtbx_rut option[value='+ resultado[contador+3] +']').attr("selected",true); //rut obligatorio
$('#icons_final_imagen').html('<center><img src="' + resultado[contador+4] + '" alt="" style="height:80px;"/></center>');
$('#txtbxhid_iconsimage').val(resultado[contador+4]);
$('#txtbx_cantmodulos').val(resultado[contador+5]);
$('#txtbxhid_id').val(resultado[contador+6]);
$('#rel_user_qr').html(resultado[contador+8]); // url
$('#slkt_status option[value=' + resultado[contador+7] +']').attr("selected",true);//estado
$('#mon_start').val(contador+9);
$('#mon_end').val(contador+10);
$('#tue_start').val(contador+11);
$('#tue_end').val(contador+12);
$('#wed_start').val(contador+13);
$('#wed_end').val(contador+14);
$('#thu_start').val(contador+15);
$('#thu_end').val(contador+16);
$('#fri_start').val(contador+17);
$('#fri_end').val(contador+18);
$('#sat_start').val(contador+19);
$('#sat_end').val(contador+20);
$('#sun_start').val(contador+21);
$('#sun_end').val(contador+22);
}
}
)
}
MySql中的存储过程
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_get_area_dataById`(IN var_id int)
BEGIN
select
`id`,
`name`,
abbref,
imagen,
rut_obligatorio,
icon_image,
qty_modulos,
status_id,
mon_start as 1_start,
mon_end as 1_end,
tue_start as 2_start,
tue_end as 2_end,
wed_start as 3_start,
wed_end as 3_end,
thu_start as 4_start,
thu_end as 4_end,
fri_start as 5_start,
fri_end as 5_end,
sat_start as 6_start,
sat_end as 6_end,
sun_start as 7_start,
sun_end as 7_end
from
areas
where
id= var_id;
END
这是Retrona方法:
public function retorna($qString){
$this->qString = $qString;
$this->conectar();
$data = array();
$this->resultado = $this->ejecutar($qString);
while($row = mysqli_fetch_object($this->resultado))
$data[]= $row;
$this->cerrar();
return $data;
}
谁能帮帮我吗
非常感谢您的PHP查询是什么样子的,您是否将mysql与mysqli语句混合在一起?嗯。。。我附上了一个演示查询的代码。你能发布你的Retrona方法代码吗?是的。我用这个方法更新了我的问题。看起来你的代码中可能也有sql注入漏洞,与其他问题无关。你的PHP查询是什么样子的,你是在混合mysql和mysqli语句吗?嗯。。。我附上了一个演示查询的代码。你能发布你的Retrona方法代码吗?是的。我用这个方法更新了我的问题。看起来您的代码中也可能存在sql注入漏洞,这与其他问题无关。
public function retorna($qString){
$this->qString = $qString;
$this->conectar();
$data = array();
$this->resultado = $this->ejecutar($qString);
while($row = mysqli_fetch_object($this->resultado))
$data[]= $row;
$this->cerrar();
return $data;
}