I would basically like to do the same as this question, but grouping by combinations of two values, rather than just one:
SELECT player_type, team, COUNT(*) FROM players GROUP BY player_type, team;
Does anyone know whether, and how, this is possible in Django? I'm using 1.2.
Doesn't prepare() escape any quotes(') in a PDO statement? For some reason when I do this:
$sql = "INSERT INTO sessions (id, name) VALUES (1,'O'brian')";
$query = $this->connection->prepare($sql);
$query->execute();
I get this error:
Could not insert record SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near 'brian'.
How could this be if I'm using prepare()?
What is the most efficient way to look up values in a BDB for several files in parallel? If I had a Perl script which did this for one file at a time, would forking/running the process in background with the ampersand in Linux work?
How might Hadoop be used to solve this problem?
Would threading be another solution?
hi,
I'm using the following lines to store the location of an object.
var lightboxTop = $('#lightbox').css('top');
var lightboxLeft = $('#lightbox').css('
left');
I'm successively moving this object in my element, and I want to restore it previous position with the stored variables.
But, I'm afraid javascript is saving the values by reference so I lose the initial positions. Am I correct ? How can I solve this ?
thanks
Need to get a value of an enumeration of a given string literal like "xlCenter" (these values are cut and pasted from Excel Macro).
I would like to retrieve the actual constant value (int) -4108="xLCenter" via com marshaling is this possible ? if so how ?
Ideally I am looking for function like this
public int ExcelConstant(string constantName)
{ ...}
Thanks
Hi,
I have the following LINQ query:
List<string> Types = (List<string>) Directory.GetFiles(@"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727")
Where(x => System.IO.Path.GetFileNameWithoutExtension(x).Contains("Microsoft"))
.ToList<string>();
How could I modify this so it can only get the values stored in a collection, without writing another LINQ query (which I assume will impact performance?)?
Thanks
I have a class
class a
{
private Dictionary <int , string> m_Dict = new Dictionary<int , string>();
}
from some other component/class need to add values to the m_Dict dictionary using reflection! How do i do it ? i searched and tried but was not successfull.
I need my application to auto-complete on a company name, but also fill in a hidden form field with the ID of that company selected.
I believe it's possible to return pair values, with the pipe separator, such as........
Microsoft|10
Oracle|20
Sybase|30
And indeed this seems to work, but I don't know how to access the 2nd argument.
I am Looking for a Function that insert "Any" form values to mysql, update or delete.
(not OOP)
I have found a function here:
http://tr.php.net/manual/en/function.mysql-query.php
Thanks in advance
Let's say I have a list of elements
@list=(1,2,3);
#desired output
1,2,3
And I want to print them as comma seperated values. And most importantly, I do not want the last element to have a comma after it.
What is the cleanest way to do this in Perl?
hi, i am a little new to php and although i have managed to pass values of session variables before this piece of code is leaving me puzzled
<form action="team_reg2.php" method="post" name="form1" class="cent" id="form1">
Team Registration
";
print "member$i";
print "\n";
print "\n";
print "Please enter only id\n";
}
?
now this will pass via post to team_reg2.php
echo " please note your team id is 1 ";
echo " your team members are : ";
for($i=1;$i<=$num;$i++)
{
$name='mem'.$i;
echo "$_POST[$name]";
}
}
else
{
$str="select * from $query where (";
for($i=1;$i<=$num;$i++)
{
$name='mem'.$i;
$text="p_id='$_POST[$name]'";
if($i==1)
$str=$str.$text;
else
$str=$str.' or '.$text;
}
$str=$str.')';
$query2=$str;
echo "$str";
// echo "$query2";
$que=mysql_query($query2,$con) or die(mysql_error());
$num=mysql_num_rows($que);
if($num!=0)
{
while($result=mysql_fetch_array($que))
{
echo "$result[p_id] is already registered in team $result[t_id]";
}
//include("reg_team.html");
}
else if($num==0)
{
//echo $query;
$query2="select max(t_id) from $query";
$que=mysql_query($query2,$con) or die(mysql_error());
//echo "$que";
$result=mysql_fetch_array($que);
$max=$result['max(t_id)'];
$max++;
$num=$_SESSION['max_team'];
for($i=1;$i<=$num;$i++)
{
$name='mem'.$i;
if($_POST[$name]!="")
{
$query2="insert into $query values($max,'$_POST[$name]')";
$que=mysql_query($query2,$con);
}
}
echo " please note your team id is $max ";
echo " your team members are : ";
for($i=1;$i<=$num;$i++)
{
$name='mem'.$i;
echo "$_POST[$name]";
}
}
}
?
i have done session_start(); at the beginning of the page itself. The problem is that echoing $_SESSION variables in second file is not printing anything.
someone please explain me whats going on.
thank you
Using prototype, is there a simple method of checking that a group of values match, for example - can this code be refined to a single line or something otherwise more elegant?
var val = '';
var fail = false;
$('form').select('.class').each(function(e){
if(!val){
val = $F(e);
}else{
if(val != $F(e)) fail = true;
}
});
How can I scale a set of values to fit a new range if they include negative numbers?
For example, I have a set of numbers (-10, -9, 1, 4, 10) which have to scaled to a range [0 1], such that -10 maps to 0, and 10 maps to 1.
The regular method for an arbitrary number 'x' would be:
(x - from_min) * (to_max - to_min) / (from_max - from_min) + to_min
but this does not work for negative numbers. Any help is appreciated. Thanks!!
Hi ,
I have country table,
i fetch all values and moved into array ,
these value i like to populate into combo/dropdown list ,
here i want to do some magic things,
that is , for my site most of the users coming from uk,us,Australia,Romain and few,
So i like to populate by my preference ,
is there any array will do this magic work, else is it possible mysql query ,
So final question is ,
Populate country name into combo based on my prefernce ,
Thanks
Hello, I have a table with OWN_ID and OWN_Email -
3ace7cf80edd | [email protected]
3acf6af33ff7 | [email protected]
3acda2524e00 | [email protected]
3ad75583c9a7 | [email protected]
3ad74b018999 | [email protected]
etc.
the problem is that it should contain only a single ID per Email, also I need to replace all OWN_ID values in another table by highest OWN_ID value of the OWN_Email
Dunno why it is...heres the coding for it.
http://pastebin.org/301343
I know theres a lot of repetitiveness in the coding...but its because the arrays were retuning null so I got tired of messing with them.
Everything works until it reaches line 224, which returns null values.
With this query, I get a result that is two short of the table because they are not included in count, and I would like get the NULL values in the result. To do this, I am pretty sure I need to use a subquery of some kind, but I am not sure how, since the attribute in question is an aggregate.
SELECT Equipment.SerialNo , Name, COUNT(Assignment.SerialNo)
FROM Equipment
INNER JOIN Assignment
ON Assignment.SerialNo = Equipment.SerialNo
GROUP BY Equipment.SerialNo, Name
I need to populate the first box with the items from a db table. Users would choose from the first box, and either drag value(items) to the second for selection, or would select items, and then click a button to move them over to the 2nd box. After that I need to update the db with the selected values/items.
putStrLn "Enter the Artist Name"
art <- getLine
putStrLn "Enter the Number of CD's"
num <- getLine
let test= buyItem currentStockBase art num
printListIO (showcurrentList test)
the values i have to pass for buyItem is
buyItem currentStockBase "Akon" 20
but i want to send "Akon" to art and for 20 i want to send num
it gives me this error
ERROR file:.\Project2.hs:126 - Type error in application
*** Expression : buyItem currentStockBase art num
*** Term : num
*** Type : [Char]
*** Does not match : Int
please help me
Hi,
Being quite new with PHP, I cannot find any solution why this does not work. The query is OK and the resource is returned. But I dunno why fetch_assoc does not print values. Thanks
$query=sprintf("SELECT ID,NAME FROM USERS WHERE PASS='%s' AND NAME='%s'",mysql_real_escape_string($p),mysql_real_escape_string($n));
$result=mysql_query($query);
if ($result)
{
while ($row = mysql_fetch_assoc($result)) {
echo $row['ID'];
echo $row['NAME'];
}
}
}
I have a table of many values where one column has the WO Number, and another column has the Resource ID. I need to be able to find all the WO numbers that do not have a resource value of "RW".
Here is an example of the typical information. I need to be able to know that work order 5678 does not have an "RW" Resource ID.
WO Number - Resource ID
1234 - IN
1234 - WE
1234 - AS
1234 - RW
5678 - PR
5678 - WE
5678 - IN
5678 - AS