Jump to content

GrooN

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Everything posted by GrooN

  1. If I understand your question right, you want to know what to edit in which function, to rename the files to random numbers. As I see it the resize_upload_image() function creates two files, a thumbnail and an image. So to rename them to random numbers you would have to edit the variables thumb_location and img_location as following: $random_number = rand(0,999); // The random number, you wanna set as suffix. $img_location = $path.$img_name."-".$random_number; $thumb_location = $path."thumb-".$img_name."-".$random_number; Hope you can use it pal
  2. You can't display it because it returns false ^^
  3. GrooN

    checkboxes

    hehe, there isn't anything as a good easy pie mistake xD Its good to see that you got it working ^^
  4. Try this if ($file != "index.php" && $file != "thumb1.jpg")
  5. sorry, wrong regexp pattern use this: "/^([^\.\\]+*\.)+[^\.\\]+$/"
  6. Well no, actually that script deletes the folders too. But you can make the script more advanced, and check if the file is written like a file name like this: if (!preg_match("/^[^.].*[^.]/$", $file)) // If file doesn't match pattern skip. continue; Note: This wont work if the folder is named something like "my.folder" since this is name based.
  7. I think that can be done much faster <?php $files = glob("*"); foreach ($files as $file) { if ($file != "index.php") unlink($file); } ?>
  8. You know theres a formula for this right? a b c d how many different ways can that be show: 1 * 2 * 3 * 4 = 24 24 possible ways to display that.
  9. GrooN

    checkboxes

    Yea, sorry about that I had to leave for acting class Anyway, its good that you see my point ^^. And of course the $nRow should have been set to 1 instead of 0 ^^ So it says option1, 2 and 3 And i forgot to add a pretty important thing in the script (as I said I was in a hurry ). In the value of the hidden, the Id should be written. So now would the purpose of the hidden be to make it possible for the script to locate what to edit. Locating it by its Id ^^ An example would be: $id = $_REQUEST['row']; $query = "UPDATE options SET 'value' = 'another value' WHERE ('id' = '{$id}')"; You see my idea?
  10. GrooN

    checkboxes

    Display data file <?php $result = mysql_query("SELECT * FROM {$table}"); if (!$result) { die("Query to show fields from table failed"); } $fields_num = mysql_num_fields($result); echo "<h1>Table: {$table}</h1>"; echo "<table border='1'><tr>"; // printing table headers for($i=0; $i<$fields_num; $i++) { $field = mysql_fetch_field($result); echo "<td>{$field->name}</td>"; } echo '<td>Update</td>'; echo "</tr>\n"; // printing table rows while($row = mysql_fetch_row($result)) { echo "<tr>"; // $row is array... foreach( .. ) puts every element // of $row to $cell variable $nRow = 0; foreach($row as $cell) { echo "<form action='' method='post'>"; if ($cell == yes){ echo '<td><input type="checkbox" name="option' . $nRow . '" checked="checked" /> </td>'; $nRow++; } else if ($cell == no) { echo '<td><input type="checkbox" name="option' . $nRow . '" /></td>'; $nRow++; } else if(is_string($row)) { echo "<td>$cell</td>"; } else { echo '<td><input type="hidden" name="row" value="" /></td>'; } echo '<td><input type="submit" value="submit" /></td>'; echo "</form>"; } echo "</tr>\n"; } mysql_free_result($result); ?> and the submit.php <?php // database connection here $name = $_POST['name']; $op1 = $_POST['option1']; $op2 = $_POST['option2']; $op3 = $_POST['option3']; if (is_null($op1)) { $op1 = no; } if (is_null($op2)) { $op2 = no; } if (is_null($op3)) { $op3 = no; } $q = "INSERT INTO options (id, name, option1, option2, option3) VALUES ('', '$name','$op1','$op2','$op3')"; if (mysql_query($q)) { echo 'thanks!'; } else (mysql_error()); ?> I haven't tested it, but it should work ^^
  11. GrooN

    checkboxes

    To solve the problem with the unique forms you can start out by First make an "id" column to the table, and set it to auto increase ^^. Then make sure, you create a new form for each set of boxes. And then create a hidden input with a name similar to all the other, but with the value of the id of the row. example upcoming
  12. GrooN

    checkboxes

    I can't really see your problem else than you need the finish tag for the <form> in the html code. Actually your code looks pretty good, and simple? And about the submit button: When you press a button with the type submit, it will just execute the form. It really doesn't matter how many submit buttons you have, they'll all have to same function ^^
  13. hehe, okay. Didn't know that Anyway thanks for updating me ^^
  14. oh, okay. So this dude has to write all the special characters in html code? :-\ (http://webdesign.about.com/library/bl_htmlcodes.htm)
  15. Hmm... I think you'll need to use the "iso-8859-2" charset
  16. Hi, GrooN here! I've been on a few forums for a long time, but they didn't really have what i needed. There was too much inactivity and people weren't that fun to talk with when it came to the subject "PHP" So therefore I've searched the internet thin to find this great forum / blog / more ! I look forward to chat and have a great time with all you guys ^^, see you out there !
×
×
  • 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.