variables

“Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP

 ̄綄美尐妖づ 提交于 2020-01-07 02:29:27
问题 I'm running a PHP script and continue to receive errors like: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php on line 10 Notice: Undefined index: my_index C:\wamp\www\mypath\index.php on line 11 Line 10 and 11 looks like this: echo "My variable value is: " . $my_variable_name; echo "My index value is: " . $my_array["my_index"]; What is the meaning of these error messages? Why do they appear all of a sudden? I used to use this script for years and I've never had

Use column of parent query in subquery of a subquery

蓝咒 提交于 2020-01-07 02:10:53
问题 With this query: SELECT `id`, `type`, `subtype`, `title`, `shortdesc`, (SELECT COUNT(*) FROM `story_comments` WHERE `parent_id` = t1.`id`) as comments, (SELECT (ROUND( ( SELECT (SUM(`rating` * `count`) / SUM(`count`) ) ) * 2) ) / 2 as result FROM (SELECT rating, COUNT(*) as count FROM `story_ratings` WHERE `parent_id` = t1.`id` GROUP BY rating) as val) as rating, `calls`, `user` FROM `storys` t1 WHERE `open` = 1 AND `modremove` = 0 AND `modblock` = '' ORDER BY `opening` DESC LIMIT 16; I get

Daily Timer to Exempt Days and Allow for DST in UK - FlipClock.js

怎甘沉沦 提交于 2020-01-07 00:35:16
问题 I am just after a bit of advice really relating to the Flipclock.js plugin. I have written the following code with a fair amount of assistance to make the clock countdown every day, which as far as I can tell is working well as I have struggled like mad to find solid documentation online for daily timers doing what I desire. This is for a daily timer to showcase expiry time for a free delivery threshold of 1500 hours, however at weekends this would not be the case. Is it possible to use a

Check if the clicked div id matches with variable

為{幸葍}努か 提交于 2020-01-06 21:02:49
问题 I'm a coding newbie and looking for a way to check in jQuery whether the name of a certain variable corresponds to the ID of a div, and if so fire some code. Unfortunately, something about my syntax is off, and I can't figure out what. For a simple example, I want to click a div and store the ID of the div as a variable, and if I click it again the variable gets cleared. Simply assigning another boolean variable is not possible due to the rest of the code, I require the ID-check-thingy or

Check if the clicked div id matches with variable

无人久伴 提交于 2020-01-06 21:02:25
问题 I'm a coding newbie and looking for a way to check in jQuery whether the name of a certain variable corresponds to the ID of a div, and if so fire some code. Unfortunately, something about my syntax is off, and I can't figure out what. For a simple example, I want to click a div and store the ID of the div as a variable, and if I click it again the variable gets cleared. Simply assigning another boolean variable is not possible due to the rest of the code, I require the ID-check-thingy or

Get the value of a variable with with the same name as the value of a string

谁说胖子不能爱 提交于 2020-01-06 19:58:29
问题 I have a jQuery widget that outputs a table of contents when invoked. I'd like to give users the oppurtunity to specify the ID of each individal element within the contents ( listElementID: 'contents-{index}' by default), so I've come up with a function within the widget to achieve this. There criteria for this is quite simple - Replace {index} with the value of the index parameter that is passed to the function. Replace and other instance of {.*} (I.e. {whatever} with the matching widget

Initialize and allocate multiple variables/objects | Objective C

ⅰ亾dé卋堺 提交于 2020-01-06 19:42:06
问题 How would I turn this: xmlObject *system_domain = [xmlObject alloc] xmlObject *system_description = [xmlObject alloc] xmlObject *system_type = [xmlObject alloc] Into something where I would only have to write xmlObject and [xmlObject alloc] once. xmlObject *system_domain, *system_description, *system_type = [xmlObject alloc] This makes all of them xmlObjects, but does not allocate each one. Any help would be much appreciated. 回答1: If you've got a set of related objects, and being able to

C++ Set value for a char**

耗尽温柔 提交于 2020-01-06 18:32:50
问题 I'm trying to assign a value to a char** variable. In my foo.h I've defined a couple of variables such as #define APIOCTET int #define APILONG long #define APICHAR char #define APISTRING char* Now in my foo.cpp I'm tryng to use a method where APILONG apiInitialize(APISTRING filePath, APISTRING* outputString) { //open text file to where output will be printed //do other stuff, etc.. //return result; } I'd like to assign a value to my APISTRING* outputString but I just can't figure out how to

Swift calculate value of UITextFields and return value

ぐ巨炮叔叔 提交于 2020-01-06 17:59:50
问题 Using swift and Xcode 6, I'm trying to return a value calculated based on content of few UITextFields. I have declared variables var Number1 = Field1.text.toInt() var Number2 = Field2.text.toInt() var Duration = Number1*Number2 Mylabel.text = String ("\(Duration)") The idea is to capture duration from few UI Fields and based on calculation of those values assign that to a variable as well as display it on a label. In line: var Duration = Number1*Number2 Challenge is that I have is that when

Updating a global variable from a function

空扰寡人 提交于 2020-01-06 17:42:32
问题 There is a global variable called numbers. Function one calculates a random number and stores it in mynumber variable. var mynumber; function one (){ var mynumber = Math.floor(Math.random() * 6) + 1; } I need to use it in a separate function as belows. But an error says undefined - that means the value from function one is not updated. function two (){ alert(mynumber); } How to overcome this problem. Is there a way to update the mynumber global variable. 回答1: If you declare a variable with