From: | Ramesh K |
Sent on: | Monday, July 25, 2016, 10:21 AM |
How can I use this in handsontable sir.?
Hey Ramesh,For the following code to work, you'll need to create a couple of define() statements for DSN, DB_USER, DB_PASS
Each framework (WordPress vs Laravel vs Zend ) has it's own way of connecting to databases and running queries. Here is a simple way to do it outside of a framework.//
class RameshApp {
/** PDO database connection */
protected $dbh;
public function __construct( PDO $db ) {
$this->dbh = $db;
}
public function getStudentNames() {
$sql = "SELECT id, first_name, last_name FROM student";
$sth = $this->dbh->prepare( $sql );
$sth->execute();
$result = $sth->fetchAll();
return $result;
}
}
$pdo = new PDO( DSN, DB_USER, DB_PASS );
$app = new RameshApp( $pdo );
$names = $app->getStudentNames();
print_r( $names );On Mon, Jul 25, 2016 at 8:31 AM, Ramesh K <[address removed]> wrote:how can i show a dropdown in handsontable with values already stored in database.
for example, am having a certain students name in db. now want to show all student name in dropdown which is saved in db using class.
please help...am just a beginner
--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Meetup on behalf of Ramesh K from Seattle PHP User Group.
To report this message or block the sender, please click here
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages
Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]
--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Meetup on behalf of Andrew from Seattle PHP User Group.
To report this message or block the sender, please click here
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages
Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]