concatenation

PHP/mySQL: How do a concatenate a variable in a mysql query?

我只是一个虾纸丫 提交于 2020-01-13 18:07:20
问题 What is the proper way to concatenate text and a variable in PHP inside a mysql_query? Here is my attempt: page.'$pageID' I want it to output page3 . Here is all of the code (simplified to focus on the mysql_query): if ($_POST['pageProgress']) { $pageProgress = $_POST['pageProgress']; $pageID = 3; $userID = 1; $updateUserProgress = mysql_query("UPDATE test SET page.'$pageID'='$pageProgress' WHERE userID='$userID'") or die(mysql_error()); } All of the code works perfectly if I simply replace

PHP/mySQL: How do a concatenate a variable in a mysql query?

♀尐吖头ヾ 提交于 2020-01-13 18:06:56
问题 What is the proper way to concatenate text and a variable in PHP inside a mysql_query? Here is my attempt: page.'$pageID' I want it to output page3 . Here is all of the code (simplified to focus on the mysql_query): if ($_POST['pageProgress']) { $pageProgress = $_POST['pageProgress']; $pageID = 3; $userID = 1; $updateUserProgress = mysql_query("UPDATE test SET page.'$pageID'='$pageProgress' WHERE userID='$userID'") or die(mysql_error()); } All of the code works perfectly if I simply replace

How to concatenate two-dimensional arrays in Java

南楼画角 提交于 2020-01-13 09:57:29
问题 I have a situation where I need to concatenate two two-dimensional arrays. Object[][] getMergedResults() { Object[][] a1 = getDataFromSource1(); Object[][] a2 = getDataFromSource2(); // I can guarantee that the second dimension of a1 and a2 are the same // as I have some control over the two getDataFromSourceX() methods // concat the two arrays List<Object[]> result = new ArrayList<Object[]>(); for(Object[] entry: a1) { result.add(entry); } for(Object[] entry: a2) { result.add(entry); }

C++ Preprocessor string literal concatenation

孤者浪人 提交于 2020-01-13 09:33:19
问题 I found this regarding how the C preprocessor should handle string literal concatenation (phase 6). However, I can not find anything regarding how this is handled in C++ (does C++ use the C preprocessor?). The reason I ask is that I have the following: const char * Foo::encoding = "\0" "1234567890\0abcdefg"; where encoding is a static member of class Foo . Without the availability of concatenation I wouldnt be able to write that sequence of characters like that. const char * Foo::encoding = "

Concatinate unknown number of values in sqlite

醉酒当歌 提交于 2020-01-13 05:48:11
问题 I am using sqlite 3.15.1 . I have a table master containing master timetable of a college. It looks like : day sem sec hour sub_id ---------- ---------- ---------- ---------- ---------- MON 5 B 4 10IS51 MON 5 B 4 10IS53 MON 5 B 5 10CS54 MON 5 B 6 10CS55 MON 5 B 7 10CS53 MON 3 A 1 10CS33 and many more values.... There are multiple sub_id for same other values , meaning - On Monday 1st hour, 5th B students might have 2 or more lab (sub_id). (Its conducted in batches). To get a proper timetable,

Efficiently concatenate many sas datasets

蹲街弑〆低调 提交于 2020-01-13 04:18:45
问题 I have over 200k small datasets with the same variables (n<1000 and usually n<100) that I want to concatenate into a master dataset. I have tried using a macro that uses a data step to just iterate through all of the new datasets and concatenate with the master with "set master new:", but this is taking a really long time. Also, if I try to run at the same time, the call execute data step says that I am out of memory on a huge server box. For reference, all of the small datasets together are

concatenating arrays in python like matlab without knowing the size of the output array

南楼画角 提交于 2020-01-12 19:14:07
问题 I am trying to concatenate arrays in python similar to matlab array1= zeros(3,500); array2=ones(3,700); array=[array1, array2]; I did the following in python: array1=np.zeros((3,500)) array2=np.ones((3,700)) array=numpy.concatenate((array1, array2), axis=2) however this gives me different results when i access try to "array[0,:]" is there a way in python to put arrays in one array similar to matlab. Thank you 回答1: concatenate((a,b),1) or hstack((a,b)) or column_stack((a,b)) or c_[a,b] From

Concatenate hex numbers in C

巧了我就是萌 提交于 2020-01-12 18:49:59
问题 I've been trying to concatenate 4 hex numbers and can't seem to do it. Example: int a = 0x01; int b = 0x00; int c = 0x20; int d = 0xF1; //Result should be 0x010020F1 The results that I am getting using sprintf and bitwise operations always cut off zeros, giving me answers like 1020F1, which is much different than what I want. Anybody have a better method? 回答1: Supposing unsigned int a,b,c,d; unsigned int result = (a<<24) | (b<<16)| (c<<8) | d; But this is essentially implementation dependent

Concatenate hex numbers in C

谁说胖子不能爱 提交于 2020-01-12 18:49:03
问题 I've been trying to concatenate 4 hex numbers and can't seem to do it. Example: int a = 0x01; int b = 0x00; int c = 0x20; int d = 0xF1; //Result should be 0x010020F1 The results that I am getting using sprintf and bitwise operations always cut off zeros, giving me answers like 1020F1, which is much different than what I want. Anybody have a better method? 回答1: Supposing unsigned int a,b,c,d; unsigned int result = (a<<24) | (b<<16)| (c<<8) | d; But this is essentially implementation dependent

ORDER BY suddenly conflicting with VARCHAR concatenation in TSQL

心不动则不痛 提交于 2020-01-11 11:45:46
问题 I have code in Sql Server 2008 which concatenates some strings from a query into a variable using the tried-and-true SELECT @VAR = @VAR + FIELD FROM TABLE ORDER BY OTHERFIELD syntax. This is my exact SQL: SELECT @SQL = @SQL + ISNULL(FORMULA, CASE WHEN USEMAP = 1 THEN 'dbo.getFieldTranslation('+CONVERT(VARCHAR,ROWID)+', [' + ISNULL(ENCOMPASSFIELD,'') + '])' ELSE '[' + ISNULL(ENCOMPASSFIELD,'') + ']' END ) + ' AS "' + FILECOLNAME + '",' + @CRLF FROM dbo.EXPORTMAP_EX WHERE WAREHOUSEID = @WHSID