K
K
Konstantin2018-11-14 02:47:57
Laravel
Konstantin, 2018-11-14 02:47:57

How to write unwrapped queries in Laravel?

How to write queries in Laravel without Eleoquant wrapper? And to write the pure requests, parametrized?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
B
bhu, 2018-11-15
@bhu

$link = mysqli_connect(
    'localhost',
    'user',
    'password',
    'world'
);

if (!$link) {
    printf("Невозможно подключиться к базе данных. Код ошибки: %s\n", mysqli_connect_error());
    exit;
}

if ($result = mysqli_query($link, 'SELECT Name, Population FROM City ORDER BY Population DESC LIMIT 5')) {

    print("Очень крупные города:\n");

    while( $row = mysqli_fetch_assoc($result) ){
        printf("%s (%s)\n", $row['Name'], $row['Population']);
    }

    mysqli_free_result($result);
}

mysqli_close($link);

}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question