Apr 28, 2019 07:10
` function connect(){
$GLOBALS[conn] = new mysqli($GLOBALS[dbhost], $GLOBALS[dbuser], $GLOBALS[dbpass],$GLOBALS[db]) or die("Connect failed: %s\n". $GLOBALS[conn] -> error);
}`
Apr 28, 2019 07:10
RESPONSE: <br />
<b>Warning</b>: Use of undefined constant conn - assumed 'conn' (this will throw an Error in a future version of PHP) in <b>C:\xampp2\htdocs\database.php</b> on line <b>72</b><br />
<br />
<b>Warning</b>: Use of undefined constant dbhost - assumed 'dbhost' (this will throw an Error in a future version of PHP) in <b>C:\xampp2\htdocs\database.php</b> on line <b>72</b><br />
<br />
<b>Warning</b>: Use of undefined constant dbuser - assumed 'dbuser' (this will throw an Error in a future version of PHP) in <b>C:\xampp2\htdocs\database.php</b> on line <b>72</b><br />
Apr 28, 2019 07:09
Ok when I put die('test') at the beginning, it prints to CONSOLE: "test", but when I put i passed die('test') AFTER connect() call, it gives me this long string of text that looks like it's in HTML:
Apr 28, 2019 07:05
response is `<br />
Apr 28, 2019 07:05
I ran the same script without die line you mentioned, and in the error_log of PHP, it says "CODE MATCHES? 1" (break) "1". So count is equal to 1. On the last line in the PHP function I write echo $count and it prints 1.
Apr 28, 2019 07:05
it does not print anything that time. It says RESPONSE: <br /> (I edited function(response) to do: console.log("RESPONSE: " + response).
Apr 28, 2019 07:05
Now it's printing "test" in the console
Apr 28, 2019 07:05
I tried just returning text by setting dataType="text". Then i echo strval($count) and it's still just printing <br />
 

C++ Questions and Answers

Solve problems and approach solutions. Just ask and lurkers wi...
Dec 23, 2016 15:41
nvm got it
Dec 23, 2016 15:39
Hi, i'm using codeblocks and trying out SDL 2.0. I first call the SDL_Init function and then create a window. The program runs, but the window appears for a split second then disappears what could be the problem
on windows
 

Lounge<C++>

Today we're daydreaming about C++26 reflection
Dec 23, 2016 15:36
on windows
Dec 23, 2016 15:35
Hi, i'm using codeblocks and trying out SDL 2.0. I first call the SDL_Init function and then create a window. The program runs, but the window appears for a split second then disappears what could be the problem
Jun 9, 2016 17:31
whats the main difference between std::move and std::copy
Jun 3, 2016 17:19
online it says it's not since it's a C string I can only access it with std::string when i run my program
Jun 3, 2016 17:18
is <string.h> part of the std namespace?
May 30, 2016 16:15
@Puppy please explain why that question is bad?
May 30, 2016 16:15
@pupp
May 30, 2016 16:07
@Puppy ?
May 28, 2016 18:22
great thank you
May 28, 2016 18:17
can someone explain why the compiler does not give an error when you call a function twice (or more), which has a static const member in it, that you assign a new value to it each time? (it still remains the same value from the first call, but why does it not give an error when you attempt to change it with subsequent calls?)
May 18, 2016 15:28
prints the first*
May 18, 2016 15:25
How does a multimap store multiple values to the same key? like if i create a char key to an int ('a'=>1) then another ('a'=>2), and i print it, it always returns the last one i entered. what happens to the old ones (1)?
May 18, 2016 14:48
why does this print 22 instead of 12? int i = 0;
cout << ++i << ++i;
May 13, 2016 20:08
in the definition not the header file
May 13, 2016 20:01
@Borgleader it's just because i thought the header to a function definition specifies which function you want to define. wouldn't class_name::function_name(params) be enough? since you can't overload that method with just a return type being different
May 13, 2016 19:53
hello. when you define a function in a separate cpp file, why is the return type necessary? e.g: void foo::bar(params){definition}
May 12, 2016 20:21
..
May 12, 2016 20:19
im just confused because in switch statements you can't say case val: int a = 5; yet case val: int a; a=5; is. why is the first not allowed yet the second is?
May 12, 2016 20:15
hi im new to C++. if you initialize a variable like so: int a = 5; is this a shorthand for saying int a; a =5; ?
May 10, 2016 23:48
thx
May 10, 2016 23:32
does all allocated memory on the heap get deleted after the main thread is finished?
May 8, 2016 18:24
right
May 8, 2016 18:23
is saying int foo[3] = {1,2,3}; a shorthand for foo[0] = 1; foo[1] = 2; foo[2] = 3; ?
May 6, 2016 18:31
i found nothing
May 4, 2016 23:55
the*
May 4, 2016 23:55
do i have the right idea about private/protected/public inheritance? he highest level of visibility for each of the derived class's inherited members from the base class is the access specifier specified
May 4, 2016 17:25
@JerryCoffin ok
May 4, 2016 17:25
which makes it private by default right?
May 4, 2016 17:22
even private would
May 4, 2016 17:19
hello. this quiz says that putting 'protected' in the third blank is wrong. could you tell me why? imgur.com/wMP1yfL
May 4, 2016 15:00
ok so headers tell the compiler what to "expect" before running the code? so if you want to call say a declared void function foo(), it will look for 'void foo()'
May 3, 2016 18:59
i was just asking for a reason why they made it the standard. the advantages
 

 bin

It's a bin, for binning things.
May 30, 2016 16:06
hey. if i have two functions with the same name and return type, but one takes a parameter 'long' and the other 'double'. if i call the function, and pass '67.5' for example, why is this not ambiguous to the compiler? it will call the one that took a double in this case. yet if i pass say an int, it will not compile
May 6, 2016 18:29
class Shape
{
public:
void setWidth(int w)
{
width = w;
}
void setHeight(int h)
{
height = h;
}
protected:
int width;
int height;
}; //Why can you declare variables after they are assigned a value?
 

C#

General discussions about the c# language, Squirrels | gist.gi...
May 4, 2016 15:00
my bad i'll switch
May 4, 2016 14:59
yeah.
May 4, 2016 14:59
ok so headers tell the compiler what to "expect" before running the code? so if you want to call say a declared void function foo(), it will look for 'void foo()'?
May 4, 2016 14:53
i answered my question. what i meant to ask was what does the compiler use a header file for
May 4, 2016 14:50
what is it that you're doing when you make a header at the compile level
May 4, 2016 14:46
why is it that you need to declare functions before they are called, yet you can declare a variable in a class after it's initialized. like class foo{ foo():var(5){}private: const int var;};