Questions tagged [medoo]

A lightweight PHP framework for dealing with database interaction

Medoo is lightweight single file framework, optimized for higher performance to increase the development and user experience for PHP development projects with SQL database need.

It supports following php_pdo Extensions:

  • MySQL, MariaDB - php_pdo_mysql
  • MSSQL (Windows) - php_pdo_sqlsrv
  • MSSQL (Liunx/UNIX) - php_pdo_dblib
  • Oracle - php_pdo_oci
  • SQLite - php_pdo_sqlite
  • PostgreSQL - php_pdo_pgsql
  • Sybase - php_pdo_dblib

It requires php_pdo_xxx extension to be enabled and recommends PHP 5.4+ with PDO support. However it works with PHP 5.1+

92 questions
3
votes
1 answer

Best way to avoid specific values, when extracting from database?

The Problem Ignoring specific values, when arrays are pulled, using medoo, and merged. The Details Say I have two arrays, created from two similar tables. They have a 'user'-row and an 'id'-row. Example below: id name ------- --------- …
eengstroem
  • 143
  • 1
  • 9
3
votes
1 answer

Medoo SQL IN or similar functionalty

I have a Type column in my database, which contains the entity type, from a set of defined strings. How can I make a query like: SELECT * FROM "Table" WHERE "Type" IN ('a','b','c'); The IN condition doesn't seem to be supported by Medoo, and even a…
Mkoch
  • 1,994
  • 2
  • 13
  • 21
3
votes
2 answers

Joining tables with Medoo (MySQL)

I'm not too familiar with databases and I've run into a situation where I have to use a join. products table: ╔════════════╦═════════╦═════════════════╗ ║ product_id ║ MPN ║ manufacturer_id ║ ╠════════════╬═════════╬═════════════════╣ ║ …
eozzy
  • 66,048
  • 104
  • 272
  • 428
3
votes
2 answers

LIKE operator in medoo

How can i use LIKE operator in this sql statement using medoo framework? Original SQL statement: SELECT id,name FROM table WHERE name LIKE %'foo'% medoo statement: $data=$db->select('table', ['id','name'], ['AND' => ['name' => 'foo'] …
Hechi
  • 281
  • 4
  • 14
3
votes
1 answer

table joining using medoo returning false instead of the data

I'm trying to join two tables using MEDOO, the problem Im facing is that the query I'm building is not returning any data (it's returning false). I've done the query following this normal SQL code select posts.id, title, extract, img_principal,…
cancelajavi
  • 151
  • 6
3
votes
3 answers

Am I handling query errors correctly in Medoo Framework?

I'm using Medoo Framework to handle my database queries. It is basically a PDO wrapper, I didn't find in their documentation how to handle errors or check the result, sometimes it return empty array, sometimes FALSE sometimes 0 etc. As I couldn't…
Vladimir
  • 1,602
  • 2
  • 18
  • 40
3
votes
2 answers

I can't add OR operator inside my sql query

My code look like this: $database->update($campaign_table, $data_nga_posti , array("AND" => ["codice_pod" => $data_nga_posti['codice_pod'],("codice_pdr" =>NULL) ])); So this is when my query execute: UPDATE `field` SET `columnname` =…
Mr Alb
  • 291
  • 2
  • 4
  • 16
2
votes
1 answer

SQLite JOIN WHERE not in multiple tables

Im using sqlite and have the following schema and table data "CREATE TABLE numbers ( id INTEGER PRIMARY KEY AUTOINCREMENT, cli INTEGER UNIQUE );" "CREATE TABLE allocated ( did_id INTEGER, cli INTEGER UNIQUE, client_id…
moimoi
  • 171
  • 1
  • 7
2
votes
1 answer

INSERT by ANSI_QUOTES mode

I'm having a problem trying to do an INSERT, it's succeeding even though it shouldn't. My table structure: Note: given1, given2 and given3 are required fields. In my application I execute the following method…
2
votes
2 answers

Medoo Limit not working

I have faced an unexpected problem 'mysql', 'database_name' => '************', …
123php
  • 307
  • 1
  • 4
  • 17
2
votes
0 answers

PDO returns "SQLSTATE [HY000]: General Error: 10 Disk I/O error" on sqlite database load

A bit about my current setup, The website is hosted on a windows server 2012 IIS with PHP 7.1, the site runs using Laravel with Medoo to load the database, however on any form of SQL statement the code fails with the error mentioned in the…
Phratzz
  • 21
  • 4
2
votes
0 answers

PostgreSQL Upsert with Medoo

I am using PostgreSQL with PHP, and i want to use Upsert with Medoo, Right now i am using query() function like this: $data = $database->query("MY UPSERT QUERY")->fetchAll(); I want to create a function in Medoo for Upsert, Any idea for it?
HarisH Sharma
  • 1,101
  • 1
  • 11
  • 38
2
votes
2 answers

how can I search json in mysql via medoo library?

I have a column in a mysql DB with this json content: {"section2":"303","section1":"302","section0":"301"} I use Medoo library. How can I search section1, section2, section3 in DB? $database->select('Article', "*",[ …
elize
  • 435
  • 1
  • 8
  • 19
2
votes
1 answer

Get all topics from my forums their sub-forums in medoo

I'm trying to get all the topics from my forum and the sub-forums in it. However, for some reason, my code doesn't work properly. It doesn't give me any errors, but it shows wrong information. I am using the medoo. Here is my function: public…
2
votes
1 answer

How to select user with more conditions

I have a database model, which stores user in groups and for each group are other rights. The structure is shown on image. I want to make a SELECT query, which return user(s) which have one or more rights. Im using medoo public function…
Bullman
  • 318
  • 1
  • 4
  • 13
1
2 3 4 5 6 7