Basic of Basics
am 23.09.2009 02:03:54 von Todd Dunning
Just put yourself in these shoes:
1. It's before you learned SQL.
2. You can declare variables and call includes and that's about it.
3. Your site looks great, the includes are ready. The variables are already
in the includes.
4. You have a delimited file, 15K rows, 30 columns.
5. You have to get it done tonight.
6. Your entire career has been spent using static files, but now it's time
to grow up.
Here's the challenge for you, Mr. Pre-SQL:
1. You need the usual search results, say about 20 rows, and the result
page. The most basic of basics.
2. Thank the gurus at php.general.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Basic of Basics
am 23.09.2009 02:22:45 von Robert Cummings
Todd Dunning wrote:
> Just put yourself in these shoes:
>
> 1. It's before you learned SQL.
> 2. You can declare variables and call includes and that's about it.
> 3. Your site looks great, the includes are ready. The variables are already
> in the includes.
> 4. You have a delimited file, 15K rows, 30 columns.
> 5. You have to get it done tonight.
> 6. Your entire career has been spent using static files, but now it's time
> to grow up.
>
> Here's the challenge for you, Mr. Pre-SQL:
> 1. You need the usual search results, say about 20 rows, and the result
> page. The most basic of basics.
> 2. Thank the gurus at php.general.
There's a link out there somewhere about posting well formed questions.
The above, if it is a question (I don't see any question marks), does
not in any way adhere to the principles of a well formed question.
The existence of 5 suggests that 6 should have happened already.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Basic of Basics
am 23.09.2009 02:49:38 von Todd Dunning
Rob it's LAMP php5. Godaddy virtual dedicated. I'm considering if I should
just bite the bullet and attempt to build my first SQL db tonight, because
there's plenty of info about doing the basics via sql. I have phpMyAdmin
and cPanel. It's a classic noob issue of whether to spend extra time doing
it the right way or not.
Thanks very much for your interest in helping.
----- Original Message -----
From: "Robert Cummings"
To: "Todd Dunning"
Cc:
Sent: Tuesday, September 22, 2009 5:22 PM
Subject: Re: [PHP] Basic of Basics
> Todd Dunning wrote:
>> Just put yourself in these shoes:
>>
>> 1. It's before you learned SQL.
>> 2. You can declare variables and call includes and that's about it.
>> 3. Your site looks great, the includes are ready. The variables are
>> already in the includes.
>> 4. You have a delimited file, 15K rows, 30 columns.
>> 5. You have to get it done tonight.
>> 6. Your entire career has been spent using static files, but now it's
>> time to grow up.
>>
>> Here's the challenge for you, Mr. Pre-SQL:
>> 1. You need the usual search results, say about 20 rows, and the result
>> page. The most basic of basics.
>> 2. Thank the gurus at php.general.
>
> There's a link out there somewhere about posting well formed questions.
> The above, if it is a question (I don't see any question marks), does not
> in any way adhere to the principles of a well formed question.
>
> The existence of 5 suggests that 6 should have happened already.
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Basic of Basics
am 23.09.2009 03:03:00 von Robert Cummings
Todd Dunning wrote:
> Rob it's LAMP php5. Godaddy virtual dedicated. I'm considering if I should
> just bite the bullet and attempt to build my first SQL db tonight, because
> there's plenty of info about doing the basics via sql. I have phpMyAdmin
> and cPanel. It's a classic noob issue of whether to spend extra time doing
> it the right way or not.
>
> Thanks very much for your interest in helping.
The following will do it without a database:
$file = 'your-file.csv';
$keywords = 'keyword1 keyword2 ...';
$keywords = preg_split( '# +#', $keywords );
$clauses = array();
foreach( $keywords as $keyword )
{
if( ($keyword = trim( (string)$keyword )) === '' )
{
continue;
}
$keyword = escapeShellArg( $keyword );
$clauses[] = "grep -s -i -F $keyword";
}
$matches = '';
if( $clauses )
{
$file = escapeShellArg( $file );
$command = "cat $file | ".implode( " | ", $clauses );
$matches = `$command`;
}
echo $matches."\n";
?>
You still need to parse your feed afterwards which I presumed was a CSV
or tab delimited style file WITHOUT newlines.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php