catfan / Medoo

The lightweight PHP database framework to accelerate the development.
https://medoo.in
MIT License
4.84k stars 1.15k forks source link

Faster Migrate to Medoo From Conventional #1107

Closed JFOC closed 11 months ago

JFOC commented 11 months ago

Hi,

IS there way for faster migration method to Medoo?

I have a lot of codes still using conventional __mysqli_query__ mostly (99%) is SELECT operation and no LEFT/RIGHT JOIN with none of them mysqli_real_escape_string

catfan commented 11 months ago

Well, you can use ChatGPT to do that:

Prompt:

Convert this MySQL query with Medoo:
$mysqli->query("SELECT Name FROM City LIMIT 10")

ChatGPT Result:

$columns = ['Name'];
$limit = 10;

$results = $database->select('City', $columns, ['LIMIT' => $limit]);

foreach ($results as $result) {
    // Process each row in $result
    echo $result['Name'] . '<br>';
}
JFOC commented 11 months ago

thats brilliant 😅 probably you can add chatgpt features on medoo for everyone who want converting the query, but that out the scope of Medoo