Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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