简体   繁体   中英

Php grid lite. Can't view mysql data in datatable

I have one problem with php grid(PHP grid made easy) lite version. In this code :

header('Content-Type: text/html; charset=utf-8');
require_once('Grid/conf.php');
$cn = mysql_connect(PHPGRID_DB_HOSTNAME,PHPGRID_DB_USERNAME,PHPGRID_DB_PASSWORD) or     die(mysql_error());
mysql_set_charset('utf8', $cn);
mysql_select_db(PHPGRID_DB_NAME);
$result = mysql_query("call select_marks('zura1547','zuda2008','name','family')") or die(mysql_error());
$i = 0;
while($row = mysql_fetch_array($result) or die(mysql_error()))
{
     echo '<p>';
     while(isset($row[$i]))
     {
         echo ' '.$row[$i].' ';
     }
     $i = 0;
     echo '</p>';
}

This code works But this doesn't:

$dg1 = new C_DataGrid("call select_marks('zura1547','zuda2008','name','family')");
$dg1 -> enable_search(true);
$dg1->display();

When I sat PHP grid in debug mode it says:

PHPGRID_DEBUG: C_Database->_33546FD8A5E317F367D19D36B7B873B8() - Commands out of sync; you can't run this command now .

This is MySQL script:

DELIMITER $$

CREATE DEFINER=`zura1998a`@`localhost` PROCEDURE `Select_Marks`(UserName varchar(30),Pass varchar(30),FirstName varchar(30),FLastName varchar(40))
BEGIN
       Set @istrue = ConfimHashSalt(UserName,Pass);
       IF(@istrue = 'Valid') then

       Select * from `view_marks` where `Name` = FirstName and `LastName` = FLastName;

       end if;

END

Please help.

Does your CALL() cause multiple result sets?

You cannot execute multiple stored procedures with mysql_query

The mysql_ functions are deprecated and not supported.

Try using the mysqli or PDO extensions instead of the old mysql_ functions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM