Questions tagged [ezsql]

ezSQL is an open-source PHP database class that features a simplified and concise syntax for calling MySQL, Oracle 8/9, InterBase/FireBird, PostgreSQL, SQL Server, and SQLite / SQLite C++ functions within your PHP script.

ezSQL is an open source PHP database class that makes it ridiculously easy to use MySQL, Oracle 8/9, InterBase/FireBird, PostgreSQL, SQL Server, and SQLite / SQLite C++ within your PHP script.

  • It is one PHP file that you include at the top of your script. Then, instead of using standard PHP database functions listed in the PHP manual, you use a much smaller (and easier) set of ezSQL functions.
  • It automatically caches query results and allows you to use easy to understand functions to manipulate and extract them without causing extra server overhead
  • Most ezSQL functions can return results as objects, associative arrays, or numerical arrays

Examples:

Select multiple records from the database and print them out..

$users = $db->get_results("SELECT name, email FROM users");

foreach ( $users as $user )
{
    // Access data using object syntax
    echo $user->name;
    echo $user->email;
}

Get one variable from the database and print it out..

$var = $db->get_var("SELECT count(*) FROM users");
echo $var;
45 questions
0
votes
1 answer

How do I keep ezSQL connection alive?

I am using ezSQL in a script that is running in a loop for days, possibly weeks. The connection is defined and created outside of the loop. However when a long time passes I get this MySQL error: MySQL server has gone away I guess mysql has…
emorling
  • 147
  • 1
  • 2
  • 11
0
votes
2 answers

php CRUD passing parameters

I'm working on a php service. I'd like to pass an object with the parameters to use in the "where" clause and also the "order" and "limit" params. I'm wondering whether there is a standard way/library to make up the query based on the parameters…
Chin
  • 12,582
  • 38
  • 102
  • 152
0
votes
1 answer

why does ezSQL return empty resultset

I have been working on something which a friend asked me. He is using ezsql for his queries and i'm pretty new with it. Though i used it in the same project. Here is the database columns and data to see it clearly And the part of the code which…
Mustafa
  • 825
  • 3
  • 14
  • 37
0
votes
1 answer

ezSql with multiple queries

This is question, however: In a PHP file, I am running an ezSql command (http://justinvincent.com/ezsql): $_result = $db->get_var("CALL spcheck ('".$_var1."')"); then I have a if ($_result.. within that if, I have: $_logInsert = $db->query("CALL…
dpluscc
  • 590
  • 1
  • 8
  • 18
0
votes
1 answer

invalid data source name with PDO Sqlite

I'm having this error when trying to do a request from a PDO object (with ez_sql) on a sqlite database. I read here: http://us.php.net/manual/en/ref.pdo-sqlite.php that the db could be empty and that pdo will create automatically the db file. So i…
Leto
  • 2,594
  • 3
  • 24
  • 37
0
votes
1 answer

Using ezSQL functions from another file

Im using ezSQL in my PHP application and I have a problem. This is my structure config.php code: include_once "ez_sql_core.php"; include_once "ez_sql_mysql.php"; $db = new ezSQL_mysql('myuser','mypass','mydb','localhost'); index.php…
Klian
  • 1,520
  • 5
  • 21
  • 32
0
votes
2 answers

ezSQL check affected rows

With adodb i checked affected rows like this: $user_data = get_login_name($user_name, $password); //0 = id //1 = username //2 = password if (!$myDB->Affected_Rows($user_data[1], $user_data[2])) { echo "everything good"; } else { …
ZeroSuf3r
  • 1,961
  • 8
  • 25
  • 36
0
votes
1 answer

Each row is an object in adodb?

It's possible get each row as an object like in ezSQL? For example, ezSQL returns(print_r($sql): Array ( [0] => stdClass Object ( [click_time] => 2011-09-12 17:30:06 [referrer] => direct [user_agent] => Mozilla/5.0 …
ZeroSuf3r
  • 1,961
  • 8
  • 25
  • 36
0
votes
2 answers

how to get last_inserted_id in ezsql latest version 4?

Trying to get last inserted id using this line: $db->insert_id; but it doesn't return anything in the latest version of ezsql.
mfadel
  • 887
  • 12
  • 32
0
votes
1 answer

PHP Strict Standards: Declaration of ezSQL_mysql::escape() should be compatible with ezSQLcore::escape() in /home

i have problem about ezSQL_mysql and ezSQLcore, it may be an incompatible version of PHP, I share the code below. what version of Php should I use or what should I do to tailor mysqli? (my php version 5.6 ) codes…
0
votes
2 answers

prepared statement with ezsql

I find ezSQL library very useful but as far as I see there is no implementation of prepared statements in it, am I right? Or is there something I don't know? I have checked out the help file which I downloaded from http://justinvincent.com/ezsql For…
Adem Tepe
  • 564
  • 5
  • 10
0
votes
0 answers

mysql_fetch_array gives error in while [using ezSQL]

i am new in oAuth and ezSQL. $a = $db->get_results("SELECT * FROM xxx WHERE id "); $i=0; while ($b = mysql_fetch_array($a)) { $oauth_token[$i] = $b["oauth_token"]; $oauth_secret[$i] = $b["oauth_secret"]; $i++; } i have $db database and selected…
0
votes
0 answers

Thread Options MariaDB Sql Injection syntax to use near

I have tried sql injection my script. I have a problem in ezSQL. Original query $dbo->get_var("SELECT COUNT(*) FROM table WHERE id = '1'"); Injected Query $dbo->get_var("SELECT COUNT(*) FROM table WHERE id = '1'; SELECT * FROM table --…
Mehmet Ekici
  • 1
  • 1
  • 4
0
votes
1 answer

MariaDB server version for the right syntax to use near

I have a problem in ezSQL. Code: $dbo->query("INSERT INTO chart_logs (chart_id, uname, option_id) VALUES ('1', '1', '1'); INSERT INTO chart_logs (chart_id, uname, option_id) VALUES ('2', '2', '2'); "); Error: You have an error in your SQL syntax;…
Mehmet Ekici
  • 1
  • 1
  • 4
0
votes
1 answer

How to insert accented characters in PostreSQL using PHP and ezSQL?

Using PHP, the following string was generated INSERT INTO persons ("username","firstname") VALUES ('nino','Niño') but when tried to execute the statement at runtime like so:
Abel Callejo
  • 13,779
  • 10
  • 69
  • 84