I sincerely wish someone could give me some insight as to what I am doing
wrong here.  I have been scouring php.net for any website that has a good
tutorial or article on how to pass the variables from page to page while
assigning a variable a whole record set from a database.  If anyone has run
into the same problem that I am having please give me a shove in the right
direction.  Thanks in advance,
Jas
"Jas" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Ok I have been working on this function to delete an item from a mysql
> database and so far I have not had any success.  Here is the problem I am
> having (after alot of headaches), I need to be able to associate a
checkbox
> to a record or a set of records... For example, page 1 queries a database
> and pulls the results into a table and in that table is a form with a
> checkbox for each record pulled from said database... code is here...
> <?php
> require '../path/to/db.php'; //connection script
> $result = @mysql_query("SELECT * FROM cur_inv",$dbh) or die("Could not
> execute query, please try again later");
> echo "<table border=\"0\" class=\"table-body\" width=\"100%\"><form
> name=\"rem_inv\" method=\"post\" action=\"done2.php3\">
> <tr><td align=\"center\" colspan=\"3\"><font size=\"4\"><B>Current
> Inventory</B></font><hr color=\"333333\"></td></tr>";
> $count = -1;
> while ($myrow = mysql_fetch_row($result)) {
> $count ++;
> echo "<tr><td width=\"30%\"><B>Type Of Car: </B></td><td>";
> printf(mysql_result($result,$count,"car_type"));
> echo "</td><td><input type=\"checkbox\" name=\"id\"
> value=\"id\">remove</td></tr>\n";
> echo "rest of fields in database";
> }
> echo "<tr><td><input type=\"submit\" name=\"delete\"
> value=\"delete\"></td></tr></form></table>";
> ?>
> Now what I need to do is to have the checkbox item be associated with all
> one record set.  Table structure is here....
> ---------------------------------------------------------------------
> | id | car_model | car_type | car_year | car_price | car_vin | dlr_num |
> ---------------------------------------------------------------------
> | 0 | ford           | bronco    | 1997      | 6700       | vin#       |
dlr
> #     |
> ---------------------------------------------------------------------
> etc. etc.
> From the first page it links to page which queries the db and deletes the
> selected records... however, I am not able to get the "id" to be
associated
> with the records in the table... the deletion script is as follows....
> <?php
> require '../path/to/db.php';
> $table_name = "cur_inv";
> $sql = "DELETE FROM $table_name WHERE id = '$id'";
> echo($sql);
> $result = mysql_query($sql,$dbh) or die(mysql_error());
> print("record deleted");
> ?>
> If anyone has ever run into this please help... I am still fairly new to
php
> and mysql and there is definately something I am missing here and I think
> its because I need to associate the checkbox with the id and the id field
> from the database does not seem to be linked to the rest of the record in
> said fields...
> Thanks in advance,
> Jas
> And yes I do know I posted the same question yesterday... I still cannot
> figure this one out.
>
>
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to