Giter VIP home page Giter VIP logo

db's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

db's Issues

Should be compatible with ArrayAccess::offset

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>

Charset

I have issues on some Turkish character like (ı,ü,ğ) t how can I set charset to fix problem ?

Array to string conversion error

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.

how to add Views counter ?

hello thanks for class but i want add Views counter
db->update('users',['last_id' => last_id+1])->where([['id_user','=',$id_user]])->exec();

Update breaks when ID has more than one digit

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

Update statement with different id column not working

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

java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $

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" => ""
]
];

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.