Jump to content

WoHe

Members
  • Content Count

    18
  • Joined

  • Last visited

Everything posted by WoHe

  1. No, but I have tried commenting everything out so it was the same and I saw no difference..
  2. No indeed, when I made the jsfiddle I expected it to lag, but it doesn't, it only lags in my browser via my localhost. (same browser as where I open the fiddle)
  3. Thanks, but it (indeed) doesn't give any visible changes to the lags. I have also commented almost all my other code out to check if that causes the problem, but nothing... I'm testing my site with a localhost (using MAMP), do you know if this can be the problem?
  4. I have created some js file to change the height of my header when a user scrolls through it. The goal is that the header starts at 90% of the window height (90vh in css) when the page is loaded and it shrinks down to 80px when a user starts scrolling down (if the user goes back to the top of the page it will again grow to 90%). Also I want a gif playing in the back behind the header. The code works, but when you scroll down/up it seems to be lagging, but I would like it to fluently do these actions. Can anyone can give me some hints on how to improve the speed? Here is my code for t
  5. WoHe

    Grid view does not work

    Oh thanks a lot! I keep making this mistake everywhere...
  6. So the grid view that is explained here does not work in my own document. This is the code I'm using: /*GRID VIEW*/ [class*="col"] { width: 100%; } @media only screen and (min-width: 720px) { .col1 {width: 8,33%;} .col2 {width: 16,67%;} .col3 {width: 25,00%;} .col4 {width: 33,33%;} .col5 {width: 41,67%:} .col6 {width: 50,00%;} .col7 {width: 58,33%;} .col8 {width: 66,67%;} .col9 {width: 75,00%;} .col10 {width: 83,33%;} .col11 {width: 91,67%;} .col12 {width: 100,00%;} } /*LAYOUT*/ * { font-family: sans-serif; border: 0.1px sol
  7. So my question is: how can I insert variables into my mysql queries in php? This is my code now, I would like to use the $me and the $friend variables to work in the sql query: function newChat($me, $friend) { global $conn; $sql = "SELECT id FROM chats WHERE (person1 = $me AND person2 = $friend) OR (person1 = $friend AND person2 = $me);"; mysqli_query($conn, $sql) or die('Error querying database.'); echo "check <br />"; $result = mysqli_query($conn, $sql); $row = mysqli_fetch_array($result); while ($row = mysqli_fetch_arra
  8. I was wondering if there is any way to set unique values to each cookie. I want to use these cookies on my website to see if the visitor has already visited my website once, but without asking any information from them. This way I want to store this unique value in my database each time someone opens my website, and I will be able to see if there have been - for example - 20 different visitors in the past month, or if the same person has visited my website 20 times. All my code is already written and working, I only need a way to set a different unique value to each cookie I set
  9. Ok, thanks a lot!
  10. So I have rebuild the code piece by piece and I have found the problem. The problem was in this piece of the code: echo "no cookie found <br />"; I don't know why this would cause a problem, but I don't need it anyway for the actual code, it was just to check if my code works (ironically). I'm still learning php so if you could figure out how this causes a problem, could you please explain it to me? Thanks already!
  11. You could maybe try to float:right the image. I'm also new , but I had a similar problem and it worked when I used this float:right.
  12. I had to set the domain to "localhost" to let the code work, I have now also set an expire date. The only remaining problem is that setcookie($cookiename, $cookievalue, time() + (86400 * 30), "/", "localhost"); doesn't work in an if-statement (as mentioned earlier), it does work outside and inside of any function, but not inside of the if-else statement... For example: This works: setcookie($cookiename, $cookievalue, time() + (86400 * 30), "/", "localhost"); This works: function set($cookiename, $cookievalue) { setcookie($cookiename, $cookievalue, time() + (86400 *
  13. Your typed "right:0ox" instead of "right:0px", maybe this causes the problem, also I don't think the "right:0px" is necessary, by using the following code it should be on the bottom of the page and take up all the available width: <div style="bottom: 0px; left: 0px; position: absolute; width 100%; background-color:red;"> Status bar <div></div> </div> Also you used "background:red" instead of "background-color:red".
  14. Could you tell me more specific what you want to do? As I see it, you've got in input field with type=text and you want to copy the text from this input field into another element. I should do this with javascript: var text = document.getElementById("[id of the input field]").value; document.getElementById("[id of the other element]").innerHTML = text;
  15. And what do I need to set the $expires parameter if I don't want it to expire? Also, I don't think localhost is be the issue, because in all the other cases it does work, except for the case where it is set in the if-statement... PS: I've set the expire parameter to time() + (86400 * 30) and it still doesn't work...
  16. That is what I thought too, but I keep refreshing the page with this exact code and it keeps telling "no cookie found not able to set cookie".
  17. Thanks, but it also doesn't work when I use it in an if-statement, like this: $cookiename = "test"; $cookievalue = "test"; if(!isset($_COOKIE[$cookiename])) { echo "no cookie found <br />"; setcookie($cookiename, $cookievalue, false, "/", "localhost"); if(!isset($_COOKIE[$cookiename])) { echo "not able to set cookie <br />"; } else { echo "cookie '" . $_COOKIE[$cookiename] . "' is set correctly <br />"; } } else { $cookievalue = $_COOKIE[$cookiename]; echo "cookie found: " . $cookievalue . "<br />"; } (this is btw my
  18. I am trying to set a cookie when there is no cookie from my website found on the user's PC, but the following line of code doesn't work inside a function: $cookiename = "test"; $cookievalue = "tests"; setcookie($cookiename, $cookievalue, false, "/", "localhost"); It does work however if it is placed outside of the function. For exampe, the code above works, but the next code doesn't: $cookiename = "test"; $cookievalue = "tests"; function addCookie() { setcookie($cookiename, $cookievalue, false, "/", "localhost"); } addCookie();
×
×
  • Create New...