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 } }
×
×
  • 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.