Questions tagged [zend-db-select]

117 questions
0
votes
1 answer

PHP. Zend DB adapter

There is gallery on my site, and every picture has own tag. All of the tags are sorting chaotically. I want to sort them by value of field "index" in galleryTagsTable. When it's show chaotically code was: foreach ($_tags as $item) { $select =…
alex
  • 3
  • 3
0
votes
1 answer

zend_db_select with a hexadecimal query parameter against a binary column

How do you represent this query as a Zend_Db_Select? select * from t where id = x'0cc175b9c0f1b6a831c399e269772661'; The database is MySQL, using either PDO or mysqli adapters.
Jack Tanner
  • 934
  • 1
  • 8
  • 24
0
votes
1 answer

Zend Framework: SetIntegrityCheck(false) and then update the object

I am getting data from two tables using join and putting setIntegrityCheck(false) in my model. Now I need to call save() on that object. I know when you put setIntegrityCheck(false), you cannot call save(), delete() or update() to this object. I…
Awais Qarni
  • 17,492
  • 24
  • 75
  • 137
0
votes
1 answer

Can I pass a string to Zend sql's order function?

I'm writing a complex search algorithm that does the searching in tiers. And for two of the tiers I need very weird order clauses which Zend's sql builder simply couldn't handle. Is there a way to tell Zend to just add a string to the order by…
Bogdan
  • 1,869
  • 6
  • 24
  • 53
0
votes
1 answer

convert Raw SQL to Zend_Db_Select

I need to convert this sql query to Zend_Db_Select object 'SELECT `main_table`.*, `product_name_table`.`name` as `product_name`, `product_price_table`.`price` as `product_price`, COUNT(main_table.answer_id) AS `answer_count`, (SELECT…
0
votes
2 answers

zf2 db sql where datetime before two ours ago

I'm looking for the right zf2 syntax to select timestamps / timeranges from the database. I know how to make where statements. However it seems that greaterThan() and lessThan() are not working with timestamps/datetime: where = new…
Manuel
  • 9,112
  • 13
  • 70
  • 110
0
votes
1 answer

Attempting to do a natural sort in Oracle with Zend_DB_Select gives error "ORA-01785: ORDER BY item must be the number of a SELECT-list expression"

I've been trying to follow the solution on this page for implementing a natural sort in Oracle (11g2) but I cannot get it to work with Zend_Db_Select (ZF1) and a union query. My query looks something like this: select() …
fronzee
  • 1,668
  • 2
  • 21
  • 32
0
votes
2 answers

Lots and lots of joins in a Zend Query, hopefully just a slight tweak

Apologies for all this code, anyhow Im re-working a query into the Zend query way of working, this is what I have so far: $db = Zend_Registry::get ( "db" ); $stmt = $db->query(' SELECT recipe_pictures.picture_id,…
bluedaniel
  • 2,079
  • 5
  • 31
  • 49
0
votes
1 answer

Zend_Db_Select : multiple from clause

Hy, I have some problem vith Zend_Db_Select. I have 2 variable : category and city. These 2 variables may have a value or they may be unset. So I verify: $status = '`p`.status = 1'; if($catID){ $catSQL = "`p`.parent = {$catID}"; …
Andreea
  • 139
  • 12
0
votes
1 answer

select columns invalidQueryExeption

I have two tables : product with id, name, price and brand fields and brand with id, name, url fields. I would like to select both of fields from this two tables. I am unable to define columns and defines aliases. ProductTable ... public function…
bsg78
  • 21
  • 4
0
votes
1 answer

Cannot update specific existing column with value

I would like to increment an existing column in my usertable with a dynamic atttribute (karma points) function updateUserKarmaPoints($karmapoints,$userid){ $userkarmaptsarr = array('karmapoints' => new Zend_Db_Expr('karmapoints')+$karmapoints); …
Slay
  • 1,285
  • 4
  • 20
  • 44
0
votes
1 answer

Select all data and an expression with zend

I have a question regarding zend db. I would like to select all the data from a table + an expression such as a count. Unfortunately, when you pass an array with count in the select object, it will only select the count. As the table is really big,…
oveka
  • 57
  • 5
0
votes
1 answer

Error in zend_db_select statement to return as new column

I am trying the return with a new column named count. Here is my query. $userid is the paramter to pass in $select = $this->db->select() ->from('myfriend') ->where('fromid=?', $userid) ->join('user',…
Slay
  • 1,285
  • 4
  • 20
  • 44
0
votes
1 answer

Securing my zend_db_select insert statement

I am using zend_db_select class as my sql wrapper. I would like to know if the following insert statement is secured. (whether it provide mechanism to prevent sql injection etc) function createNew($message,$tags,$userid,$imgsrc){ $data =…
Slay
  • 1,285
  • 4
  • 20
  • 44
0
votes
1 answer

Zend_Framework 1.12 SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax

Before anything I am aware of the multiple questions asked concerning this exception. I have looked through them but have not found an answer for my particular problem. Most of the questions use the Zend_Db_Table::getDefaultAdapter(); , and I am not…
Chayemor
  • 3,577
  • 4
  • 31
  • 54