Jump to content

Adam

Moderators
  • Posts

    5,717
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Adam

  1. can you not post the 2 files in question here as whole?? Makes it a lot easier than trying to piece it together.. Also a quick tip, wouldn't it be easier to output as HTML with PHP in it, rather than PHP with HTML in it? Like say: <b>Date:</b> <input type="text" name="date" value="<?php echo $row['date']; ?>" /><br /><br> Adam
  2. It will be treating them as strings and comparing the length. need to convert them to integers.. Look into the parseInt() and parseFloat() functions .. Adam
  3. Ahh I see... Again it's a form problem, but with this one: <form action="display.php" method="post"> ID number: <input type="text" name="id" /><br /><br> <input type="hidden" name="dropdown2" value="<?=$db;?>"/> <input type="hidden" name="radio2" value="<?=$table;?>"/> <input type="submit" value="Edit Article"/> </form> <input type="text" name="id" /> - shouldn't that be "id_num" ? .. as in display.php you're getting the ID with: $id_num = $_POST['id_num']; Adam
  4. He does have it, right at the top.. $id_num = $_POST['id_num']; echo "$id_num"; //echo's out the number from the previous page But I think I see the problem.. echo "<form action=\"$page\" method=\"post\">"; echo "<input type=\"hidden\" name=\"id_num\" value=\"$id\" />"; echo "<input type=\"submit\" value=\"Upload Image\"/>"; echo "</form>"; Shouldn't the second line be: echo "<input type=\"hidden\" name=\"id_num\" value=\"$id_num\" />"; ?? Adam
  5. If it is installed and for some reason not enabled, could try using http://uk.php.net/manual/en/function.ini-set.php to enable it .. Adam
  6. $_SERVER['HTTP_REFERER'] doesn't always have a value .. ... and mtoynbee is saying $PHP_SELF should be: $_SERVER['PHP_SELF'] Adam
  7. Using microtime allows you to calculate how long it takes after the server receives the request for PHP to parse the code and return the result to the user. As Mchl was saying, how long it takes for you to download and display the result can vary depending upon your internet connection, computer speed, browser, etc. Adam
  8. Adam

    UTF-16

    Had a look around but can't find anything to help you, apart from just to suggest looking through the multibyte functions .. http://uk2.php.net/mbstring Adam
  9. PHP's microtime() function... http://uk2.php.net/microtime Adam
  10. Is your web server running Windows or Linux OS?
  11. $text_ad = stripslashes($row['text_ad']); You need slashes to escape the quotes, try removing the "stripslashes()" function.. or use "addslashes()" in the query .. Adam
  12. Can't say how they will have done it without seeing anything but, you'd be best looking into PHP security.. http://www.sitepoint.com/article/php-security-blunders/ - should protect from any further problems! Adam
  13. His printed the sQL out: you're trying to get the ID form $_POST, when you don't have it in your form: echo "<form name=\"newad\" method=\"post\" enctype=\"multipart/form-data\" action=\"\">"; echo "<input type=\"file\" name=\"cons_image\" >"; echo "<input name=\"Submit\" type=\"submit\" id=\"image1\" value=\"Upload image\" />"; echo "</form>"; You need to add an input named ID to be able to get the ID from $_POST.
  14. $id = (int) $_POST['id']; echo $id; Try using that instead of: $id = $_POST['id']; echo "$id";
  15. Could you post the code where $consname2 is set? Something isn't going right there!
  16. We already know what we need, as revraz said, $consname2 is empty. Where is $consname2 given a value?
  17. $sql="UPDATE general SET image= '$consname2' WHERE id= $id"; $query = mysql_query($sql)or die(mysql_error()); echo 'SQL: ' . $sql . '<br />Affected rows: ' . mysql_affected_rows($query); try that .. tell us what it says..
  18. Have you changed it to: $query = mysql_query($sql)or die(mysql_error()); (Note $query =) ??
  19. No. The "where" determines which records get updated - whether it be 1 or 1000. $query = mysql_query($sql)or die(mysql_error());
  20. I'd probably try looping through every folder images are in > saving the path and file name in an array > sorting the array by the file name > selecting top 3.. first idea that came to mind. I don't think people will just create this little app for you, try working on an idea then coming back when you have some code and get stuck or run into problems... Adam
  21. What is happening? change this line to: $sql="UPDATE general SET image= '$consname2' WHERE id= '$id'"; Adam
  22. They're just HTML entities.. http://www.w3schools.com/tags/ref_entities.asp
  23. Or could just use auto_increment in the database and set the starting number to say 79000000 .. ? To do that in PHPMyAdmin just click on the "operations" tab on the table structure view page, should be a field for "auto_increment" .. Or as an SQL query: ALTER TABLE `yourTable` AUTO_INCREMENT = 79000000 Adam
  24. Can tidy your code up a lot- by the way using foreach () to loop through an array is much easier! I don't quite know what you were trying to do with the first for (), perhaps just loop once as there's only one entry in the array? Remember a loop is for repeating code, could have just used: $y2 = explode(",", $x2[0]);.. But I've changed the second for () as an example to show you.. for ($i = 0; $i < 1; $i++) { // $y2 is the array that I posted above. The elements 0, Happiness, and Stone are in this array. $y2 = explode(",", $x2[$i]); // 3 elements in the array; we loop 3 times and display the results. "Basic Form" gets displayed three times, when it should only be displayed once foreach ($y2 as $val) { echo $dex->calcEvolutionMethod($val); } } Try changing this line to: echo $val . ': ' . $dex->calcEvolutionMethod($val); So you know it's definitely getting the right values passed.. Adam
×
×
  • 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.