Jump to content

F1Fan

Members
  • Posts

    1,182
  • Joined

  • Last visited

Everything posted by F1Fan

  1. Sure you can. Post all of that section of code, the loop at least.
  2. Are you getting any errors?
  3. use the $_FILE variable, like this: <?php $filename = $_FILES["file"]["name"]; ?>
  4. Eek, I'm not sure. Maybe try searching for the '\n' line breaker and grab everything after that?
  5. That's OK, you can put a table within a table. Like this: <table><tr><td> <table> <tr> <td align="right">1</td><td align="center">.</td><td>10</td> </tr> <tr> <td align="right">10</td><td align="center">.</td><td>0</td> </tr> </table> </td></tr></table> Please excuse the horrible layout.
  6. You're welcome. Just remember that what you typed would only return the number of rows plus one, and not necessarily the highest number.
  7. In your example, input "bp" is either 1 or 2, and on the next page, with that loop I listed inside of the form on your next page, it will create a hidden input named "bp" with a value of whatever the user selected. genericnumber1 is right, you would need to add a function like htmlentities() or something to check for special characters, I was just trying to keep it simple.
  8. Make $percent an array. $marginsSQL = "SELECT * FROM tbl_margins WHERE select = 1"; $marginsResult = mysql_query($marginsSQL) or die (mysql_error()); $percent = array(); while ($margins = mysql_fetch_array($marginsResult)){ $percent[] = $products["percent"]; } print_r($percent);
  9. What do you mean there's two lines? Is there two rows, or is there a line break in the field's value?
  10. You could also use tables and cheat a little. Split the number up by the decimal and do this: <table> <tr> <td align="right">1</td><td align="center">.</td><td>10</td> </tr> <tr> <td align="right">10</td><td align="center">.</td><td>0</td> </tr> </table>
  11. 1) I would suggest you post the first page to the second page, the second to the third, and so on. In each page, you would need to include hidden inputs that store the previous posts to be accumulated at the end. This might work for that: <?php foreach ($_POST as $k=>$val){ echo "<input type='hidden' name='$k' value='$val'>\n"; } ?> 2) You'll need to use the $_POST['bp'] variable after the form is submitted and use that data to insert into your DB.
  12. $query = "SELECT gold FROM players WHERE player_id = $id" ----- add your db stuff here ----- if ($gold<10000) echo "Not enough gold..."; else{ $updatequery = "UPDATE players SET gold = (gold-10000), maxawake = 210, awake = 0 WHERE player_id = $id"; -- run your query and stuff }
  13. So you want everything to be aligned with the decimal place as the centerpiece? Like: 1.10 and 11.0 or close to that?
  14. <?php // assume that $inarray is your column values $fliparray = array_flip($inarray); krsort($fliparray); $maxvalue = key($fliparray); ?> Hope that helps.
  15. Maybe try this: <?php function CheckChars($input){ $chars = array('a','b','c','d',1,2,3...); //list all acceptable characters $output = ""; foreach (explode("",$input) as $char){ if (in_array($char,$chars)) $output .= $char; } return $output; } ?>
  16. The easiest way would be to do it in your query: SELECT MAX(column_name) FROM table_name WHERE whatever But, if you already had the numbers in an array, I would swap the values and keys, sort it, and grab the highest key by pointing it at the end. If this doesn't make sense, include some of your code.
  17. <input type="image" name="delete" value="Delete" src="images/icon_delete.gif" alt="Delete" style="vertical-align: middle;"> image type inputs act exactly the same as submit types.
  18. What loop are you referring to? Also, if statements should look like this: <?php if (condition){ code to execute; } else{ other code to execute; } ?>
  19. In that case, you should use the input type="image" rather than button.
  20. strtotime() will return a timestamp. Do this: $timestamp = strtotime('+1 month'); $nmonth = date('m',$timestamp); $nmyear = date('Y',$timestamp);
  21. If you want to verify it before they submit, you will need to write a javascript function. Otherwise, you could create a PHP function that strips out any characters that you don't want.
  22. You should use input rather than button. Also, why don't you check and see if both add and delete are present, and if they are, assume they hit enter?
  23. Javascript would be perfect for this. In any case, would this help: <form action="b.php"> ..... <input type="submit" name="add" value="Add"> <input type="submit" name="delete" value="Delete"> <input type="hidden" name="submitted" value="1"> ..... </form> b.php ==== if (isset($_POST['addn']||(!isset($_POST['delete'])&&isset($_POST['submitted']))) { // Perform add action & put the data into DB } else if (isset($_POST['delete']) ) { // Perform delete action & put the data into DB }
  24. A work around could be to add a hidden input that is unique to that page/form that you could check for. <form action="b.php"> ..... <input type="submit" name="add" value="Add"> <input type="submit" name="delete" value="Delete"> <input type="hidden" name="submitted" value="1"> ..... </form> b.php ==== if (isset($_POST['addn']) ) { // Perform add action & put the data into DB } else if (isset($_POST['delete']) ) { // Perform delete action & put the data into DB } else if (isset($_POST['submitted']) ) { // Perform the "hit enter button" function }
×
×
  • 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.