Jump to content

Search the Community

Showing results for tags 'loop databse update'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hello, I have this piece of code it it currently only updates the last value in the databse. I need all of the fields to update there value. Can anyone help me out ? <fieldset> <legend>Ticket Categorys</legend> <form method='post' action='admin.php?do=ticketCats'> <table width='100%' style='background: #dddddd; padding:2px;'> <tr style='background: #C4C4C4;'> <td style='font-weight: bold;'><center>ID</center></td> <td style='font-weight: bold;'>Category</td> <td style='font-weight: bold;'><center>Action</center></td> </tr> <? $color="1"; $query = mysql_query(" SELECT * FROM ticket_cats ORDER BY name ASC "); $level2 = array(); while ($row = mysql_fetch_assoc($query)) { $level2[] = array('id'=>$row['id'],'name'=>$row['name']); if($color==1) { ?> <tr style='background: #fff;'> <? $color="2"; } else { // Set $color back to 1 $color="1"; } ?> <td style='width:15px;'><input type='hidden' value='<?echo $id;?>' name='id[]'><center><?echo $id;?></center></td> <td><input type='text' name='catname' style='width:400px;' value='<?echo $name;?>'/></td> <td><center><input type='submit' name='deleteCat' value='Delete ID:(<?echo $id;?>)' /></center></td> </tr> <? } ?> <tr> <td> <input type='submit' name='updateAllCats' value='Update Categorys' /> </td> </tr> </table> </form> </fieldset> <? if(!empty($_POST['updateAllCats'])) { $catname = $_POST['catname']; $ida = $_POST['id']; mysql_query("UPDATE ticket_cats SET name='$catname' WHERE id='$ida'"); } ?>
×
×
  • 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.