variables

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

Referencing Workbook and Worksheet by Variables

杀马特。学长 韩版系。学妹 提交于 2020-01-13 17:05:48
问题 What is the proper syntax for referencing a different workbook's worksheet? The following code is throwing an error on the last line. Thanks! 'Instantiate Workbook variables Dim mWB As Workbook 'master workbook 'Instantiate Worksheet variables Dim mWS As Worksheet 'master worksheet 'Open Workbook, set variables and reference range Workbooks.Open ("Local 500GB HD:Users:user:Public:file.xlsx") Set mWB = ActiveWorkbook Set mWS = Sheets("Invoices") mWB.mWS.Range("A1").FormulaR1C1 = "Import Date"

Referencing Workbook and Worksheet by Variables

心不动则不痛 提交于 2020-01-13 17:03:25
问题 What is the proper syntax for referencing a different workbook's worksheet? The following code is throwing an error on the last line. Thanks! 'Instantiate Workbook variables Dim mWB As Workbook 'master workbook 'Instantiate Worksheet variables Dim mWS As Worksheet 'master worksheet 'Open Workbook, set variables and reference range Workbooks.Open ("Local 500GB HD:Users:user:Public:file.xlsx") Set mWB = ActiveWorkbook Set mWS = Sheets("Invoices") mWB.mWS.Range("A1").FormulaR1C1 = "Import Date"

How to declare and initialise an array in Swift

主宰稳场 提交于 2020-01-13 14:01:46
问题 I have a class in Swift that I'm trying to write that has a variable of an array of objects. Is there a better way to write this? var myvar: Array<MyClass> = Array<MyClass>() Without the bit after the = sign, the compiler complains about my AppDelegate having no initializers. The above way seems a bit lengthy (though it's no more terse than the c# equivalent, I guess). I'd just like to know if there's a shortcut. Thanks. 回答1: You can initialize the variable with an empty array: var myvar:

Where is nonlocals()?

一曲冷凌霜 提交于 2020-01-13 11:05:54
问题 How do I obtain the non-local variables for the current scope? The functions vars , locals , and globals exist, but is there a function to get the nonlocals ? Why aren't the nonlocals listed when calling vars ? Update My issue is that there's no way to enumerate the variables available in the current scope, as neither vars or globals includes the non-locals AFAICT. I frequently use vars in code such as the following: '{meh[0]}/{meh[3]} {a}{b}{c}'.format(**vars()) Which fails if any of these

Where is nonlocals()?

こ雲淡風輕ζ 提交于 2020-01-13 11:05:14
问题 How do I obtain the non-local variables for the current scope? The functions vars , locals , and globals exist, but is there a function to get the nonlocals ? Why aren't the nonlocals listed when calling vars ? Update My issue is that there's no way to enumerate the variables available in the current scope, as neither vars or globals includes the non-locals AFAICT. I frequently use vars in code such as the following: '{meh[0]}/{meh[3]} {a}{b}{c}'.format(**vars()) Which fails if any of these

JQuery - appending variable to URL, and use it in a href

半世苍凉 提交于 2020-01-13 07:30:25
问题 I can't figure this one out... Could someone please help me en explain how it works to? Goal: Adding a variable to a hard-coded URL, and put the new string into a href Example: var x = "1000"; var y = "http://www.google.com" var result = y + x; <a href="! the value of result !">click here...</a> Edit i'm sorry i meant y + x ofcourse... 回答1: Given this HTML code: <a href="" target="_blank">click here...</a> You would need this bit of js code: (working example http://jsfiddle.net/QUEZL) var x =

listen to service variable change from component angular

我的梦境 提交于 2020-01-13 06:38:13
问题 I have service with variable and method that brings data to that variable export class UserService { userDetails; getUserProfile(){ return this.http.get(this.BaseURI+'/UserProfile').subscribe( res=>{ this.userDetails=res; // console.log(res); }, err=>{ console.log(err); } ); } now I want to check from component when the variable changes and read it. How can I do that ? UPDATE. export class UserService { userDetails; getUserProfile(){ this.http.get(this.BaseURI+'/UserProfile').subscribe( res=>

listen to service variable change from component angular

為{幸葍}努か 提交于 2020-01-13 06:38:06
问题 I have service with variable and method that brings data to that variable export class UserService { userDetails; getUserProfile(){ return this.http.get(this.BaseURI+'/UserProfile').subscribe( res=>{ this.userDetails=res; // console.log(res); }, err=>{ console.log(err); } ); } now I want to check from component when the variable changes and read it. How can I do that ? UPDATE. export class UserService { userDetails; getUserProfile(){ this.http.get(this.BaseURI+'/UserProfile').subscribe( res=>