I tried it like this,

$q = Doctrine_Query::create()
->from('Product p')
->where('p.product_id = ?', $search_term)
->orWhere('p.product_full_desc LIKE ?', '%$search_term%')
->orWhere('p.product_partial_desc LIKE ?', '%$search_term%')
->orWhere('p.product_type = ?', $search_term);

But it still didn't work...is my syntax incorrect?


On Nov 5, 6:33 pm, Alex Pilon <alex.pi...@gmail.com> wrote:
> I mean for the LIKE clause.. so what happens is if you do t.column LIKE
> '%$searchTerm%'; this will check for the search term within the content of
> the column.
>
> The dql rules are the same as the sql rules if you want to check that out on
> mysql.com
>
>
>
>
>
>
>
>
>
> On Fri, Nov 5, 2010 at 18:31, xpanshun <srhen...@gmail.com> wrote:
> > Isn't that for when you want to go through all of the columns in the
> > database? I only wanted to look through the particular ones above...
>
> > On Nov 5, 6:01 pm, Alex Pilon <alex.pi...@gmail.com> wrote:
> > > You need to use wildcards
>
> > > On Nov 5, 2010 5:55 PM, "xpanshun" <srhen...@gmail.com> wrote:
>
> > > Hi everyone,
>
> > > I am trying to return any record from the database where a certain
> > > word (stored in variable $searchterm) is used (within a few different
> > > fields)...
>
> > > Here is what I have:
>
> > > $q = Doctrine_Query::create()
> > > ->from('Product p')
> > > ->where('p.product_id = ?', $search_term)
> > > ->orWhere('p.product_full_desc LIKE ?', $search_term)
> > > ->orWhere('p.product_partial_desc LIKE ?', $search_term)
> > > ->orWhere('p.product_type = ?', $search_term);
>
> > > $result_array_searchresults = $q->fetchArray();
>
> > > However the only field that I can get a return from is a one-word
> > > field like 'bracelet'. Fields like 'product_full_desc' or
> > > 'product_partial_desc' that contain strings/sentences won't return
> > > anything. I want the query to be able to read through these strings
> > > and pick out the search term.
>
> > > What is wrong with my query? How can I achieve the result I want?
>
> > > Thanks!
>
> > > --
> > > If you want to report a vulnerability issue on symfony, please send it to
> > > security at symfony-project.com
>
> > > You received this message because you are subscribed to the Google
> > > Groups "symfony users" group.
> > > To post to this group, send email to symfony-users@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@goog
> > >  legroups.com>
> > <symfony-users%2bunsubscr...@goog legroups.com>
> > > For more options, visit this group athttp://
> > groups.google.com/group/symfony-users?hl=en
>
> > --
> > If you want to report a vulnerability issue on symfony, please send it to
> > security at symfony-project.com
>
> > You received this message because you are subscribed to the Google
> > Groups "symfony users" group.
> > To post to this group, send email to symfony-users@googlegroups.com
> > To unsubscribe from this group, send email to
> > symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@goog 
> > legroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/symfony-users?hl=en
>
> --
> Alex Pilon
> (613) 608-1480

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to