mareimorsy / db Goto Github PK
View Code? Open in Web Editor NEWSimple PHP Query Builder class
Simple PHP Query Builder class
هل المكتبة تدعم
select * from table where name in (val1,val2)
Is there any way to use Like, Having anf Grouy By ?
all pagination systems depend on getting last group of items then go to the old one but your class do the opposite
please fix.
Thanks
I got this message when I use the Class:
<br/>
<b>Deprecated</b>
: Return type of MareiCollection::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in <b>C:\laragon\www\operations\php\MareiDB-1.0\db.php</b>
on line <b>820</b>
<br/>
<br/>
<b>Deprecated</b>
: Return type of MareiCollection::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in <b>C:\laragon\www\operations\php\MareiDB-1.0\db.php</b>
on line <b>828</b>
<br/>
<br/>
<b>Deprecated</b>
: Return type of MareiCollection::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in <b>C:\laragon\www\operations\php\MareiDB-1.0\db.php</b>
on line <b>781</b>
<br/>
<br/>
<b>Deprecated</b>
: Return type of MareiCollection::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in <b>C:\laragon\www\operations\php\MareiDB-1.0\db.php</b>
on line <b>824</b>
some help to make a @backup of the database
I have issues on some Turkish character like (ı,ü,ğ) t how can I set charset to fix problem ?
Parse error: syntax error, unexpected 'list' (T_LIST), expecting identifier (T_STRING) in C:\xampp\htdocs\test\DB.php on line 800
Hi, every query that I try to execute get to me this Notice:
PHP Notice: Array to string conversion in /home/libraries/DB.php on line 511
Query work good, but always get me that error.
hello thanks for class but i want add Views counter
db->update('users',['last_id' => last_id+1])->where([['id_user','=',$id_user]])->exec();
If ID = 13 the update function will send 1 to the query.
If ID = 25 the function sends 2.
And so on
Thank you
EDIT
The issue is when ID is send as an array
$db->update(cliente, [ 'nome_cliente' => $nome_cliente, 'tel1' => $tel1, 'tel2' => $tel2, 'endereco' => $endereco ],$id);
Works fine
But
$db->update(cliente, [ 'nome_cliente' => $nome_cliente, 'tel1' => $tel1, 'tel2' => $tel2, 'endereco' => $endereco ],[$id]);
Doesn't
Hello, the following function wasn't working for me:
$db->updateCliente('cliente', [ 'nome_cliente' => $nome_cliente, 'tel1' => $tel1, 'tel2' => $tel2, 'endereco' => $endereco ],['id_cliente',1]);
So I used var_dump and got:
...UPDATE cliente SET nome_cliente = ?,tel1 = ?, te2l = ?, endereco = ? WHERE id = ?"...
The issue is that 'id' didn't chage to 'id_cliente'.
To fix that I copied the update function and manually changed line 241 from
$this->where .= "id = ?";
To
$this->where .= "id_cliente = ?";
Thank you
when I import my DB From a server to a localServer on my PC using XAMPP then I try to fetch data from DB using JSON Api and Retrofit I found that error
java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
My Api.php that is in C:\xampp\htdocs\
<?php
include 'DB.php';
$db = DB::getInstance();
header("Content-Type: application/json;charset=utf-8");
function UserLoginMethod($username , $password , $lat, $long){
global $db;
$sql = "SELECT * FROM users WHERE user_email = ? AND user_password = ?
LIMIT 1";
$user_info = $db->query($sql, [$username, $password]);
CheckIsEmpty($user_info);
//echo $db->getSQL();
echo PrintJSON($user_info[0]);
}
switch (@$_GET['function']) {
case "Login":
UserLoginMethod(@$_GET['user_email'], @$_GET['user_password'], $_GET['user_location_latitude'], $_GET['user_location_longitude']);
break;
}
function CheckIsEmpty($query) {
if (is_null($query)||empty($query)){
die (json_encode(array('error' => 'no items funded.'),JSON_FORCE_OBJECT));
}
}
function PrintJSON($q){
$j = json_encode($q);
if (count($j) > 0 && !is_null($q) )
return $j;
else
die (json_encode(array('error' => 'no items funded.'),JSON_FORCE_OBJECT));
}
function CreateDieError($body){
die (json_encode(array("error" => $body),JSON_FORCE_OBJECT));
}
?>
the current development environment in DB.php that is in C:\xampp\htdocs\
$db_config = [
//current development environment
"env" => "development",
//Localhost
"development" => [
"host" => "127.0.0.1",
"database" => "egydcom_family",
"username" => "root",
"password" => ""
],
//Server
"production" => [
"host" => "127.0.0.1",
"database" => "egydcom_family",
"username" => "root",
"password" => ""
]
];
Parse error: syntax error, unexpected 'list' (T_LIST), expecting identifier (T_STRING) in /home/u489986511/public_html/DB.php on line 800
I'm not php developer this could be a simple issue but please refer back if I'm wrong.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.