Jump to content

Zerpex

Members
  • Posts

    40
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Zerpex's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi, I'm trying to make a header("Location: "); where I want, the url I'm currently on, without any ?id=1 etc, so I get /category/editCategory/ instead of /category/editCategory/?id=1 How can I do that, when I do $_SERVER, sometimes I see one called $_SERVER['REQUEST_URL'] (yep, URL, not URI) - which does exactly what I want, but it's only sometimes I have it :S Is there a nice way of doing it? Best regards, Lucas R.
  2. In my head if(empty($brandid) && empty($_FILES['image']) && empty($_POST['productDesc'])) should be true, if just one of them is empty (which the image and textarea) is at the moment, but it still returns false, so it proceed to the actual imageupload :/ it should do the error
  3. Update, I figured out the image thing! I was using $_POST instead of $_FILES! But still having the other problem with the textarea
  4. Hia, I'm having a form, containing an image upload, a textarea and some other fields. I have a fileupload, where I check if the upload thingy is empty, with if(empty($_POST['image'])) { echo "Error"; } else { //Do the imageUpload here } using the empty, isn't working for some reason, it proceed to the else anyway. Also, I have a textarea with name="productDesc", when I do: <?php var_dump($_POST); ?> It doesn't return the textarea, and I can't see why it doesn't. Also the textarea proceed to the 'else' in the if else in the following code: http://codepad.org/wMd6SnoK Having a lot of questions these days Thank you guys!
  5. Hi, I'm having an image upload function I did create for few weeks ago - it has an variable called $newname, which contains the path and file. I'm then using the imageupload() function in another function called EditFrontPage(), which is used to 'update' some content. If I update the image, it runs the imageupload function, which is great, it resize and optimize the image, and it moves it to the folder I specified. What I then want, is within' my EditFrontPage() function, is to echo out the $newname variable from the imageUpload function. is there a way to do this? in a smart way? If my code is needed, you can take a look at it here: http://codepad.org/poKNSU5H Thank you a lot guys!
  6. Hi again again, I'm making a search, where I use BETWEEN, if I have et $maxPrice is 2147483647 and $minPrice is 0 - (result from var_dump()), when I then use it in PDO, it's like it get another 'maxPrice' because it only show results under "200000" in price, but if I define, a static value of 2.000.000 it gets all the results as it should, but not when doing it with params in PDO :/ I also do a var_dump() of the maxprice, after the PDO, and the value is still the same as above (the 2147483647), and I've been spending loong time now, trying to find out why! Maybe someone here can spot the error! http://codepad.org/VIsk0UI8 Thank you a lot!
  7. Yep thorpe, It was just my copy/pasting, with code, I know that I had value for all my comparsions! Thank you anyway guys!
  8. Hi, I'm a little confused about the ternary operator, and how I should use it in following example. I have a list of, form radio's, where I want to check, if the $_GET['type'] etc is set to 'typeAll' the radio with the value 'typeAll' should be checked, else it shouldn't be checked. This is what I have currently: <ul> <li><strong>Vælg type</strong></li> <li><input <?=($_GET['type'] == 'value' ? 'checked' : '');?> type="radio" name="type" value="typeAll" />Alle Typer</li> <li><input <?=($_GET['type'] == 'value' ? 'checked' : '');?> type="radio" name="type" value="typePerson" />Personbiler</li> <li><input <?=($_GET['type'] == 'value' ? 'checked' : '');?> type="radio" name="type" value="typeVare" />Varebiler</li> <li><input <?=($_GET['type'] == 'value' ? 'checked' : '');?> type="radio" name="type" value="typeMotor" />Motorcykler</li> <li><input <?=($_GET['type'] == 'value' ? 'checked' : '');?> type="radio" name="type" value="typeTrailer" />Trailer</li> </ul> <ul> <li><strong>Vælg mærke</strong></li> <li><input <?=($_GET['type'] == 'value' ? 'checked' : '');?> checked type="radio" name="brand" value="brandAll" />Alle mærker</li> <li><input <?=($_GET['type'] == 'value' ? 'checked' : '');?> type="radio" name="brand" value="brandSuzuki" />Suzuki</li> <li><input <?=($_GET['type'] == 'value' ? 'checked' : '');?> type="radio" name="brand" value="brandYamaha" />Yamaha</li> <li><input <?=($_GET['type'] == 'value' ? 'checked' : '');?> type="radio" name="brand" value="brandVW" />VW</li> <li><input <?=($_GET['type'] == 'value' ? 'checked' : '');?> type="radio" name="brand" value="brandBMW" />BMW</li> <li><input <?=($_GET['type'] == 'value' ? 'checked' : '');?> type="radio" name="brand" value="brandPeugoet" />Peugoet</li> <li><input <?=($_GET['type'] == 'value' ? 'checked' : '');?> type="radio" name="brand" value="brandMercedes" />Mercedes</li> </ul> <ul> <li><strong>Vælg pris</strong></li> <li><input <?=($_GET['type'] == 'value' ? 'checked' : '');?> checked type="radio" name="price" value="priceAll" />Alle priser</li> <li><input <?=($_GET['type'] == 'value' ? 'checked' : '');?> type="radio" name="price" value="price0-25" />0-25.000 DKK</li> <li><input <?=($_GET['type'] == 'value' ? 'checked' : '');?> type="radio" name="price" value="price25-50" />25.000-50.000 DKK</li> <li><input <?=($_GET['type'] == 'value' ? 'checked' : '');?> type="radio" name="price" value="price50-100" />50.000-100.000 DKK</li> <li><input <?=($_GET['type'] == 'value' ? 'checked' : '');?> type="radio" name="price" value="price100-200" />100.000-200.000 DKK</li> <li><input <?=($_GET['type'] == 'value' ? 'checked' : '');?> type="radio" name="price" value="price200p" />over 200.000 DKK</li> </ul> <ul> I can manually write in the value in the ternary thingy, because I'm going to connect the inputs to a DB very soon! Best regards, Lucas R.
  9. Hia Muddy, the problem is, I need to be able to search, etc if I have a text input thingy, it should be able to search in columns, like name, price, brand, description, km, usage etc. But I will try find a solution! Thank you alot!
  10. Hi guys! I'm trying out fulltext search in MySQL, when I do my query like this: ALTER TABLE `products` ADD FULLTEXT(`name`, `breadcrumb`, `description`, `brand`, `price`, `year`, `km`, `usage`, `type`); I get an error, that it can't add the FULLTEXT to price like this: Column 'price' cannot be part of FULLTEXT index Is it because I've set it to float, that I can't do it? Best regards, Lucas R.
  11. ^^^ That will search the include_path first, then will look in the folder where the main requested file is (index.php), then in the current working directory. It will only check the inc folder if the include_path is not set. If you have more than one db.php file present and the first one found is not setting the $db variable, you can get the symptom you have reported. Edit: I would recommend echoing something unique in the 'correct' db.php file so that you know if it is the one that is actually being included. You saved my day! There was a file called db.php somewhere on the server, which did ruin it totally! I renamed my db.php to db_connect.php Thank you soooo much!
  12. Will see If $thisistherightdbvar works, I'm at work in 7 mins Thank you!
  13. When doing includes I do like on index.php: <?php include_once('inc/functions.php'); ?> If the file structure is like this: index.php inc/functions.php inc/db.php And in functions.php I include like: <?php include_once('db.php'); //functions go after this line ?>
×
×
  • 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.