This is my first question here and I hope it is simple enough to get a quick answer!
Basically, I have the following code:
$variable = curPageURL();
$query = 'SELECT * FROM `tablename` WHERE `columnname` LIKE '$variable' ;
If I echo the $variable, it prints the current page's url( which is a javascript on my page)
Ultimately, what I...
Given some unknown input, how do you tell which variables are being substituted into a (s)printf statement?
printf("%s %s", "a", "b"); // both used
printf("%s", "a", "b"); // only the first one used
printf('%1$s %1$s', "a", "b"); // " "
printf('%s %1$s', "a", "b"); // " "
printf('%1$s %s %1$s', "a", ...
Every searches I made only included solutions for variables like this: $('#div'+ id)
I need to delete a row.
var row = $(this).parent().parent().parent().find('tr#' + id).html();
I'd like to use the "row" name instead of "$(this)...remove();"
...
Before you ask... I don't plan to actually do this. It's bad practice for obvious reasons. I'm just curious if it is possible.
In javascript, you can use bracket syntax to make variable-variables in global scope:
var var_name = 'my_var',
var_value = 'my_value';
window[var_name] = var_value;
alert( my_var ); // Works! alerts user...
I'm new to script writing and can't get this one to work. I could if I moved the files to a path without a space in it, but I'd like it to work with the space if it could.
I want to extract a bunch of Office updates to a folder with a .cmd file. To make the batch file usable on any computer, I set a path variable which I only have t...
Hi, I am incredibly new to Python and I really need to be able to work this out. I want to be asking the user via raw_input what the module and grade is and then putting this into the dictionary already defined in the Student class as grades. I've got no idea what to do! Thanks in advance!
students = [] # List containing all student obj...
I can use isset($var) to check if the variable is not defined or null. (eg. checking if a session variable has been set before)
But after setting a variable, how do I reset it to the default such that isset($var) returns false?
...
Hello guys, I was wondering if you could help me with the following:
I am passing some information filled in a form to the next page to show. I am using $_POST method. Although the information is shown in the browser when checking the code is shows an Notice: undefined index error and there is no trace of the value passed where it shoul...
Hello All,
Is there a way to get user-defined php functions, variables, constants from a php file?
Following functions are not the best way to do so because they get all decalred
functions/vars/constants (with hundreds of php's built-in constants and internal php functions):
get_defined_vars
get_defined_functions
get_defined_consta...
Hello All,
Is there a way to read a variable at top which is defined some where at the bottom.
Here is an example of such situation:
<!--this image is somewhere on top of the page-->
<img src="/<?php print logoPath(); ?>" border="0" />
// this code is somewhere on bottom of the page
$logo_query = "select logo_path from table where id ...
I'm trying to update a Javascript variable that controls a scrolling script based upon some Ajax code. The Ajax code is supposed to add to the JS Var when conditions are true in the Ajax script. Is there any way to trigger this?
Thanks!
edit: I'm not sure how to change the value of the variable. I've tried changing it via the Ajax but ...
Hi ,i am new to Javascript.
<html>
<body>
<script type="text/javascript">
var x=5;
document.write(x);
document.write("<br />");
var x
document.write(x);
</script>
</body>
</html>
Result is :
5
5
so when the second time when its declared x should be
undefined but it takes the previous value of x.please explain this?.Wh...
Hello,
I recently came accross some blog posts about jQuery performance (i.e. http://net.tutsplus.com/tutorials/javascript-ajax/10-ways-to-instantly-increase-your-jquery-performance/) and it was stated in all of them that we should cache the jQuery objects to javascript variables.
What I need to know, though, is if this applies to $(th...
I have the following variable being dynamically set by user generated content:
$variable = <a href="http://www.mysite.com/article">This Article</a>;
When this variable is set, I then echo it as such
echo $variable;
I know that as is, this wouldn't be valid because I would need to escape the double quotes etc.
I'm a total beginn...
What is the difference between these four PHP statements?
if (isset($data)) {
if (!empty($data)) {
if ($data != '') {
if ($data) {
Do they all do the same?
...
Hi all..
In preprocessors, we can have switch between macros like,
#define BUFF(n) BUFF_##n
So, BUFF(1) would get replaced by BUFF_1, BUFF(2) would get replaced by BUFF_2 and song
Can this be applicable to C variables? i.e., choosing between similar variables dynamically. I understand it is a weird situation and can be handled using...
I have a variable that contains the following space separated entries.
variable="apple lemon papaya avocado lemon grapes papaya apple avocado mango banana"
How do I remove the duplicates without sorting?
#Something like this.
new_variable="apple lemon papaya avocado grapes mango banana"
I have found somewhere a script that accompli...
I am writing a program to calculate the shortest path between two nodes. In my program I have one custom class called NodeList, which contains an ArrayList of strings (representing nodes) along with a distance. I am using Dijkstra's algorithm which involves opening up the shortest edge from each node. So, I use this loop to tabulate the ...
Hello All,
I couldn't solve that mistery question in SQL SERVER.
Here an example that I tried to do and it didn't work.
DECLARE @Total int;
SET @Total = (SELECT COUNT(*)-10 FROM MYTABLE)
SELECT TOP @Total IdColumn FROM MYTABLE
How can I use the following query
SELECT COUNT(*)-10 FROM MYTABLE
as an integer variable, somewhere el...
Hello,
I want to know how can I encapsulate the result(substr($text, 12)) of the variable $opt into itself(put the result replacing the expression substr($text, 12)), but how I can do this?
If needed. Here is my code:
my $text;
my $opt = substr($text, 12);
if ($command =~ /^Hello World Application/i) {
print "$opt\n";
}
# More code...