Jump to content

chrisj989

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

chrisj989's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hmm....well my form is working now, but I'm not able to actually delete the data, here's the full code, maybe someone can point something out that's blantantly  wrong/missing? [code] //Code that puts the SQL query into a string... $query = "SELECT u_fname AS First, u_lname AS Last from tblUsers;"; $query2 = "SELECT u_id AS id FROM tblUsers;"; $results = mssql_query($query); $id = mssql_query($query2); //Code that displays the data in a table... while ($row=mssql_fetch_row($results)) { $fields = mssql_num_fields($results); for( $i = 0; $i < $fields; ++$i){ echo "<td><div align = \"center\">"; echo $row[$i]."</div></td> "; } echo "<td><div align = \"center\"><input type=\"checkbox\" name = \"$id\"  value = \"$id\"></div></td>"; echo "</tr>"; //Code that TRIES to delete multiple rows of data...   echo "Before If Statement <br />";  //For Debugging purposes if(isset($_POST['deleter'])){ foreach($_POST['Delete'] as $del){ $qrem = "DELETE FROM tblUsers WHERE u_fname = $del[0] AND u_lname = $del[1]"; $execute = mssql_query($qrem); } echo "Deletion Complete!"; //Debug } else echo "Do Nothing!"; //Debug [/code]
  2. so then it would be something like... [code]echo "<td><div align = \"center\"><form><input type=\"checkbox\" id= \"rfs[]\" value = "\$row"\ ></div></form></td>";[/code]
  3. hmm....ok, this is how each row is setup and displayed... [code] while ($row=mssql_fetch_row($results)) { $fields = mssql_num_fields($results); for( $i = 0; $i < $fields; ++$i){ echo "<td><div align = \"center\">"; echo $row[$i]."</div></td> "; } echo "<td><div align = \"center\"><form><input type=\"checkbox\" id= \"rfs[]\"></div></form></td>"; echo "</tr>"; } [/code] As you can see, the checkboxes are added at the end of each row...but I think they have no relationship to the data, how do I link the checkboxes to the data on the row?
  4. okie dokie, will do EDIT: Tried that, and it didn't work, only first entry showed up with a bunch of blanks after that
  5. beautiful, that is what I wanted, but now....in that switch statement, the $_GET[ ] call that you used, can I put the page that I was just at as an argument?  for example, I'm at Table A's page (tableA.php), then I click the add link or button on Table A's page...and it takes me to this add.php page that has all the switch statements on it, and since it came from Table A's page, it'll do that case for Table A? Basically, can I pass the page that called add.php as an argument for the switch statement and then generate the form accordingly? If so, then what, if anything would be different in this code?
  6. I have a website pulling data from multiple tables, I was wondering if there was a way however if I could have a single add page (if I wanted to add a field to a specific table) to create an add form. What I wanted it to be like is say, I'm looking at Table A, and I click on a Add link, it'll send info to the add page notifying it that I want to add a field to Table A, show me the form that matches up with this Table.  So something like a switch statement in the add page where it'll point to the right form. blah, help!
  7. Hey Guys, first post here and I hope you can help me out with a few things I have a checkbox next to each field and what I want to do is allow users to select the rows through the checkboxes and the press an option button to delete the row.  The checkboxes are inserted after every field. I'm also trying to insert data from a option field, doesn't seem to work. this is the option field and my attempt at inserting it:     "  <?php $query = "Select fA+' '+lA from tblA order by fA;"; $results = mssql_query($query); while ($row=mssql_fetch_row($results)) { echo"<option value=\"results\"> "; $fields = mssql_num_fields($results); for( $i = 0; $i < $fields; ++$i){ echo $row[$i]; } echo"</option>"; } ?>   if(isset($_POST['addcomputer'])){ $FIELDINSERT = $_GET['results']; $pcq = "INSERT INTO tblB(id) VALUES('$FIELDINSERT')"; $add = mssql_query($pcq);         } " My code is pretty crummy since this is my first time coding.  Any and all help would be great, thanks! I'm using PHP with MS SQL 2000 by the way.
  8. Hey Guys, first post here and I hope you can help me out with something I have a checkbox next to each field and what I want to do is allow users to select the rows through the checkboxes and the press an option button to delete the row.  The checkboxes are inserted after every field. My code is pretty crummy since this is my first time coding.  Any and all help would be great, thanks! I'm using PHP with MS SQL 2000 by the way.
×
×
  • 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.