Jump to content

deepakfugo

Members
  • Posts

    11
  • Joined

  • Last visited

deepakfugo's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi All, I want to select rows from dynamic created tables i.e we have tables like web_analytics_mm_yy(ex: web_analytics_06_13, web_analytics_05_13, web_analytics_04_13 and so on) web_analytics ->common name for all tables mm_yy -> month_year( Will be creating each month) HOW to construct SQL STATEMENT USING UNION ALL? is there any thing that can be done using mysql Query only? and i want to know what is the best method to fetch data from multiple tables which are created dynamic. Thx ppl
  2. piece of advice which were told to me by hosting people is -> If you r running on SuPHP dont include any PHP directives on .htaccess file, It will trigger error!!! -> all your folders should not be in 777 it should be 755...
  3. Thanks,Will use the code tags from now on... I am not sure hosting people(hostgator to be precise) is on/supporting.
  4. Hi All, we have built web site in PHP, Mysql Database and Apache web server. Site is running fine on localhost(Window) but when we try to deploy it on our test environment (ubuntu 12.04.2 platform) .htaccess is not working. I am not getting any error like 500 Internal server error or any thing, index page is loading but after that none of the pages are loading. I have enabled mod_rewrite on apache also changed AllowOverride All in /etc/apache2/sites-available/default, still its not working. Same files when i deploy on Linux shared hosting is working fine Below are the functions which are used in router class public function loader() { /*** check the route ***/ $this->getController(); /*** if the file is not there diaf ***/ if (is_readable($this->file) == false) { $this->file = $this->path.'/error404.php'; $this->controller = 'error404'; } /*** include the controller ***/ require $this->file; /*** a new controller class instance ***/ $class = $this->controller . 'Controller'; $controller = new $class($this->registry); /*** check if the action is callable ***/ if (is_callable(array($controller, $this->action)) == false) { $action = 'index'; } else { $action = $this->action; } /*echo $action."<br />"; echo "file".$this->file."--".$this->controller;*/ /*** run the action ***/ $controller->$action(); } /** * * @get the controller * * @access private * * @return void * */ private function getController() { echo "hi".$_GET['rt']; /*** get the route from the url ***/ $route = (empty($_GET['rt'])) ? '' : $_GET['rt']; if (empty($route)) { $route = 'index'; } else { /*** get the parts of the route ***/ $parts = explode('/', $route); echo "<pre>"; print_r($parts); $this->controller = $parts[0]; if(isset($parts[1])) { echo $this->action = $parts[1]; } } if (empty($this->controller)) { $this->controller = 'index'; } /*** Get action ***/ if (empty($this->action)) { $this->action = 'index'; } /*** set the file path ***/ $this->file = $this->path .'/'. $this->controller . 'Controller.php'; } below is the .htaccess file RewriteBase /var/www/pepnew/ RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA] Below is the default file on /etc/apache2/sites-available <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost>
  5. 2.5 GB is Massive for opening in normal text editor.... I had similar problem but mine was 1.5 GB of SQL file which i was able to open in Hex Editor(HxD). Try Hex for Opening the SQL file it might help u.... Also Its advised not to store Image/doc in Blob format.
  6. Hi All, I am uisng PHP & Mysql DB for my site and i have a task for suggesting Categories based on User keyword input. I have written the query as below but i need to ignore white spaces of the values of columns while matching, how can we achieve it SELECT search.*, MATCH (name) AGAINST ('black' IN BOOLEAN MODE) AS name_match, MATCH (keywords) AGAINST ('black' IN BOOLEAN MODE) AS keyword_match, MATCH (description) AGAINST ('black' IN BOOLEAN MODE) AS description_match FROM search WHERE MATCH (name, keywords, description) AGAINST ('black' IN BOOLEAN MODE) ORDER BY (name_match * 3 + keyword_match * 2 + description_match) DESC LIMIT 0,100; I tried using replace() which were throwing error SELECT search.*, MATCH (replace(`name`,' ','')) AGAINST ('black' IN BOOLEAN MODE) AS name_match, MATCH (replace(`keywords`,' ','')) AGAINST ('black' IN BOOLEAN MODE) AS keyword_match, MATCH (replace(`description`,' ','')) AGAINST ('black' IN BOOLEAN MODE) AS description_match FROM search WHERE MATCH (name, keywords, description) AGAINST ('black' IN BOOLEAN MODE) ORDER BY (name_match * 3 + keyword_match * 2 + description_match) DESC LIMIT 0,100;
  7. Hi All, I am using MYSQL/PHP and have 5 product tables(product_table_1,product_table_2 and so on), category table and sub category table. I need to get number of products mapped for each category. i.e count of products across categories. Below are the table structure and the query which i have written, I need to optimize the query so that it will take minimum time for fetching records. Product table contains around 2,000,000 records each. category table having 175 records and sub category table having 6000 records. PRODUCT TABLE ----------------------- product_id BIGINT 10, product_name VARCHAR 128, sub_cat_id INT 8, approved TINY INT 2 CATEGORY TABLE ----------------------- category_id INT 8, category_name VARCHAR 128, approved TINY INT 2 SUB CATEGORY TABLE ----------------------- sub_cat_id BIGINT 10, subcategory_name VARCHAR 128, category_id INT 8, approved TINY INT 2I Need to optimize the below query.SELECT COUNT( ct.prod_id ), mc.catagory_name FROM ( SELECT `product_id` , `sub_cat_id` FROM `product_table_1` UNION ALL SELECT `product_id` , `sub_cat_id` FROM `product_table_2` UNION ALL SELECT `product_id` , `sub_cat_id` FROM `product_table_3` UNION ALL SELECT `product_id` , `sub_cat_id` FROM `product_table_4` UNION ALL SELECT `product_id` , `sub_cat_id` FROM `product_table_5` ) AS ct , fm_product_sub_category AS sub, fm_product_main_category AS mc WHERE ct.sub_cat_id = sub.sub_cat_id AND sub.category_id = mc.category_id GROUP BY sub.category_id
  8. Hi All, We have website on Shared hosting. I am a newbie. i have installed PHPUnit testing framework on the server. When i try to run a test case in command mode(phpunit --help), i am getting error as attached screenshot. Kindly help me in executing PHPUnit. Regards,
  9. Hi All, We 've 20 promotional websites and we want to centralize the contact us form. We have contact us form that is kept in Server 2 and all the other web sites kept in server 1, now i need to include the contact us form (server1) inside websites(server 2). For this i am using PHP Curl function to include the cross domain file (contact us Form). Now the problem is when i submit the form i want to call a ajax function to save the details in DB and to send mails, but ajax function is not getting triggred in the form. Please find the attached code illustration Thanks and Regards, Deepak
  10. Hi All, I am developing a portal in PHP(Thinking of using YII framework) and MySql DB. I have 2 queries releated to performance of a portal. 1> How to organize the file/directory structure so that the file/s will be accessed at optimal performance. for ex : if we take website like Facebook we can see that they are keeping Javascript, CSS and images in different domain(or some websites storing these files in sub domain) What is the use of keeping the scripting files (JS,CSS,Image folders, etc) in another domin. will it help in acheiving greater performance? 2> I want to know about hosting, whether hosting on a dedicated server is better or Cloud hosting is better. (Since i am expecting atleast ten thousand hits a day) Also any further discussion on managing Portal/ Security of Portal and choosing framework is appriciated. Thx in Adv.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.