Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 257 Vote(s) - 3.53 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Guess random number

#1
this is my first try with php i'm having an error i'm not sure why this is happening hope someone might help .


Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


The error i'm having is : Notice: Undefined index: hasStarted in C:\xampp\htdocs\test\random.php on line 3[/hide]
Reply

#2
well i know but i heard that in php you don't need to assign a value to a variable before using it.

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.

this is quoted from w3resource .
Reply

#3
Quote:(04-02-2017, 01:27 PM)Vi-Sion Wrote:

[To see links please register here]

The error i'm having is : Notice: Undefined index: hasStarted in C:\xampp\htdocs\test\random.php on line 3

Your problem is written in plain english "Undefined index: hasStarted in C:\xampp\htdocs\test\random.php on line 3"
You are trying to access the variable $_SESSION["hasStarted"] but is is not set.
You can check if a variable is set with the method isset()
Reply

#4
Quote:(04-02-2017, 01:55 PM)Vi-Sion Wrote:

[To see links please register here]

i also heard it takes a default value if i didn't give it one so if used as a boolean and didn't give it a value it's default value should be false

Yes. In php an unset variable will always give you false.
But in your code, you are trying to access a variable index, that will always trow you an error if it is unset.
Reply

#5
i also heard it takes a default value if i didn't give it one so if used as a boolean and didn't give it a value it's default value should be false
Reply

#6
Quote:(04-02-2017, 01:47 PM)Vi-Sion Wrote:

[To see links please register here]

well i know but i heard that in php you don't need to assign a value to a variable before using it.
Yes you do.

Quote:(04-02-2017, 01:47 PM)Vi-Sion Wrote:

[To see links please register here]


Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.

this is quoted from w3resource .
This quote states that you don't have to declare variables, witch is right.
But you do have to set a value to a variable before using it.
Reply

#7
Thanks for your help i got it, much appreciated.
Reply

#8
Quote:(04-02-2017, 02:12 PM)Vi-Sion Wrote:

[To see links please register here]

Thanks for your help i got it, much appreciated.

I am glad I helped
Reply

#9
Here's my final code i'll be glad to get comments if there's anything i should fix in my code.

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.

[/hide]
Reply

#10
I recommended to using Gaussian Distribution , which implemented as random number generator.

[To see links please register here]

[To see links please register here]

[To see links please register here]


I hope that help , comrade.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through