Mysql Ranking based on Category and Branch

I'm having a hard time figuring out and trying how to fix this. Can you help me give a logic or idea how can get the ranking of each category for each branch based on sales? For example: Rank 1 for branch_code_id = 9 is Accicular since it has 300,000 sales Rank 2 for branch_code_id = 9 is WLO since it has only 200,000 sales. Same as with other branches. I only need the rank of categ

基于分类和分支的Mysql排名

我很难找出并尝试如何解决这个问题。 你能帮我提供一个逻辑或想法吗?如何根据销售情况获得每个分支的每个类别的排名? 例如: branch_code_id = 9的等级1是Accicular,因为它有30万个销售额 branch_code_id = 9的等级2是WLO,因为它只有20万个销售额。 与其他分支一样。 我只需要每个branch_code_id的类别branch_code_id 。 我无法弄清楚如何循环这一个。 您可以在excel输出中看到Rank,它将放在“r”列中。 顺便

cookie") vs setcookie() function

I'm refactoring some code and found something I've never seen. the function is used for user to set cookie when user logs in: function setUserCookie($name, $value) { $date = date("D, d M Y H:i:s",strtotime('1 January 2015')) . 'GMT'; header("Set-Cookie: {$name}={$value}; EXPIRES{$date};"); } now that I've been assigned to refactor code I'm planning to use setcooki

cookie“)和setcookie()函数

我正在重构一些代码,并发现了一些我从未见过的东西。 该功能用于用户在用户登录时设置cookie: function setUserCookie($name, $value) { $date = date("D, d M Y H:i:s",strtotime('1 January 2015')) . 'GMT'; header("Set-Cookie: {$name}={$value}; EXPIRES{$date};"); } 现在我已经分配了重构代码我打算使用setcookie函数,它根据php.net基本上做同样的事情。 我的问题是:两者之间有什么区别,我应该

redirect to URL with HTML anchor

I have a website, where after submission of a form user is redirected throught Header Location to the same page but with anchor to fill in another form. Header('Location: http://www.topdodavatel.cz/tuzby/tuzby.php#nechaj'); However, when the first form is submitted, the user is not landed on the anchored DIV, but on the bottom of page. As you can try on development version http://www.topdodav

使用HTML定位器重定向到URL

我有一个网站,在提交表单用户后,通过标题位置将其重定向到同一页面,但用锚点填充另一个表单。 Header('Location: http://www.topdodavatel.cz/tuzby/tuzby.php#nechaj'); 但是,当提交第一个表单时,用户不会落在锚定的DIV上,而是落在页面的底部。 正如你可以尝试开发版本http://www.topdodavatel.cz/tuzby/tuzby.php 什么可能导致锚点不起作用? 如果我选择在上面的代码中编写的某个div,它可以很好地工作。 请感

Passing values to next page using anchor tag

One quick question - I have an anchor tag which on clicking opens a new target window. I don't want to pass the values either in post or get method. my html code is like this. <a class="employee_details" target="_blank" href="index1.php?name=username&id=123">UserName</a> Is there a way to pass the values to the next page using jquery in a hidden type since there is

使用锚标签将值传递到下一页

一个简单的问题 - 我有一个锚点标签,点击后会打开一个新的目标窗口。 我不想在post或get方法中传递值。 我的html代码是这样的。 <a class="employee_details" target="_blank" href="index1.php?name=username&id=123">UserName</a> 有没有办法将值传递到下一页使用jQuery的隐藏类型,因为没有提交按钮。 换句话说,点击锚标签将重定向到另一个页面,我应该得到的名称和ID,该部分不应该可见任何

A PHP function to check for cookies

I've written a php function and some helper functions that checks for cookies when somebody lands on a page but it's not so fast. I want to know is there any way to make it faster or improve it i know it's possible to check for cookies client side using javascript but what if it is disabled also so i need a pure server side solution. <?php function check_cookie(){ if(is_cook

一个PHP函数来检查cookie

我写了一个php函数和一些帮助函数,它们在有人登录页面时检查cookie,但速度并不快。 我想知道是否有任何方法使其更快或改善它我知道可以使用JavaScript检查cookie客户端,但如果它被禁用,那么我需要一个纯粹的服务器端解决方案。 <?php function check_cookie(){ if(is_cookie_disabled()){ header("location:cookie_is_disabled.php"); exit; } } function is_cookie_disabled(){

Use SOAP or REST for a new Api

( Not a duplicate of Should i use rest or soap. That question has only 1 answer which doesnt provide many arguments except overhead ). Before marking this question as a duplicate, consider that I am looking for answers from people that made the choice before me and that explain their reasons based on their own experience. Answers that simply state "overhead" or "more complex&quo

为新的Api使用SOAP或REST

(不是重复的我应该使用rest还是soap。这个问题只有1个答案,除了开销外,没有提供很多参数)。 在将此问题标记为重复之前,请考虑我正在寻找在我之前作出选择的人的答案,并根据他们自己的经验解释他们的原因。 简单说明“开销”或“更复杂”的答案不适合该配置文件。 现在提出这个问题: 一段时间后,我开始使用Soap设置一个新的API(PHP / Zend_Soap_Server,Zend_Soap_Autodiscover)。 尽管我已经知道如何使用肥皂,但

Max size of URL parameters in

I am accessing a PHP server using REST: all data is passed in a GET request as URL parameters. One of the parameters arrives at the server in the query_string, but it is not in the _GET global. But shortening the parameter (the cutoff seems to be around 512 characters) lets it through. Assuming I have diagnosed the problem correctly, is there a way to change this maximum size? I have not fou

中的URL参数的最大大小

我正在使用REST访问PHP服务器:所有数据作为URL参数在GET请求中传递。 其中一个参数在query_string中到达服务器,但它不在_GET全局中。 但缩短参数(截止值似乎大约为512个字符)可以让它通过。 假设我已经正确诊断出这个问题,有没有办法改变这个最大尺寸? 我没有在文档中找到任何解释,甚至没有提到这个限制。 这是Debian squeeze / Apache 2.2.16 / PHP 5.3.3。 好吧,似乎PHP的某些版本具有GET参数长度的限制:

Access database securely from iOS App

I chose MySQL after looking between MySQL and SQLite for accessing because my iPhone app needs to pull information from an online database that is already in MySQL. I believe the traditional way of accessing information would be: To have a php file on the server that does the accessing for you. The iPhone app would call this php file and it would return the results. iOS app will call http:/

从iOS App安全地访问数据库

我在MySQL和SQLite之间进行访问后选择了MySQL,因为我的iPhone应用程序需要从已经在MySQL中的在线数据库提取信息。 我相信访问信息的传统方式是:在服务器上为你提供一个php文件。 iPhone应用程序会调用这个PHP文件,它会返回结果。 iOS应用程序将调用http://somewebsite.com/index.php?id=234,该网站将输出id = 234的用户名。 现在,这个过程有多安全? ...我显然会使用准备好的语句和https。 但是如果有人找到了这

Laravel requires the Mcrypt PHP extension

I am trying to use the migrate function in Laravel 4 on OSX . However, I am getting the following error: Laravel requires the Mcrypt PHP extension. As far as I understand, it's already enabled (see the image below). What is wrong, and how can I fix it? The web enabled extensions and command line enabled extensions can differ. Run php -m in your terminal and check to see if mcrypt is l

Laravel需要Mcrypt PHP扩展

我正在尝试在OSX上使用Laravel 4的migrate功能。 但是,我收到以下错误: Laravel requires the Mcrypt PHP extension. 据我所知,它已经启用(见下图)。 什么是错的,我该如何解决? 启用了Web的扩展和启用命令行的扩展可能会有所不同。 在您的终端中运行php -m并检查是否列出了mcrypt 。 如果不是,那么通过在终端上运行php --ini来检查命令行加载php.ini文件的位置。 在这个php.ini文件中,你可以启用扩展。 OS

Symfony produces a white page

I Have tried to integrate a symfony project on my server but it produces a blank page does not produce any errors even if i on the error display in php. After i include configuration file in index.php nothing works, even the die in the first line of project configuration file does not print when i try this. My index.php file is error_reporting(E_ALL); ini_set('display_errors', "1");

Symfony生成一个白页

我试图在我的服务器上集成一个symfony项目,但它产生一个空白页面,即使我在php中显示错误,也不会产生任何错误。 在我在index.php中包含配置文件后,什么都不起作用,即使是在我尝试这样做时,第一行项目配置文件中的死亡也不会打印。 我的index.php文件是 error_reporting(E_ALL); ini_set('display_errors', "1"); require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); $configu