[PHP-DB] Bounty for PHP DB project
Hi Guys, I am new to PHP but have Linux and MySql experience. I have a requirement which I would like to outsource for few hundred dollars if anyone is will to take the job. The requirement is as follows: - PHP to queury MySql for data and display it on an html page. - The query is to support up to 200, 000 records which should be displayed onto few pages by buttons like Next and Previous. - One of the table fields include a unique ID which corresponds to a file name in a directory where it should allow the user to download that file. If interested please e-mail me off list. If you know of samples of something like this done please post here so that I can go ahead and read it in case no one wants to make $$$. Thanks guys, Bruce _ Reunite with the people closest to you, chat face to face with Messenger. http://go.microsoft.com/?linkid=9650736
Re: [PHP-DB] Pagination
Hi you all, here is how I am doing in a veery big class of mine.. Course that uses class's specific terms, but it's very easy to understand. = /* * Fetch paginated results */ function fetch_paginated($query='',$page=1,$itens=20) { $this-query($query.' LIMIT '.(($page*$itens)-$itens).','.$itens); - IMPORTANT IT APPENDS A XXX,XXX LIMIT IN THE END OF QUERY. if($this-num_rows() 0) { while($this-fetch_array()) { $results[] = $this-row; } } else { return null; } $this-query($query.' LIMIT 0,'.(($page*$itens)-$itens)); $this-page_prev = $this-num_rows(); - HOW MANY ROWS BEFORE $this-query($query.' LIMIT '.(($page*$itens)-$itens).',1'); $this-page_next = $this-num_rows(); - HOW MANY ROWS AHEAD $this-page_pages_before = ($this-page_prev/$itens); - HOW MANY PAGES BEFORE $this-page_pages_after = ($this-page_next/$itens); - HOW MANY PAGES AHEAD $this-query($query); $this-page_total = $this-num_rows(); - TOTAL RECORDS (INCLUDING CURRENT, BEFORE AND AFTER PAGES) $this-page_from = (($page*$itens)-$itens); - NEXT PAGE $this-page_to = ($page*$itens); - PAGE AFTER return $results; } = The important thing here is how you build the limit statement: LIMIT (($page_number*$itens_per_page)-$itens_per_page),$itens_per_page Where page number MUST start at 1, NOT 0. Regards, Bruno B B Magalhaes On Dec 16, 2004, at 8:38 PM, David Ziggy Lubowa wrote: Hey guys, I am working on an internal db and i have a script[below] which does some searching for me, now i am no expert in php but atleast i can always read up, i want to add some kind of pagination because just incase i search for somethign in particular i dont want it to display 100 entries on my form, how can i incorperate a pagination script in the script below, all help is highly appreciated [snip] ?php $var = @$_GET['q'] ; $trimmed = trim($var); // check for an empty string and display a message. if ($trimmed == ) { echo pPlease enter a search.../p; exit; } $link = mysql_connect(localhost, beef,b33f); mysql_select_db(ip, $link); $qry = mysql_query(SELECT * FROM IP_Addresses where free like '%. $_GET['q'].%', $link); ? table border=1 width=100%tr?php if (mysql_num_rows($qry)==0 ) { print Oops No records found ; ? br a href=http://localhost/ipsearch2.html;Back/a /br ? exit(); } if (mysql_num_rows($qry) 0) { for ($i = 0; $imysql_num_fields($qry); $i++) { echo td align=centerstrong . mysql_field_name($qry, $i) . /td; echo td align=centerstrong . mysql_field_name($qry, $i) . /td; } } ? /tr?php if (mysql_num_rows($qry) 0) { for ($j = 0; $jmysql_num_rows($qry); $j++) { ?tr?php for ($k = 0; $kmysql_num_fields($qry); $k++) { echo td align=center . mysql_result($qry,$j, $k) . /td; } ?/tr?php } } ? [/snip] cheers -Z -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] A language question
Hi guys, I am thinking about content translation... Current I am using for example: contentId | contentTitle | contentBody | contentLanguage So each row has its own language definition... But would it be better using cols as language fields and retrieve only need cols...: contentId | contentTitle_en_uk | contentBody_en_uk The second option would be less space consuming? Any others ideas? Best Regards. Bruno B B Magalhaes -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] A language mather
Hi guys, I am thinking about content translation... Current I am using for example: contentId | contentTitle | contentBody | contentLanguage So each row has its own language definition... But would it be better using cols as language fields and retrieve only need cols...: contentId | contentTitle_en_uk | contentBody_en_uk The second option would be less space consuming? Any others ideas? Best Regards. Bruno B B Magalhaes -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] A language question
Thanks a lot Koert and Norland! Do you know any GOOD multilingual system just to have a look at, how they handles those versions? Best Regards, Bruno B B Magalhaes On Dec 8, 2004, at 12:06 PM, Bastien Koert wrote: the first way is better, the second creates a wider table, and what happens when you start having more than just a few languages, the table grows wider still bastien From: Bruno B B Magalhães [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP-DB] A language question Date: Wed, 8 Dec 2004 11:31:22 -0200 Hi guys, I am thinking about content translation... Current I am using for example: contentId | contentTitle | contentBody | contentLanguage So each row has its own language definition... But would it be better using cols as language fields and retrieve only need cols...: contentId | contentTitle_en_uk | contentBody_en_uk The second option would be less space consuming? Any others ideas? Best Regards. Bruno B B Magalhaes -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] A language question
Thanks a lot Koert and Norland! Do you know any GOOD multilingual system just to have a look at, how they handles those versions? Best Regards, Bruno B B Magalhaes On Dec 8, 2004, at 12:06 PM, Bastien Koert wrote: the first way is better, the second creates a wider table, and what happens when you start having more than just a few languages, the table grows wider still bastien From: Bruno B B Magalhães [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP-DB] A language question Date: Wed, 8 Dec 2004 11:31:22 -0200 Hi guys, I am thinking about content translation... Current I am using for example: contentId | contentTitle | contentBody | contentLanguage So each row has its own language definition... But would it be better using cols as language fields and retrieve only need cols...: contentId | contentTitle_en_uk | contentBody_en_uk The second option would be less space consuming? Any others ideas? Best Regards. Bruno B B Magalhaes -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: PHP vs ASP
Take a look at: http://www.oracle.com/technology/pub/articles/hull_asp.html Regards, Bruno B B Magalhães -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Reverse (or backward?) Infinity Loop
Hi guys, I have a normal categories table: catId catParentId catName catStatus But I want when a user enters on: http://hostname/site/products/catId1/catId7/catId13/../../contentId.html A listing should apear like that: Category 1 Category 7 Category 13 Category 2 Category 3 Category 4 Category 5 A reverse (or backward) loop! We need to get the last category and then follow the ParentId until the 0 ParentId. Have anybody made this before (I hope so)? Many Thanks, Bruno B B Magalhaes -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] CMS Translation Systen: DB Desiging
Hi, I do have a flat file with all the translations for the interface and everything, but the problem is de dynamic content that must be multilingual... Regards, Bruno On Oct 18, 2004, at 5:29 AM, M Saleh EG wrote: I'd always preffer to keep language stuff in files instead of DB. A question or a problem u might face later is: How are you going to store the text in the proper Charset in ur tables? I'd do it this way. -A field in DB to keep the current default language -Every module in the app should have it's own language pack -Write a set of routines to read my language files and return the right values. With DB-Method u gotta hit a trip to ur database for every element or every language pack. Try checking phpMyAdmins way of managing language or any other application to get inspired. On Sun, 17 Oct 2004 23:23:03 -0300, bruno b b magalhaes [EMAIL PROTECTED] wrote: Hi everone, I am building a multilingual content management systen, and I am studying the best way to have the content translated, with minimal Database queries and load. So I have: CONTENTS contentId contentCreationDate contentModificationDate translationId contentStatus CATEGORIES categoryId categoryParentId categoryModulePath translationId categoryStatus TRANSLATIONS translationId field01 field02 field03 field04 field05 field06 field07 field08 field09 field10 translationLanguage translationStatus So just run a simple join query: SELECT contents.*,translations.* FROM contents,translations WHERE contents.translationId=translations.translationId AND translations.translationLanguage='en-uk' AND translations.translationStatus = 1 Or with categories: SELECT categories.*,translations.* FROM categories,translations WHERE categories.translationId=translations.translationId AND translations.translationLanguage='en-uk' AND translations.translationStatus = 1 AND categories.categoryModulePath='products' Any better idea to handle that? Regards, Bruno B B Magalhaes -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- M.Saleh.E.G 97150-4779817 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] CMS Translation Systen: DB Desiging
Hi everone, I am building a multilingual content management systen, and I am studying the best way to have the content translated, with minimal Database queries and load. So I have: CONTENTS contentId contentCreationDate contentModificationDate translationId contentStatus CATEGORIES categoryId categoryParentId categoryModulePath translationId categoryStatus TRANSLATIONS translationId field01 field02 field03 field04 field05 field06 field07 field08 field09 field10 translationLanguage translationStatus So just run a simple join query: SELECT contents.*,translations.* FROM contents,translations WHERE contents.translationId=translations.translationId AND translations.translationLanguage='en-uk' AND translations.translationStatus = 1 Or with categories: SELECT categories.*,translations.* FROM categories,translations WHERE categories.translationId=translations.translationId AND translations.translationLanguage='en-uk' AND translations.translationStatus = 1 AND categories.categoryModulePath='products' Any better idea to handle that? Regards, Bruno B B Magalhaes -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php