Jump to content

Couple of Questions...


chrisj989

Recommended Posts

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.
Link to comment
https://forums.phpfreaks.com/topic/13860-couple-of-questions/
Share on other sites

For of change this:
[code]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>";
            }
            ?>[/code]
to this instead:
[code]$i = 0;
while ($row = mssql_fetch_row($results))
{
    echo '<option value="results">';
    echo $row[$i];
    echo '</option>';

    $i++;
}[/code]
Link to comment
https://forums.phpfreaks.com/topic/13860-couple-of-questions/#findComment-53972
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.