Jump to content

NLCJ

Members
  • Posts

    129
  • Joined

  • Last visited

    Never

Everything posted by NLCJ

  1. Yes, nothing. Just an enter. Thanks a lot, this also does the job for me.
  2. Hello, I'm creating a program that analyzes information that is exported by another program. That program exports it in this way: Value1 Value2 Value3 Value4 Value1 Value2... In order to insert them in the database, I first have to know how many lines are inserted. They get send through HTML post. I already tried: $lines = explode("\n", $string); $number_lines = count($lines); But this always results in 1. How do I fix this? Regards, Chris
  3. NLCJ

    Counting lines

    I'm sorry, it seems that I've posted (again) in the wrong board. Won't happen again! Link to the topic in the right board (in case somebody finds this one): http://www.phpfreaks.com/forums/index.php/topic,309621.0.html
  4. Hello, I'm creating a program that analyzes information that is exported by another program. That program exports it in this way: Value1 Value2 Value3 Value4 Value1 Value2... In order to insert them in the database, I first have to know how many lines are inserted. They get send through HTML post. I already tried: $lines = explode("\n", $string); $number_lines = count($lines); But this always results in 1. How do I fix this? Regards, Chris
  5. Just figured that out before I refreshed the page to request a lock on this thread. Thanks!
  6. Just found this topic: http://www.phpfreaks.com/forums/index.php/topic,307415.0.html I will let you guys know if it works out. EDIT: It does send it, but the page also changes. How do I fix this?
  7. Hello, I'm trying to automatically submit a (hidden) form once 30 seconds have passed, I already got the countdown and I got it like this: <form name="hiddenform" id="hiddenform"> <input type="hidden" name="ipaddress" value="<?php echo $_SERVER[REMOTE_ADDR]; ?>" /> <input type="hidden" name="time" value="<?php echo date("H:i:s"); ?>" /> </form> That's the form, now I want JavaScript to post it to another page (without changing the page), I didn't come any further than defining some variables... var ipaddress = document.getElementById('hiddenform').ipaddress.value; var time = document.getElementById('hiddenform').time.value;
  8. I'm not really familiar with arrays, lets say I'm still a beginning PHP'er and (almost) never made a function. I get this error: Warning: in_array() [function.in-array]: Wrong datatype for second argument in
  9. Sadly it doesn't work, it gives this error: Fatal error: Call to undefined function mysq_fetch_row()
  10. Smart! I will work on it for a while and let you know how it works out!
  11. Hello, I'm currently creating a little script, and want to assign a random number to a row in the MySQL table as soon as it will be inserted. But that number may not have been used before. How will I do this? I tried if else thingies, but then the code would be very long (just in case it randomly picks 10 times after each other a number that exists). $randomnumber = rand(10000000, 99999999); if(mysql_num_rows(mysql_query("SELECT * FROM table WHERE randomnumber='".$randomnumber."')) == 1) { $randomnumber = rand(10000000, 99999999); if(mysql_num_rows(mysql_query("SELECT * FROM table WHERE randomnumber='".$randomnumber."')) == 1) { $randomnumber = rand(10000000, 99999999); }else { // Insert into database } }else { // Insert into database } I hope you understand my problem. Regards,
  12. NLCJ

    +1 = +2?

    I give up... All solutions offered here will be tried (if someone feels like notifying me about another solution). How do I fix it? Simple: I created a HTML file which refreshes after 3 seconds to the other (PHP) file, then everything will be fine... Regards and thanks, NLCJ
  13. NLCJ

    +1 = +2?

    I guess it still isn't the problem. If I've set it using sessions it shows a white page, and if you close the FancyBox and reopen it it shows the processed page. Even though it still adds 2 to the value! Strange...
  14. NLCJ

    +1 = +2?

    I guess you were right, if I don't use FancyBox it is working. I have to search it in my JavaScript (oh, balls, just started with it yesterday). Thanks a lot.
  15. NLCJ

    +1 = +2?

    (typically some validation logic submitting a form and the actual form being submitted by the browser) I thought this was the problem, since the form was submitting to that page and the javascript was opening that page in the FancyBox. Though the problem persists, even after removing the total 'action=' part... I've checked it, and the php file is only requested once in the whole script.
  16. NLCJ

    +1 = +2?

    Thanks, I think that is the reason. I'm using FancyBox to load that page, the strange thing is that when a cookie exists it shouldn't update the value. If a cookie doesn't exist it will update the value, and directly set a cookie (this means that if the page reloads it won't update the values?). I'm going to Google about it! Thanks!
  17. NLCJ

    +1 = +2?

    I'm using Chrome, but do have FireFox installed.
  18. NLCJ

    +1 = +2?

    This might be useful, I don't know. If I use: mysql_query("UPDATE websites SET views= views + 0.5 WHERE id='".mysql_real_escape_string($_COOKIE['websiteid'])."'"); it adds ALSO 2 to the value. And using: mysql_query("UPDATE websites SET views= views + 5 WHERE id='".mysql_real_escape_string($_COOKIE['websiteid'])."'"); results in adding 10 to the database. Double entries isn't a possibility since I only edited one line... I'm totally confused! :S
  19. NLCJ

    +1 = +2?

    Triple checked it, nothing!
  20. You're asking someone here to create such a system? If you understand PHP just a littlebit (like me) you can create it by using the MySQL database... Believe me, no one will give you a complete system over here. It is a HELP forum.
  21. NLCJ

    +1 = +2?

    I think my server didn't pass its math test... It WORKED using: mysql_query("UPDATE websites SET views= views + 1 WHERE id='".mysql_real_escape_string($_COOKIE['websiteid'])."'"); But now it also adds 2 to the value... What is going on?! Regards,
  22. NLCJ

    +1 = +2?

    Hehe. Tried this before but I guess I made a typo when I did it. Thanks anyway!
  23. NLCJ

    +1 = +2?

    Hello, I know that the title might be a bit confusing, but I've got a problem. When I say that it has to do +1 it does +2. The code I use is located at the top of the page: $d_websitestatistics = mysql_fetch_array(mysql_query("SELECT * FROM websites WHERE id='".mysql_real_escape_string($_COOKIE['websiteid'])."'")); $views = $d_websitestatistics['views']; $newviews = $views+1; echo "UPDATE websites SET views='".$newviews."' WHERE id='".mysql_real_escape_string($_COOKIE['websiteid'])."'<br />".$d_websitestatistics['views']."<br />".$newviews; $newviews is $d_websitestatistics + 2, even though I said it should only add 1. What is the problem? Regards, NLCJ
  24. I've fixed it using reformat_date. Thanks for your suggestions though!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.