"UPDATE transaksi
SET nama ='".$nama."', kamar = '".$kamar."', hp = '".$hp."',
masuk = '".$masuk."', keluar ='".$keluar."', tagih ='".$tagih."',
jumlah ='".$jumlah."', bawa ='".$bawa."', bayar ='".$bayar."'
where kamar ='".$kamar."'"
I made this code and it works normally until I realized that the field "kamar" cannot be changed.
I wonder where is my fault because another fields can be changed when I activate this method.
Please help
Related
The following tables exist:
Passerine_Survey_Observation
Species_Codes
I'm trying to set the common name in Passerine_Survey_Observation with that of Species_Codes:
UPDATE Passerine_Survey_Observation
INNER JOIN Species_Codes ON Passerine_Survey_Observation.SPEC_FK = Species_Codes.SPEC
SET Passerine_Survey_Observation.Species_Common_Name = Species_Codes.COMMONNAME;
It says an update will occur; however, nothing changes in Passerine_Survey_Observation.
Supposed update warning
If I do this an update does occur as expected:
SET Passerine_Survey_Observation.Species_Common_Name = 'test'
#Knox was onto something...
This behavior occurred because the target field (Passerine_Survey_Observation.Species_Common_Name) - in Design View - was a List Box (under the Properties > Lookup tab). Setting that to Display Control = Text Box resolved the problem. Oops.
Final code:
UPDATE Passerine_Survey_Observation
INNER JOIN Species_Codes ON Passerine_Survey_Observation.[SPEC_FK] = Species_Codes.[SPEC]
SET Passerine_Survey_Observation.Species_Common_Name = Species_Codes.[COMMONNAME]
WHERE Passerine_Survey_Observation.Species_Common_Name IS NULL;
I need to update two information on one object: the quantity (PLAF-gsmng) and refresh the planned order via the module function 'MD_SET_ACTION_PLAF'.
I successfully find a way to update each data separately. But when I execute the both solutions the second modification is not saved on the database.
Do you know how I can change the quantity & set the action on PLAF (Planned order) table ?
Do you know other module function to update only the quantity ?
Maybe a parameter missing ?
It's like if the second object is locked (sm12 empty, no sy-subrc = locked) ... and the modification is not committed.
I tried to:
change the order of the algorithm (refresh and after, change PLAF)
add, remove, move the COMMIT WORK & COMMIT WORK AND WAIT
add DEQUEUE_ALL or DEQUEUE_EMPLAFE
This is the current code:
1) Read the data
lv_plannedorder = '00000000001'
"Read PLAF data
SELECT SINGLE * FROM PLAF INTO ls_plaf WHERE plnum = lv_plannedorder.
2) Update Quantity data
" Standard configuration for FM MD_PLANNED_ORDER_CHANGE
CLEAR ls_610.
ls_610-nodia = 'X'. " No dialog display
ls_610-bapco = space. " BAPI type. Do not use mode 2 -> Action PLAF-MDACC will be autmatically set up to APCH by the FM
ls_610-bapix = 'X'. " Run BAPI
ls_610-unlox = 'X'. " Update PLAF
" Customize values
MOVE p_gsmng TO ls_plaf-gsmng. " Change quantity value
MOVE sy-datlo TO ls_plaf-mdacd. " Change by/datetime, because ls_610-bapco <> 2.
MOVE sy-uzeit TO ls_plaf-mdact.
CALL FUNCTION 'MD_PLANNED_ORDER_CHANGE'
EXPORTING
ecm61o = ls_610
eplaf = ls_plaf
EXCEPTIONS
locked = 1
locking_error = 2
OTHERS = 3.
" Already committed on the module function
" sy-subrc = 0
If I go on the PLAF table, I can see that the quantity is edited. It's working :)
3) Refresh BOM & change Action (MDACC) and others fields
CLEAR ls_imdcd.
ls_imdcd-pafxl = 'X'.
CALL FUNCTION 'MD_SET_ACTION_PLAF'
EXPORTING
iplnum = lv_plannedorder
iaccto = 'BOME'
iaenkz = 'X'
imdcd = ls_imdcd
EXCEPTIONS
illegal_interface = 1
system_failure = 2
error_message = 3
OTHERS = 4.
IF sy-subrc = 0.
COMMIT WORK.
ENDIF.
If I go on the table, no modification (only the modif. of the part 2. can be found on it).
Any idea ?
Maybe because the ls_610-bapco = space ?
It should be possible to update planned order quantity with MD_SET_ACTION_PLAF too, at least SAP Help tells us so. Why don't you use it like that?
Its call for changing the quantity should possibly look like this:
DATA: lt_acct LIKE TABLE OF MDACCTO,
ls_acct LIKE LINE OF lt_acct.
ls_acct-accto = 'BOME'.
APPEND lt_acct.
ls_acct-accto = 'CPOD'.
APPEND lt_acct.
is_mdcd-GSMNG = 'value' "updated quantity value
CALL FUNCTION 'MD_SET_ACTION_PLAF'
EXPORTING
iplnum = iv_plnum
iaenkz = 'X'
IVBKZ = 'X'
imdcd = is_mdcd "filled with your BOME-related data + new quantity
TABLES
TMDACCTO = lt_accto
EXCEPTIONS
illegal_interface = 1
system_failure = 2
error_message = 3.
So there is no more need for separate call of MD_PLANNED_ORDER_CHANGE anymore and no more problems with update.
I used word possibly because I didn't find any example of this FM call in the Web (and SAP docu is quite ambiguous), so I propose this solution just as is, without verification.
P.S. Possible actions are listed in T46AS table, and possible impact of imdcd fields on order can be checked in MDAC transaction. It is somewhat GUI equivalent of this FM for single order.
I am new user with MySQL 5.6 and trying to UPDATE a table using NAVICAT
I trying to condition the SET statement with a WHERE. It seems I have taken the wrong approach. Can someone point me in the right direction?
UPDATE vacation_watch
INNER JOIN property_names
ON vacation_watch.Mstrfromproperty = property_names.MstrLink
INNER JOIN property_names_subnames
ON property_names_subnames.NameLink = property_names.NameLink
SET vacation_watch.Watch_Requester_Last = property_names.Name_Last,
vacation_watch.Watch_Requester_First = property_names.Name_First,
vacation_watch.Watch_Requester_Phone = property_names.Name_Phone,
vacation_watch.Emergency_Contact_Name = property_names_subnames.Sub_Name_Last WHERE property_names_subnames.Sub_Name_Type = "KEYHOLDER"
vacation_watch.Emergency_Contact_Phone = property_names_subnames.Sub_Name_Phone WHERE property_names_subnames.Sub_Name_Type = "EMERGENCY"
You are using two WHERE clauses and in the wrong way.
What you are looking for is actual conditional SQL. There is already an answer on SO that could help you achieving what you want to do here.
Furthermore, there can only be only one WHERE clause that applies on the global level, not at field level.
Something like:
UPDATE vacation_watch
INNER JOIN property_names
ON vacation_watch.Mstrfromproperty = property_names.MstrLink
INNER JOIN property_names_subnames
ON property_names_subnames.NameLink = property_names.NameLink
SET vacation_watch.Watch_Requester_Last = property_names.Name_Last,
vacation_watch.Watch_Requester_First = property_names.Name_First,
vacation_watch.Watch_Requester_Phone = property_names.Name_Phone,
vacation_watch.Emergency_Contact_Name =
CASE WHEN property_names_subnames.Sub_Name_Type = "KEYHOLDER"
THEN property_names_subnames.Sub_Name_Last
END
vacation_watch.Emergency_Contact_Phone =
CASE WHEN property_names_subnames.Sub_Name_Type = "EMERGENCY"
THEN property_names_subnames.Sub_Name_Phone
END
could work. I hope I got what you wanted to do correctly and my syntax is correct as I just wrote it in a text editor and didn't test it.
I had imported my old oscommerce site with 15000 produts for magento!
But unfortably, the thumbnails are dont defined automatically
http://imgur.com/cNdXd
i can do maually, but 15000 produts is a larg number and i need sped a big amout of time for do it
if anywone can give-me a mysql command to set the first produts image as Base Image, Small Image and Thumbnail will be awesome
thanks
Try update them via api:
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');
$products = $proxy->call($sessionId, 'product.list');
foreach ($products as $product) {
$images = $proxy->call($sessionId, 'product_media.list', $product['sku'])
$imageFilename = $images[0]['file'];
$proxy->call($sessionId, 'product_media.update', array(
$product['sku'],
$imageFilename,
array('types' => array('image', 'thumbnail')
));
}
Related documentation links:
http://www.magentocommerce.com/wiki/doc/webservices-api/api/catalog_product_attribute_media
http://www.magentocommerce.com/wiki/doc/webservices-api/api/catalog_product#catalog_product.list
Im having a problem with this SQL code i got somewhere which is supposed to set your first image as image, small image and thumbnail:
UPDATE catalog_product_entity_media_gallery AS mg,
catalog_product_entity_media_gallery_value AS mgv,
catalog_product_entity_varchar AS ev
SET ev.value = mg.value
WHERE mg.value_id = mgv.value_id
AND mg.entity_id = ev.entity_id
AND ev.attribute_code IN ('image', 'small_image', 'thumbnail')
AND mgv.position = 1;
Doesn't change any rows...
Also, my attribute_id's for image, small_image, thumbnail and media_gallery in Magento CE v1.6.2 are 106,109,493,703 using EMSupermarket template.
The following code also does nothing:
UPDATE catalog_product_entity_media_gallery AS mg,
catalog_product_entity_media_gallery_value AS mgv,
catalog_product_entity_varchar AS ev
SET ev.value = mg.value
WHERE mg.value_id = mgv.value_id
AND mg.entity_id = ev.entity_id
AND ev.attribute_id IN (106,109,493)
AND mgv.position = 1;
Anyone how to do this correctly with my id's?
What happened with my oscommerce product import was that the imported product images only end up under the field name media_image, but not image, small_image or thumbnail so i want to copy the media_image values over to the other 3, any ideas how to do this?
I had the same problem. I found this page and ran that SQL command, and also did not get any results. But I modified it to work for me. Here is what I did.
First of all, I changed line 7 from:
AND ev.attribute_code IN ('image', 'small_image', 'thumbnail')
to
AND ev.attribute_ID = '74'
the 74 is my unique attribute id for 'image'. You will have a different number here. You find it by looking it up in mySQL...
75 was for 'small_image' and 76 for 'thumbnail'.
So I ran this code 3 times, 1 for each of those attribute number. Each time I change line 7 ev.attribute_ID = '75' :
UPDATE catalog_product_entity_media_gallery AS mg,
catalog_product_entity_media_gallery_value AS mgv,
catalog_product_entity_varchar AS ev
SET ev.value = mg.value
WHERE mg.value_id = mgv.value_id
AND mg.entity_id = ev.entity_id
AND ev.attribute_ID = '76'
AND mgv.position = 1;
I have this code, but I have a problem.
When I update but do not really made any changes to the value and press the update button, the data becomes null. And it will seem that I deleted the value.
I've taught of a solution, that is to add both combobox1.selectedtext and combobox1.selecteditem to the function. But it doesn't work.
combobox1.selecteditem is working when you try to alter the values when you update. But will save a null value when you don't alter the values using the combobox
combobox1.selectedtext will save the data into the database even without altering.
But will not save the data if you try to alter it.
-And I incorporated both of them, but still only one is performing, and I think it is the one that I added first:
Dim shikai As New Updater
Try
shikai.id = TextBox1.Text
shikai.fname = TextBox2.Text
shikai.mi = TextBox3.Text
shikai.lname = TextBox4.Text
shikai.ad = TextBox5.Text
shikai.contact = TextBox9.Text
shikai.year = ComboBox1.SelectedText
shikai.section = ComboBox2.SelectedText
shikai.gender = ComboBox3.SelectedText
shikai.religion = ComboBox4.SelectedText
shikai.year = ComboBox1.SelectedItem
shikai.section = ComboBox2.SelectedItem
shikai.gender = ComboBox3.SelectedItem
shikai.religion = ComboBox4.SelectedItem
shikai.bday = TextBox6.Text
shikai.updates()
MsgBox("Successfully updated!")
Please help, what would be a simple workaround to solve this problem?
a few things to remember ---
a 'selected____' anything is only non-null when something is, uhm, SELECTED. To ensure that SOMETHING is selected even at start add a line like: ComboBox1.SelectedIndex = 0.
If your recordset has non-string types (like a DATE field might be) then be sure to first check then coerce the string coming back as TEXT to the correct type. I.e....
if isDate(ComboBox1.SelectedText) then ... 'its ok to use this coerced text.
Since a combobox (as well as a listbox) can hold an entire CLASS (i.e. any kind of OBJECT) ... any SelectedItem assignment had better match EXACTLY to the type that was .Items.Add 'ed originally to the control.