Questions tagged [meekro]

MeekroDB is a PHP MySQL library that lets you get more done with fewer lines of code, and prevents SQL injection.

MeekroDB is an open-source PHP MySQL library that lets you get more done with fewer lines of code.

Most web apps will only ever talk to one database. This means that passing $db objects to every function of your code just adds unnecessary clutter. The simplest approach is to use static methods such as DB::query(), and that's how MeekroDB works. Still, if you need database objects, MeekroDB can do that too.

23 questions
3
votes
1 answer

MeekroDB and PDO query return associative array with ONLY strings

I have the following code on a PHP script: $DB = new MeekroDB($host, $user, $pass, $dbIntra, $port, $encoding); $DB->throw_exception_on_error = true; $DB->error_handler = false; $DB->throw_exception_on_nonsql_error = true; $result =…
supercoco
  • 512
  • 2
  • 7
  • 25
2
votes
1 answer

Insert HTML from TinyMCE using MeekroDB

I'm creating a form that has a text area that uses TinyMCE. When the form is submitted, the form sends the information using POST to a PHP script. In that PHP, I'm trying to store the information from the TinyMCE in a database using MeekroDB. The…
Alexandre Cristo
  • 341
  • 3
  • 16
2
votes
0 answers

Meekro DB query

What would be the equivalent query in Meekro DB to this working one I have?: $sql = "DELETE FROM data WHERE date < DATE_SUB(NOW(), INTERVAL 2 WEEK)"; Not working query: DB::delete('data', "date=%s", '(NOW() - INTERVAL 2 WEEK)');
SteveT
  • 21
  • 1
2
votes
1 answer

MeekroDB error "Commands out of sync; you can't run this command now"

I have a PHP script with the following lines: require_once 'meekrodb.2.1.class.php'; DB::$user = 'usr'; DB::$password = 'pwd'; DB::$dbName = 'db'; DB::$encoding = 'utf8'; $results = DB::queryFirstField(" CALL getSequence('time_id', %i); //…
supercoco
  • 512
  • 2
  • 7
  • 25
1
vote
0 answers

Read Excel with PHPExcel and insert array with MeekroDB

I'm getting a list of columns from an Excel with PHPExcel, so far everything is fine, I can get the array and see the data on screen, even the columns that interest me and omitting the first rows, the problem is that I can not insert these array…
David Noriega
  • 153
  • 1
  • 11
1
vote
1 answer

Sum available quantities in stock with meekro library

Table: stock ╔═════════════╦═══════════════════╦══════════╦═══════════════╗ ║ id ║ product_id ║ store_id ║ quantity ║ ╠═════════════╬═══════════════════╬══════════╬═══════════════╣ ║ 1 ║ 1 ║ 1 …
David Noriega
  • 153
  • 1
  • 11
1
vote
1 answer

Is there any proper way to escape array without brackets in MeekroDB?

I want to write query like this in MeekroDB: SELECT * FROM `tablename` WHERE `id` IN (3,1,2) ORDER BY FIELD (`id`,3,1,2) And I expect it to work like this in meekro: $possible_ids = array(1,2,3); DB::query('SELECT * FROM `tablename` WHERE `id` IN…
Denis Sheremet
  • 2,453
  • 2
  • 18
  • 34
1
vote
1 answer

MeekroDB - how to safely pass ORDER BY field names and arguments?

I am using MeekroDB in a PHP project. For some queries, I need to pass arbitrary field names to sort by. There are NO examples of ORDER BY clauses on the meekro site. How can I safely pass field names and avoid SQL injection vulnerabilities? I…
Ryan Griggs
  • 2,457
  • 2
  • 35
  • 58
1
vote
2 answers

PHP - include_once/include not working

I'm working on a very simple CMS system for a school project, and I'm having a bit of trouble. Right now, my webpage is set up as so: Every webpage that I create that a user can access - at the top and bottom, I have an include_once(header.php) and…
1
vote
3 answers

php not functioning inside html file but works outside

I have been following the php tutorial here CODE Here is my html file:
Greg Peckory
  • 7,700
  • 21
  • 67
  • 114
0
votes
0 answers

Parse error: syntax error, unexpected ''db.class.php'' (T_CONSTANT_ENCAPSED_STRING) in D:\wamp64\www\New folder\postForm.php on line 4

I have a problem with my site which is still in the local stage Error text Parse error: syntax error, unexpected ''db.class.php'' (T_CONSTANT_ENCAPSED_STRING) in D:\wamp64\www\New folder\postForm.php on line 4 Code text >
0
votes
1 answer

SELECT COUNT with meekrodb Uncaught MeekroDBException

I would like to count the number of nums in a table from the associated idnr. However, I get the following error message: Fatal error: Uncaught MeekroDBException: If you use named args, you must pass an assoc array of args! The table looks like…
user9554121
  • 17
  • 1
  • 7
0
votes
1 answer

MeekroDB - White spaces are removed with "%s" placeholder

I'm new to MeekroDB. I have this line: DB::query("INSERT INTO order (id, state) VALUES (%i, %s)", $id, $state); where for example $state = "order paid and delivered". The problem is that when I execute the query and then go to look in the database,…
Matt
  • 25
  • 7
0
votes
0 answers

Extract XML information and insert into database with PHP

Currently I have the following code, what I do is extract information from an XML, then I generate a CSV to be imported into my database manually. But I'm thinking about the possibility of avoiding generating the CSV file and better automatically…
David Noriega
  • 153
  • 1
  • 11
0
votes
0 answers

meekro db, json and ajax

I am using meekro db to fetch data from database and when I return object as json format then ajax call goes to error $(".cat").click(function() { var value = $(this).attr('id'); $.ajax({ url:"/psl/ajax/get_words.php", …
1
2