Code

Discussion on PDOModel - Database abstraction and helper PHP class

Discussion on PDOModel - Database abstraction and helper PHP class

Cart 247 sales

ddeveloper supports this item

Supported

125 comments found.

Hi how i can use SUM ?? about the WHERE IN i have send you a email, but you still dont answer me. thanks

Hi,

I haven’t received your email. Please send me again using my profile. I will reply you immediately. Thanks

i sent again, waiting for your answer

Hi, I have replied to your email. Please check. Thanks

Dude, or i m crazy or it have alot of errors.

$pdomodel->where("Post_Id",$id,'<>'); $pdomodel->where("Post_Status",0); $pdomodel->openBrackets = "("; $pdomodel->where('Post_Cat',1); $pdomodel->andOrOperator = "OR"; $pdomodel->where('Post_Cat',2); $pdomodel->closedBrackets = ")"; $pdomodel->orderByCols = array("rand()"); $pdomodel->limit = "0,1"; $result = $pdomodel->select("posts");

this code was supost to return

Select * from posts where Post_Id <> ? AND Post_Status = 0  AND (Post_Cat = 1 OR Post_Cat = 2)

But this return

Select * from posts where Post_Id <> ? OR Post_Status = 0  OR (Post_Cat = 1 OR Post_Cat = 2)

What i m doing wrong?

hi,

I have used same code as you have sent me and it is generating me proper query

SELECT * FROM `posts` WHERE `Post_Id`<> ? AND `Post_Status`= ? AND ( `Post_Cat`= ? OR `Post_Cat`= ? ) ORDER BY `rand()` LIMIT 0,1 I think you have set the default value of andOrOperator = “or”. Please check andOrOperator ="or" instead of the andOrOperator ="and"

Please check.

i never have set the default operator. if you plan a update maybe create

$pdomodel->where(x=y); $pdomodel->and_where(x>y); $pdomodel->or_where(x<y);

select from aaa where x=y and x>y or x<y;

It has this functionality but it is done in another way. using the andoroperation setting. Thanks

Hi, $pdomodel->where(“user_id”, $array, “IN”); NOT work….

how i can user WHERE IN

thanks

Dont works for me

first, the query return like this select * from post where empIDIN – the IN gets together with the empID so i used to put a space ” IN” but still wont work for me, can you check with a big array?

Also check with a big array

Hi, I have checked it is working fine at my end. Please contact via profile. I will send you my copy of file again. Thanks

AGAIN, how order by rand () – i m still waiting for this answer – thanks.

Hi, for order by rand() to work, a small change will be required. You need to set backtick = ”” in the PDOModel.php file.I can send you file after required change if you want. Thanks

Hi!

I need to know how to close and reset all the database connections. Thanls!

Hi,

There is no connection close method in PDO. It is not required unless you explicitly want to do same. To do, just set your PDO object to false.

Please refer below stackoverflow question for more details.

http://stackoverflow.com/questions/15444748/is-it-necessary-to-close-pdo-connections
When i use Select method, the result is array, how i can print each value of the array or just get the value i need?
array(1) { [0]=> array(3) { ["Id"]=> string(1) "1" ["Status"]=> NULL ["User"]=> string(4) "name"}

echo $result[0]['User'] ; // cant be $result['User']

what else i need to do?

Hi,

Select query return result as array. You can loop array using foreach.

Here is example of running select query on a table //Example 1 $result = $pdomodel->select(“users”);//run select query foreach($result as $row){ $user_name = $row[“user_name”];//to get it in variable echo $user_name;//echo variable } //Example 2 //if you want to run query directly $sql = “select * from tablename”; $result = $pdomodel->executeQuery(sql); //run select query foreach($result as $row){ $user_name = $row[“user_name”];//to get it in variable echo $user_name;//echo variable }

Please let me know if you need any more information from my side. Thanks

I get the select only as arrays. What do i need to do, to get string and put variables in echo. The Documentation is very vague about that.

Hi, have you checked? Can you provide me now proper rating? Thanks

Youn piss me off. I already changed rating to 5. But because you annoy me i change it again.

I am really sorry but I didn’t got any message(email) for rating that’s why I have asked. Please change it. I will not send you any message further. Thanks a lot

How to order by ascending and descending?

$pdomodel->orderByCols = array(“firstName”); // asc

$pdomodel->orderByCols = array(“firstName desc”);// desc

http://demo.digitaldreamstech.com/PDOModel/documentation/pdo/select.php

Thanks

I like this.When a new version?

Hi, Thanks :) Please specify feature you want to see in new version. I will try to add that. Thanks

I love this! I am wondering if this is possible: When the select query returns only a single result, only return a 1-dimensional array with that row as the data, instead of a 2-dimensional array, this way I don’t need a foreach statement for just one row of data.

Hi, Ok..I will add this option in next version. Thanks :)

i want to search data by criteria in 8 fieldname simultaneously on the same tabe. below is the details. cenglish, cmathematics, cinscience,cstudies (Should filter between A-C ) egrade1,egrade2,egrade3,egrade4 (Should filter between A-D ) all in one query

You can create by adding multiple where clause with and and or operator. I am not able to see any purchase information with your account. Have you purchased it?

Hi dev, can i ask how can I increase the font size of excel output? also, is it possible to insert image, or better if it can support graphs? thanks :)

Hi, this script pass data to generate output in excel but to format excel data, you need to use some extra code. It is not possible with this script. Thanks

hi, just want to ask. how secure is your class? i.e. from sql injection? btw, this is really very helpful on my projects.

Hi, all queries are executed using parameter binding and prepared statement with PDO. It is sufficient to prevent sql injection. You can read more here

http://stackoverflow.com/questions/134099/are-pdo-prepared-statements-sufficient-to-prevent-sql-injection

Thanks

Can you show me how to query results from DB using this script ?

I can’t figure out how to retrieve records from the various “select” query examples

Here is one that works for me but I can’t figure out how to retrieve the records

$pdomodel->joinTables(“work_thumbnail”, “posts.id = work_thumbnail.project_id”,”INNER JOIN”);//specify join

$records = $pdomodel->executeQuery(“select * from `posts`”);

Hi,

http://demo.digitaldreamstech.com/PDOModel/documentation/pdo/join.php http://demo.digitaldreamstech.com/PDOModel/documentation/pdo/select.php

Please check example and more example for performing join and select operations.

Let me know if you have any further doubt. Thanks

Did you receive my email with code? I would appreciate your resolution of this matter. Thanks.

Yes, I received your code. I am checking it.

Any update please?

I have replied to you on your email as you contacted also via profile.

There is a way to “associate” column in csv/xls import into fields database using the new import csv/xls function? Thanks

If your csv column_name are same as the db column name then yes, they can be associated directly.

Thanks for answer, have 3 more questions related to CSV/XLS import if the column names are different, how can be associated? is possible to import only some columns from CSV/XLS? can also make “operations” to imported CSV/XLS columns before add them into DB? Is possible to add other data (“fixed” data, or calculated fields) into DB when i make a CSV/XLS import?

Thanks

It provides data in format of array that can be modified to import data in appropriate field and do required calculation before insertion of data.

Hi, When is version 1.2 ready for us?

is the update ready?

when soonest can we have a copy for the fresh update?

Hi

Sorry for my question but wonder if your script’s output is in a table form and if it is has it got pagination as well?

thanks

Script default output is in array format and there is pagination function also present as a helper, using both function, you can easily create complete pagination with html table.

May be in next version, I will add this feature also.

Hi. I have a problem with the export to Excel.

I am getting the error messageFatal error: Uncaught exception ‘PHPExcel_Writer_Exception’ with message ‘Could not close zip file php://output.’

Thanks a lot for your great feedback. This motivates a lot to add new feature. Version 1.2 with many more features will be uploaded for review on 11th, I will try to add that feature also in version 1.2. Many Thanks

I want to say publically thanks to the developer who has stuck by me with a problem (more mine!) and sorted it. His support has been great.

Thanks a lot for your nice words, always happy to help !!!

Hi,

I trust you are doing well. sadly i am still not able to perform the following operation:

orderBy($columns, $order = “ASC”) Or maybe there is no such feature? In the end i want to perform this kind of query: $query = $pdomodel->displayError(TRUE)>selectColumns($array)>setLimit(“0,1”)>where($field, $value)>orderBy($columns, $order = “ASC”)->select($table);

Thanks, waiting for your reply.

Right now, orderBy is done like $pdoobj->orderBy = array(“colname asc”), The chaining feature you are asking is mostly completed and will be released with version 1.2 in few days. We are doing testing of these features. I will update you once we release version 1.2 with many more features.

Hi,

Thanks for the response. What do you think of changing this : $pdoobj->orderBy = array(“colname asc”) to this $pdoobj->setOrderBy->(array(“colname asc”));

Thanks.

Hi, its already done in version 1.2 as I informed you. I will let update you once version 1.2 is ready to be release. Thanks

by
by
by
by
by
by

Tell us what you think!

We'd like to ask you a few questions to help improve CodeCanyon.

Sure, take me to the survey