Jump to content

Archived

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

chrisj989

Couple of Questions...

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.

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites
okie dokie, will do

EDIT: Tried that, and it didn't work, only first entry showed up with a bunch of blanks after that

Share this post


Link to post
Share on other sites

×

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.