Jump to content

phppup

Members
  • Posts

    895
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by phppup

  1. No numbers, no characters, just a capitall lettter and the remaining lowercase letters. Also, if I want toeveviate some of the PHP burden and add this in Javascript, should it go directly ahead of the PHP, or be intertwined with it?
  2. So how would I ensure that a name field is SAVED with the first letter capitalized, and the rest all lowercase, regardless of how it was typed into the field?
  3. I might want it capitalised so that when I send an email, it can be addressed "Dear Greenballoon" as opposed to greenballon. So, is there a way to do it, or it it best left until I send the email.
  4. While we're on the subject, is there a way to ensure that the first letter of a name is captalized, and the rest lowercase? Or is this best handled later on, when the name is being used and called from the DB. PS: some of us comment are code as to WHAT we are doing because we're just not that good yet, and we need to explain it to ourselves.
  5. Each row contains quantities from a form. I then ECHO the form after submission and ECHO the values. I would like all values >0 to be BOLD. while($result=mysql_fetch_array($query)) {$value=result["somerow"]; if ($value>o) { echo "Some field name <input name='data' type='text' id='bold' value='$value' /><br/>"; } else{ echo "Some field name <input name='data' type='text' value='$value' /><br/>"; }} the above codeseems promising, but I'm not sure how to LOOP it so it evaluates ALL the values in their fields, or if there might be a better method.
  6. Code not working Getting T-string error: $myUpdateList = array();foreach($_POST as $indexName => $value) { $myUpdateList[] = "$indexName = \"$value\"";} $fields = implode(",", $myUpdateList); $sql=UPDATE pass SET $fields WHERE id = 3; Am I missing parenthesis or semi colons, or quotes?
  7. Yes, the dropdowns were ALL written manually with HTMN (i've since learned there is a php method that's less exhausting). The id is being input into a field calling it from the DB as record_id. $record_id = (isset($_POST['record_id'])) ? $_POST['record_id'] : '';
  8. I appreciate the humor. It's just that as a newbie, ya never know if htere's some variable at work that you haven't encountered yet. I was thinking they might have a similar numeric value or name concontination or some sort. PS: the broccoli is STEAMED.... so at worst it gets soggy. LOL
  9. Using 85% dropdowns, and then some standard name,address input fields. Ummmm, easiest way to provide the $id for the script?
  10. And why is my BROCCOLI now BURNT.... i suppose this is more than just you being funny. And will I ever actually see (or need to use) my BURNT items?
  11. I'm just doing what the internet tell me (which is probably why I'm having so much trouble, huh). So instead of listing them twice, what??
  12. Here is the code that was at the top of my INSERT.php code $roastturkey = $_POST['roastturkey']; $broccoli = $_POST['broccoli']; $brisket = $_POST['brisket']; $carrots = $_POST['carrots']; and then it repeats as the VALUES to be posted. I'm still a bit confused about my UPDATE statement. UPDATe mytable SET (all the post names) WHERE id="id" ...... so the SET is the list of fields, but there's a way to loop through them to avoid listing each one seperately?? Please help. As I've discovered I could have saved LOTS of time had I understood and implemented other PHP shortcuts earlier in this process. Thanks.
  13. Don't have the code yet. I have multiple fields form a form that were input from dropdown menus. So I would need a loop for each item in row??
  14. SO if I have 50 fields in a single row, I need to list them in the same manner as when I input them from the form? There is now way to simply state that I want the entire ID row to be overwritten (since MySQL will automatically NOT overwrite items that were not changed)?
  15. do I need to list every field by name individually, or is there a way to UPDATE the entire row by ID?
  16. I want to UPDATE reords in my DB using a form. What is the correct UPDATE syntax. All the tutorials seem to offer lessons on updating full columns or ages, but not a single record row by ID.
  17. Thanks again to everyone. I'm gonna mark this one resolved!
  18. OK. So now all I need to do is build this page into a form, and have the 'action' point to a PHP page that connects and the run UPDATE * FROM mytable WHERE id = 'this-record' Uh oh, is this a new thread... LOL
  19. ie: $meat.... yes, i played with that early on in my PHP endeavors. everything was so structured, and then I scratched my head and started naming items with names like sasperilla and heebeeegeeebeees. It was confusinig, but it DID work... LOL So in actuality, DB fatigue not withstanding, fetch_array is just a bit more generic, and kinda ensures that it'll locate what the fuction is looking for by casting a wider net, so to speak.
  20. So, $row = mysql_fetch_array is forcing the DB to do more work than it needs to by scanning the entire DB? And fetch_row directs it more definitively??
  21. I GOT IT!!!!! Noticed that i missed the array in option 10, called it $row, and SUCCESS! Thank you EVERYONE for persevering. If there are any tweaks to my code, please let me know. And if someone can let me know whether I would be BETTER off using arrays, please guide me to the difference of $row versus $array. Thanks sooo much again!
  22. Note: had EVERYTHING as ARRAY... just switched them to $row on a hunch that didn't work. I'll put them back to $array
  23. $result = mysql_query("SELECT * FROM pass WHERE id = '4' ") or die(mysql_error()); $row = mysql_fetch_array( $result ); echo "There are " . $row['roastturkey'] ." servings"; // this verifies that i CAN get the data echo "<table border='1'>"; echo "<tr> <th>Name</th> <th>Comment</th> <th>Email Address</th></tr>"; //took from another table just to get headings and columns echo "<tr><td>"; echo "<select name='roastturkey'>"; echo "<option value='0.00' " . ($row['roastturkey'] == 0.00 ? 'selected="selected"' : '') . ">0</option>"; echo "<option value='1.00' " . ($row['roastturkey'] == 1.00 ? 'selected="selected"' : '') . ">1</option>"; echo "<option value='2.00' " . ($row['roastturkey'] == 2.00 ? 'selected="selected"' : '') . ">2</option>"; echo "<option value='3.00' " . ($row['roastturkey'] == 3.00 ? 'selected="selected"' : '') . ">3</option>"; echo "<option value='4.00' " . ($row['roastturkey'] == 4.00 ? 'selected="selected"' : '') . ">4</option>"; echo "<option value='5.00' " . ($row['roastturkey'] == 5.00 ? 'selected="selected"' : '') . ">5</option>"; echo "<option value='6.00' " . ($row['roastturkey'] == 6.00 ? 'selected="selected"' : '') . ">6</option>"; echo "<option value='7.00' " . ($row['roastturkey'] == 7.00 ? 'selected="selected"' : '') . ">7</option>"; echo "<option value='8.00' " . ($row['roastturkey'] == 8.00 ? 'selected="selected"' : '') . ">8</option>"; echo "<option value='9.00' " . ($row['roastturkey'] == 9.00 ? 'selected="selected"' : '') . ">9</option>"; echo "<option value='10.00' " . ($array['roastturkey'] == 10.00 ? 'selected="selected"' : '') . ">10</option>";
  24. $result = mysql_query("SELECT * FROM mytest WHERE id = '4' ") and I change the ID accordingly, hoping for a different and accurate result, which hasn't happened. Note: everything is connecting etc, as I have an alternate page WITHOUT the dropdown scenario and it runs fine, echoing all accurate data. I thought this would be an easy way to update info, can you think of a better method in case this issue is unresolveable. Although I don't think I'm the first to attempt this method.
  25. In my table I'm using $row. Not too familiar with arrays (which is also why I hardcoded initially, as I didn't know that there was a simpler way with PHP)
×
×
  • 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.