Archive for the ‘update statement’ Category

What files do I replace from statement below and how?

November 3, 2009 - 8:54 am 1 Comment

Files required to use Microsoft Update are no longer registered or installed on your computer. How do I do this? Also it is hard to troubleshoot.. I get "Hung Up" when I am trying to get to the next frame which makes it impossible to correct anything.

control panel>help and support> update my computer and see if that will correct it.

Using SQL to update a record is adding to the field not replacing what’s in the field?

October 31, 2009 - 9:16 pm 5 Comments

Need to update a record with the statement "strEdit = "UPDATE joborder SET Order_Status = ‘" & updOrder_Status & "’ WHERE Order_Id = ‘" & updOrder_Id & "’". Instead of replacing the value in Order_Status it keeps adding to the current value. For example, the status value is open, and when i try to update it the value becomes "open, closed". By the way, I’m using a drop down box to select order status.

if updOrder_Status is the name of your drop down, you need to get the SelectedValue, not just the entire object; if you call the entire object, as it appears you are doing here, ALL values in the drop-down (which is handled by VB as a string array) will be inserted, after being converted to a comma-delimited string.

That’s almost certainly the problem you’re facing.

This may work better:

strEdit = "UPDATE joborder SET Order_Status = ‘" & updOrder_Status.SelectedValue & "’ WHERE Order_Id = ‘" & updOrder_Id & "’

hi! i m trying to use ajax to delete a checked row in a table and also update it in database?

October 17, 2009 - 8:20 am 1 Comment

it shows type mismatch. it came at the line, xmlHttp.onreadystatechange= function(){ stateChanged(); } .i have changed the statement to add function(){ } as i found it would solve the error. Even after the error is gone, the table is not updated to delete the checked row.i dunno what is wrong.

This is likely a problem with your server side script, not your Javascript.

I recommend using an ajax library, either one that comes with a full Javascript library like prototype or jQuery, or a standalone one. It makes your ajax code much easier to read and write.

hi! i m trying to use ajax to delete a checked row in a table and also update it in database?

October 17, 2009 - 8:20 am 1 Comment

it shows type mismatch. it came at the line, xmlHttp.onreadystatechange= function(){ stateChanged(); } .i have changed the statement to add function(){ } as i found it would solve the error. Even after the error is gone, the table is not updated to delete the checked row.i dunno what is wrong.

This is likely a problem with your server side script, not your Javascript.

I recommend using an ajax library, either one that comes with a full Javascript library like prototype or jQuery, or a standalone one. It makes your ajax code much easier to read and write.

Which approach is better for database update in an object-oriented PHP application?

October 5, 2009 - 3:59 pm 2 Comments

Imagine that there is a webpage for updating the information of a customer(attributes:customer_id,name,gender), it consists of a form which uses the POST method. When the client has finished making changes to the customer record and then clicks the update button.
Do you think the page should POST all values(no matter whether it has been changed or not) to the server?
Or just POST the values that have been changed?

The first approach does *not* require the client to have javascript turned on to keep track of whether a value has been changed because *all values* would be POSTED to the server(generates some unneccessary traffic because the client may only change some but not all values). And at the server side, these POSTED values can be used as inputs to the constructor of the Customer class to create a customer object and then call its update() function that executes an update SQL statement like this:
UPDATE [customer] SET name=$name,gender=$gender WHERE customer_id=$customer_id

By doing this, no matter whether the values have been updated, this single update statement always works, but it may affect the performance because some values not changed by the client are also re-overwritten to the database and it also generates some network traffic.
For the second approach, javascript must be enabled by the client to keep track of the changes and only the values that have been changed would be received by the server, and at the server side, after creating a customer object using a constructor that does not initialize the attributes, I would use the setter methods to initialize the attribute values to the POSTED values. For example, if the client only changed the name of a customer. Only setName($name) function would be used but not setGender($gender). And in the update() function, it can generates an update statement depending on which attribute values are initialized. Therefore, no overwritting values that have not been changed may occur. And it also tends to generate less network traffic.

However, my second approach does not seem to be very common.
Would you please give me some suggestions on my design?
Thanks a lot.
Thanks so much for your help.

1) I have no compunction against requiring my users to have Javascript running - the security in js is better than most anti-virus programs (you can’t access the user’s files, except for the coolie for your site, you can’t access his network, etc.), and people aren’t worried about browsing virus-ridden sites. I’m not going to twist my head into knots to accommodate a paranoid user. You use IE6 or better, or a W3C-compliant browser, and you have js turned on, or you aren’t going to get much use of my site. (A lot of my stuff is Ajax, so no js, no workee.)

2) Updating only the fields that have been changed requires that you send the field names as well as the values. It’s a nice idea, but how much traffic does it really eliminate?

Need help with a SQL update statement. I am trying too append multiple rows at one time?

October 3, 2009 - 6:09 am 1 Comment

Let’s say we have table ‘T’ with columns A, B, & C. I need to update columns A & B with different values based on C. I think if it was one row that needed to be updated it would be:

Update T
Set A=’{value}, B=’{value}’
where C=’{value}’

However if I want to do multiple rows in one statement would it be:

Update T
Set A=(’value1′, ‘value2′), B=(’value1′, ‘value2′)
Where C=(’value1′, ‘value2′)

Update T
Set A=C, B=C
where C IN(values list)

Need help with a SQL update statement. I am trying too append multiple rows at one time?

October 3, 2009 - 6:09 am 1 Comment

Let’s say we have table ‘T’ with columns A, B, & C. I need to update columns A & B with different values based on C. I think if it was one row that needed to be updated it would be:

Update T
Set A=’{value}, B=’{value}’
where C=’{value}’

However if I want to do multiple rows in one statement would it be:

Update T
Set A=(’value1′, ‘value2′), B=(’value1′, ‘value2′)
Where C=(’value1′, ‘value2′)

Update T
Set A=C, B=C
where C IN(values list)

Portugese Police - should they have made public statement on the process of their law?

October 1, 2009 - 10:02 am 7 Comments

Turns out:-

The dossier doesn’t revolve entirely around Kate & Gerry and was just updating the judiciary on where they are on the investigation.

Why did press get it so badly wrong?

Its not fair on the suspects and its not fair on the family of the missing girl.
g8bvl - ‘people like you’?! Do you mean the people who log on and Q and A on the Maddy case?

No that is called being interested in current affairs. We are all keen to hear developments in the case. There is nothing worng with that.

Dont you be so quick to judge people Mr High and Mighty!
Skidoo and Ruthy - I think now we are in 2007 police might find it helpful to explain their processes. I dont think that is too much to ask and it would take a lot of pressure and criticism off them

Enlightenment at last…

The press got it so badly wrong only to service their own selfish purposes regardless of how unfair & unjust it was to the suspects & Madeleine’s family.

Thats why its silly to base one’s opinon on the bases of the media’s judgement. Its far wiser & more mature to gather all the facts you can from various sources available & make your own logical & unbiased judgement.

PHP-MYSQL UPDATE SYNTAX ERROR?

September 29, 2009 - 9:21 am 3 Comments

I have the following query to update a database table from a form and when I run it, I get a syntax error.

$query = "UPDATE dues SET jan=’$jan’, feb=’$feb’, mar=’$mar’, apr=’$apr’, may=’$may’, jun=’$jun’, jul=’$jul’, aug=’$aug’, sep=’$sep’, oct=’$oct’, nov=’$nov’, dec=’$dec’ WHERE ID=$id";
$result = mysql_query($query);

when I echo mysql_error(); I get the following:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘dec=’Not Paid’ WHERE ‘ID’=1′ at line 1

I have already tried putting single quotes around $id but that didn’t fix it either, I tried removing the commas and it didn’t work either. I tried putting the values in parenthases and it didnt work. I have tried a lot of things and NOTHING has worked. I have no idea what I need to change.

I need help because I usually set up all my other update statements just like this one, (syntax-wise), but for some reason this one wont work.

If you need more details to figure it out, just let me know.

Thank You!!

DEC is a reserved word in MySQL. See: http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html

Try ….
nov=’$nov’, ‘dec’='$dec’ WHERE ID=$id;

or, possibly better,
nov=’$nov’, dues.dec=’$dec’

If neither of those help, please print out the "real" SQL you execute and update the problem with it - it might be something that is only causing syntax problems once the variables are resolved.

10 Points for best updates to this statement by Archbishop Sheen?

September 27, 2009 - 11:14 am 5 Comments

This statement was originally written in regards to some Christians by Archbishop Sheen. Since then, we have many more folks of different religions, including those who believe you cannot know, or believe there is no God, who make untrue statements about Catholics that may appear true to them.

There are probably many ways to update this; I’d like your suggestions.

from Preface
by Rt. Rev. Msgr. Fulton J. Sheen, D.D.
There are not over a hundred people in the United States who hate the Catholic Church. There are millions, however, who hate what they wrongly believe to be the Catholic Church—which is, of course, quite a different thing. These millions can hardly be blamed for hating Catholics because Catholics “adore statues”; because they “put the Blessed Mother on the same level with God”; because they say “indulgence is a permission to commit sin”; because the Pope “is a Fascist”; because the “Church is the defender of Capitalism.” If the Church taught or believed any one of these things it should be hated, but the fact is that the Church does not believe nor teach any one of them. It follows then that the hatred of the millions is directed against error and not against truth. As a matter of fact, if we Catholics believed all of the untruths and lies which were said against the Church, we probably would hate the Church a thousand times more than they do….

From Radio Replies Volume 1, first published in 1938

A common misrepresentation in the media nowadays is that Catholics are haters when we practice our religion, so that could be inserted somehow in the above quote. We do love the sinner, but hate the sin.
People might misunderstand us because they believe priests should be married which is not allowed.

They may suppose incorrectly that we discriminate against women, when women work in many areas of the Chruch; we need to work on racism more than discrimination against gender.

The media will often make statements that imply the Church is wrong for the ban on artificial contraception, sterilization, stem cell research, abortion, artificial insemination, and illegal marriages.

There is nothing new under the sun. I think Archbishop Sheen made a great statement that can work well to help us view other Christians more charitably. My question is meant to expand this outreach to agnostics and atheists.

It is perfect the way it is. One minor statement can be said in regard to scandals in the church is that one must separate the sins of man from the divine institution. It would be nice to see programming like his on mainstream T.V. again