UPDATE static
SET money = money + '100'
WHERE member_id IN (SELECT member_id FROM race WHERE race_id = '$race_id')"
I want to retrieve member_ids and give for all of them +100 money. What's wrong?
UPDATE statistics'
SET money = money + '$money'
WHERE member_id IN ((SELECT member_id FROM races WHERE l_id = '$mem_id'), $other_id)
What's wrong with that? I want to retrieve all member_ids from races and also include to member_id $other_id. Without $other_id it works.
By the way, it gives me "Subquery returns more than 1 row" error.
Hi everybody,
I am developing with NHibernate for the first time in conjunction with ASP.NET MVC and StructureMap. The CodeCampServer serves as a great example for me. I really like the different concepts which were implemented there and I can learn a lot from it.
In my controllers I use Constructur Dependency Injection to get an instance of the specific repository needed.
My problem is: If I change an attribute of the customer the customer's data is not updated in the database, although Commit() is called on the transaction object (by a HttpModule).
public class AccountsController : Controller
{
private readonly ICustomerRepository repository;
public AccountsController(ICustomerRepository repository)
{
this.repository = repository;
}
public ActionResult Save(Customer customer)
{
Customer customerToUpdate = repository
.GetById(customer.Id);
customerToUpdate.GivenName = "test"; //<-- customer does not get updated in database
return View();
}
}
On the other hand this is working:
public class AccountsController : Controller
{
[LoadCurrentCustomer]
public ActionResult Save(Customer customer)
{
customer.GivenName = "test"; //<-- Customer gets updated
return View();
}
}
public class LoadCurrentCustomer : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
const string parameterName = "Customer";
if (filterContext.ActionParameters.ContainsKey(parameterName))
{
if (filterContext.HttpContext.User.Identity.IsAuthenticated)
{
Customer CurrentCustomer = DependencyResolverFactory
.GetDefault()
.Resolve<IUserSession>()
.GetCurrentUser();
filterContext.ActionParameters[parameterName] = CurrentCustomer;
}
}
base.OnActionExecuting(filterContext);
}
}
public class UserSession : IUserSession
{
private readonly ICustomerRepository repository;
public UserSession(ICustomerRepository customerRepository)
{
repository = customerRepository;
}
public Customer GetCurrentUser()
{
var identity = HttpContext.Current.User.Identity;
if (!identity.IsAuthenticated)
{
return null;
}
Customer customer = repository.GetByEmailAddress(identity.Name);
return customer;
}
}
I also tried to call update on the repository like the following code shows. But this leads to an NHibernateException which says "Illegal attempt to associate a collection with two open sessions". Actually there is only one.
public ActionResult Save(Customer customer)
{
Customer customerToUpdate = repository
.GetById(customer.Id);
customer.GivenName = "test";
repository.Update(customerToUpdate);
return View();
}
Does somebody have an idea why the customer is not updated in the first example but is updated in the second example? Why does NHibernate say that there are two open sessions?
UPDATE [TABLE] SET [FIELD]=0 WHERE [FIELD] IS NULL
[TABLE] is an Oracle database table with more than 700 million rows. I cancelled the SQL execution after it had been running for 6 hours.
Is there any SQL hint that could improve performance? Or any other solution to speed that up?
Is there any handy tool that can make updating tables easier? Usually I got an Excel file with the original value in one column and new value in another column. Then I write a formula in Excel to create the 'update' statement. Is there any way to simplify the updating task?
I believe the approach in SQL server 2000 and 2005 would be different, so could we discuss them both? Thanks.
hey guys
i create two input text fields , one for title and another for permanent link
i need to update the second filed automatically when user is typing the tilte
how can i do such a thing in jquery /php
somehow im looking for a way to simulate wordpress creation of permanent link in post section
Trying to get current data from textarea with jquery and replace it with what server returns. so far q value is picked up right, intead of updating it with server returned content, it just replaces it with ' '
q = $('textarea#id_message').val();
alert(q)
$("textarea#id_message").val(' ').load( '/process/url?html=' + q );
Update
just tried it passing server data to test results div, this does work, textarea does not
$( '#results' ).html( ' ' ).load( '/process/url?html=' + q );
I do something like
UPDATE OR REPLACE someTable SET a=1, b=2 WHERE c=3
I expect if it doesnt exist it will be inserted into the DBs. But nothing happens and i get no errors. How can i insert data, replace it if it already exist and use a where for the condition (instead of replacing BC of a unique ID)
I need to import either csv or excel file into a dbase. The column headers will match but I will want to compare the file against the dbase using an ItemID field, list the rows to be affected and the differences, then allow an update to all the rows with the matching ID.
Hello,
I want to update a blog, by sending an email using php. This is not wordpress, tumblr, or the famous ones.
I could set up an email id, with a specific code in the subject line, but how I get input the contents into the db?
Thanks
Jean
I'm changing my dataset in my program. And when my job was finished, I'm connecting to mysql database. I don't want to do this job again, how can I send changings to database like this
mydatadapter.Update(dataset, " table");
I found this code, but I can't run it :S
Is it possible to merge these two mysql queries into one? I want to get NOW() returned to a php variable.
mysql_query('INSERT INTO translate (IDRef, RefType, Lang, Text, LastChangeTS) VALUES ('.$id.', \''.$reftype.'\', \''.$lang.'\', \''.$text.'\', NOW()) ON DUPLICATE KEY UPDATE text = \''.$text.'\', LastChangeTS = NOW()');
mysql_query('SELECT LastChangeTS FROM translate WHERE IDRef = '.$id.' AND RefType = \''.$reftype.'\' AND Lang = \''.$lang.'\'');
On the Members table are columns "MemberID" and "PointsEarned".
I want to update the PointsEarned column from the result of this query:
SELECT m.MemberID, m.UserName,
( (SELECT COUNT(*) FROM EventsLog as e WHERE e.MemberID=m.MemberID AND e.EventsTypeID=2)*10 ) +
( (SELECT COUNT(*) FROM EventsLog as e WHERE e.MemberID=m.MemberID AND e.EventsTypeID=3)*3 ) +
( (SELECT COUNT(*) FROM ChatMessages as c WHERE c.MemberID=m.MemberID)*.1 )
as PointsEarned
FROM Members as m
Can anybody tell me how I should do it with a single query?
Thanks!
At the moment I have installed tomcat via the service.bat command. After install I stop the service and execute the following command:
//US//TOMCAT6 --User=MyUser
this fails to update the service with the user MyUser, in addition this command also fails
//US//TOMCAT6 --User=MyUser --Password=MyPassword
I am running xp sp3 and it is Tomcat 6.20
hi,
how can I change my Drupal filesystem root in the database ?
I moved Drupal to another path. I'm looking for this value to update in the database.
thanks
Consider the following two (hypothetical) tables
Temperature
* day
* time
* lake_name
* station
* temperature_f
Temperature_summary
* day
* lake_name
* station
* count_readings_over_75f
* count_readings_below_75f
How can I write an SQLite Trigger to update the temperature_summary table on insert. I want to increment the count.
Thank You,
Jeff
Hi there,
my Topic should tell you already what i am asking for.
Is there any way to update my database from an entity data model without lossing the inserted content?
I can't be bothered copying all this stuff everytime i make a change.
Thanks a lot.
Chris
hey guys
i need to add a special text to all rows in my mysql table ,
how to add some text to the end of all rows' content in a table just for one field
i used this code :
UPDATE `blogs` SET `title`= `title`+ 'mytext';
but didnt work for me
hi,
I'm copying my Drupal installation to another folder and I've copied the related database.
When I run update.php on the new copy I get the following error:
http://dl.dropbox.com/u/72686/updateError.png
should I disable some modules.. or is something about Drupal core ?
thanks
Hi,
I have a curiosity about application updates . What happens after such a process with the resources supposing that the update needs different resources than the ones the old version used ? Are they overwritten ?( like overwrite string.xml) or the old resources are deleted and replaced with the new ones ?
IN my table there are two field one is name and other is gender I want to fire query so that
every male is update with female and vice a versa.
I don't want to use procedure ,trigger or function.I have to do this only with simple query.
hi to all
i am using cakephp in my project. in this at one section i need to update the particular row onclick of the image. using ajax. i used mootools as javascript library. so please help me how could i do this.
thanks in advance
Hello,
I'm trying to update values from a xml file into textboxes. I have this javascript being called in the Page_Load event
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", sb.ToString(), true);
I click the continue button which does a post back but the values are not updated until I refresh the page again which makes me think the js isn't being run until after the page is returned. I'm wondering how to have the values updated when the page is refreshed after the button postback.
thanks