Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, April 19, 2024
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  Only Pull Record Specific Data

phpMyEdit Features     Only Pull Record Specific Data
Post new topic   Reply to topic    
 
petermourra     Joined: 26 May 2009   Posts: 1  
Post Posted: 2009-05-27 14:39
Back to top  Reply with quote     

Hello Everyone, I love this script but i need to do something that has me a little stuck.

How can I only show specific records without using the query button.

For example i would only like to show all records with Category !D 1001

$opts['filters'] = "column1 like '%11%' AND column2<17";
$opts['filters'] = "section_id = 9";
$opts['filters'] = "PMEtable0.sessions_count > 200";
$opts['filters'] = "Categoria=1001";

--------------------------------------------------
and


$opts['fdd']['Categoria'] = array(
'name' => 'CatID',
'select' => 'T',
'required' => true,
'sort' => true,
);


These are still showing me all data. Please assist

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2009-05-29 04:45
Back to top  Reply with quote     

Maybe your problem is an issue with quoting, try the following:
Code:
$opts['filters'] = "PMEtable0.Categoria = '1001'";


 
adssaccounting     Joined: 04 Feb 2010   Posts: 5  
Post Posted: 2010-02-06 23:31
Back to top  Reply with quote     

doug wrote:
Maybe your problem is an issue with quoting, try the following:
Code:
$opts['filters'] = "PMEtable0.Categoria = '1001'";


I would like to only show current date entries. The date format is currently mm/dd/yy. So instead of '1001' what would the syntax be for current date?

Thanks in advance for your help.

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2010-02-07 05:51
Back to top  Reply with quote     

MySQL date format is yyyy-mm-dd thus to display records dated today:

Code:
$opts['filters'] = "PMEtable0.my_date_field = '".date('Y-m-d')."'";


 
adssaccounting     Joined: 04 Feb 2010   Posts: 5  
Post Posted: 2010-02-07 15:00
Back to top  Reply with quote     

Thanks, but it still shows all the dates.

The database logs the date like this:

2010-02-05 12:50:28

and what i'm looking to do is to pull only data that is posted today.

This what I have:

$opts['filters'] = "column1 like '%11%' AND column2<17";
$opts['filters'] = "section_id = 9";
$opts['filters'] = "PMEtable0.sessions_count > 200";
$opts['filters'] = "PMEtable0.added = '".date('y-m-d')."'";

and

$opts['fdd']['added'] = array(
'name' => 'Added',
'select' => 'T',
'required' => true,
'maxlen' => 1023,
'sort' => true
);

Please advise what i'm doing wrong.

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2010-02-07 15:08
Back to top  Reply with quote     

What is the field definition? DATE, TIMESTAMP, or DATETIME

If TIMESTAMP, what is the version of MySQL?

 
adssaccounting     Joined: 04 Feb 2010   Posts: 5  
Post Posted: 2010-02-07 15:36
Back to top  Reply with quote     

it is datetime

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2010-02-07 15:42
Back to top  Reply with quote     

Since you've used DATETIME, your filter will need to have two parts, filtering a range of records, basically the beginning and end of the time portion, the start 00:00:00 and the end 23:59:59

Searching the forum for DATETIME might turn up some examples.

 
adssaccounting     Joined: 04 Feb 2010   Posts: 5  
Post Posted: 2010-02-07 16:02
Back to top  Reply with quote     

Ok I changed it to DATE, and still does not filter. What should I change it to?

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2010-02-07 16:10
Back to top  Reply with quote     

Make sure you have date('Y-m-d') and not date('y-m-d')

http://us2.php.net/manual/en/function.date.php

Otherwise, too many variables involved to know what the problem is. If you post the schema as exported by phpMyAdmin it would be helpful.

 
adssaccounting     Joined: 04 Feb 2010   Posts: 5  
Post Posted: 2010-02-07 16:21
Back to top  Reply with quote     

Operating system: Linux (Linux harriet.site5.com 2.6.27-grsec4 #1 SMP Tue Nov 10 22:51:54 GMT 2009 x86_64)
MySQL-Version: 5.0.85-community-log
PHP-Version: 5.2.8 Memory: 32.00 MB Max execution time: 30 Seconds

------------------------------------------
This is what I have:


$opts['filters'] = "column1 like '%11%' AND column2<17";
$opts['filters'] = "section_id = 9";
$opts['filters'] = "PMEtable0.sessions_count > 200";
$opts['filters'] = "PMEtable0.added = '".date('Y-m-d')."'";

and

$opts['fdd']['added'] = array(
'name' => 'Added',
'select' => 'T',
'required' => true,
'maxlen' => 1023,
'sort' => true
);

 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy