Jump to content


Photo

Couple of Questions...


  • Please log in to reply
3 replies to this topic

#1 chrisj989

chrisj989
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 06 July 2006 - 03:58 PM

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.

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 06 July 2006 - 04:33 PM

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

    $i++;
}


#3 chrisj989

chrisj989
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 06 July 2006 - 05:21 PM

okie dokie, will do

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

#4 chrisj989

chrisj989
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 07 July 2006 - 07:39 PM

any other ideas?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users