Jump to content

npsari

Members
  • Posts

    393
  • Joined

  • Last visited

Everything posted by npsari

  1. Oh, cool, it worked, thank you
  2. Hi everyone, i have a problem, look at this small PHP code $currency_symbol = '£'; \\\ Thats £ print "Price: $currency_symbol5"; The item price is 5 pounds, but because the 5 is attached, the code thinks the string name is $currency_symbol5 It does not work, to solve this, i put a space between them, like this... $currency_symbol = '£'; \\\ Thats £ print "Price: $currency_symbol 5"; But it looks funny on my website, it looks like this £ 5 How to solve this, thank you in advance
  3. thank you ginerjem yes, php is my hobby, nothing serious, just making websites for fun or little money uploading images is the most annoying code on php, for the past 10 years, i never understoud this part, or never found a code online which does everything this code I am using above, i found online also, but it does not resize images, and it seems to have several issues i wonder how websites like eBay have such sophosticated image uploading tools, they must be really PHP gurus
  4. Thank you guys, thank you Gizmola So php is changing, I don't have time to learn this new mysqli or PDO Is it wrong saving all images as .jpg? It makes life little easier for me Yes $get_current_user is always small letters, because when the user creates an account, their username is converted to lower case first, then saved in the mySQL database, I really wonder how does it become capital letter later, i need to check my codes again, to make sure $get_current_user is always small letters
  5. Thank you, but where do I put this strtolower function? As you can see from the code above, it is already there, but it is doing nothing, because the first letter of the image name still becomes capital letter for some reason, even the $get_current_user is all lower case, so something in this code is turning the first letter of the image from a small letter into a capital letter
  6. Hi everyone, I have a script below, which uplads an image, however, the image name always starts with a capital letter, I want all letters to be small, how to adjust this please, thank you $target_dir = ""; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $target_file = "$get_current_user.jpg"; $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION)); // Check if image file is a actual image if(isset($_POST["submit"])) { $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); if($check !== false) { echo ""; /// was File is an image $uploadOk = 1; } else { echo "File is not an image<br>"; $uploadOk = 0; } } // Check file size if ($_FILES["fileToUpload"]["size"] > 10000000) { echo "Sorry, this image is too large, please resize using Paint<br>"; $uploadOk = 0; } // Allow certain file formats if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" ) { echo "Only JPG, JPEG, PNG & GIF files are allowed<br>"; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "There was an error<br>"; } else { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "Uploaded successfully (You may need to clear Cache to see the new image)"; mysql_query("UPDATE user SET user_image = 'https://.../images/users/$get_current_user.jpg' WHERE user_name = '$get_current_user' "); } else { echo ""; /// was Select a suitable image, file not uploaded yet } }
  7. Okay, I've done it Thank you much guys <script type="text/javascript"> <!-- function delayer(){ document.getElementById("myDiv").style.display="block"; setTimeout("hide()", 5000); // 5 seconds } function hide() { document.getElementById("myDiv").style.display="none"; } //--> </script> <div id = "myDiv" style="display:none"><img id = "myImage" src = "/images/logo.png"></div><br> <body onload="setTimeout('delayer()', 8000)">
  8. okay, i've done the show but the hide i cant please help <script type="text/javascript"> <!-- function delayer(){ document.getElementById("myDiv").style.display="block"; } //--> </script> <div id = "myDiv" style="display:none"><img id = "myImage" src = "/images/logo.png"></div><br> <body onload="setTimeout('delayer()', 8000)">
  9. Thank you both I've done it like this, but it is not working: <script type="text/javascript"> <!-- function delayer(){ function show() { document.getElementById("myDiv").style.display="block"; setTimeout("hide()", 5000); // 5 seconds } function hide() { document.getElementById("myDiv").style.display="none"; } } <body onload="setTimeout('delayer()', 8000)"> //--> </script>
  10. Hello I have this code which shows an image for 5 seconds then it disapears However, instead of clicking a button, I want this to happen automatically 8 seconds after page load <input type = "button" value = "Show image for 5 seconds" onclick = "show()"><br><br> <div id = "myDiv" style="display:none"><img id = "myImage" src = "/images/logo.png"></div><br> <script type = "text/javascript"> function show() { document.getElementById("myDiv").style.display="block"; setTimeout("hide()", 5000); // 5 seconds } function hide() { document.getElementById("myDiv").style.display="none"; } </script> If there are any experts out there, please provide code
  11. ohhhh, ok ok, i get it, thank you for information By the way, what manual page? I thought you meant the link you are giving me where is this manual page you talking about?
  12. Thank you for the information, I thought the problem is solved :-\ I really loved this split function!!! I tried using parse_url() is giving me the whole thing v=ruJ1uFf9hy4&feature=g-vrec If you have some free time, why not share script, and I will do a favor back to you
  13. I never understood the PHP versions and packs, I use all PHP codes and they always work, never got an error message telling me this PHP code is too old. So you mean this script will not work in the future?
  14. Really? Why is it discouraged? It is amazing, the script i posted is doing the job, please explain!
  15. $a = "http://www.youtube.com/watch?v=ruJ1uFf9hy4&feature=g-vrec"; $a = split('[=&]', $a); echo $a[1];
  16. Thank you Jessica But your result is >>>>>>>>>>> =ruJ1uFf9hy4&feature=g-vrec I want this >>>>>>>>>>>>>> ruJ1uFf9hy4 Moderator, why not share the script, you sound like an expert
  17. Hello, I am trying to extract some letters from a Youtube URL I want to extract the letters between '=' and '&' Which are 'ruJ1uFf9hy4' The code I have does not do the whole job :-\ $string = "http://www.youtube.com/watch?v=ruJ1uFf9hy4&feature=g-vrec"; $result = substr($string, 0, strpos($string, "=")); echo "$result"; /// Will echo http://www.youtube.com/watch?v Please give code!
  18. Hello. Can you tell how to obtain the Day from the Date My Date format is as follows: Y-m-d I created a code, but it gives me the year... $date = date("Y-m-d"); $get_day = strtok($date, "-"); print"$get_day"; Programming is not my skill
  19. npsari

    mySQL search

    Thank you so much. Yesssss, this is so simple, I knew it exists somewhere $q = "SELECT * FROM info WHERE MATCH ( interests ) AGAINST ('$search_term')"; $res = @mysql_query($q); while($r = @mysql_fetch_array($res)) { }
  20. Yes, probably you will have to save each product ID as a new Cookie. If you don't want many Cookies, jut update same Cookie, and then, explode the Cookie when the buyer is done shopping. It is easy, I would rather build my own Shopping cart than download a ready one, but that is me!
  21. I always wanted to create a shopping cart for my website, however, i lost enthusiasm when I've seen amazing shopping carts from other websites. You click on a product, and you get small animations, showing you they've been added to your cart, and so on. I am a noobie, and this is too much for me.
  22. npsari

    mySQL search

    Hello. I have a table which is called [info], I store my members information there. Inside this table, there is a row called [interests] which contains all the members’ interests. I am creating a search tool & I wish MySQL to match as many keywords as possible. So if the user searches for: LOVE TO GO OUT AND HAVE COFFEE mySQL will display the member who has as many keywords of this search term as possible These quires search for exact terms only… $q = "SELECT * FROM info WHERE interests LIKE '%{$search_term}%' ORDER BY RAND() "; $q = "SELECT * FROM info WHERE interests = ‘$search_term' ORDER BY RAND() "; I need a MySQL query which will match as many keywords as possible and order the results according to most matching. Is this possible? Or is it a complicated story? Help please.
  23. Done a good job there Thank you for the support
  24. <?php $message = " hi ' bye sup ' hi "; $message2 = str_replace(' ' ', ' . ', $message); print"$message2"; ?> Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/deltacar/public_html/try.php on line 3
×
×
  • 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.