some intricate array issues

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
glennn3
Forum Commoner
Posts: 63
Joined: Sat Sep 20, 2003 8:43 pm

some intricate array issues

Post by glennn3 »

OK - whew, here goes...

selecting an array of titles from a table so that i can change the status OF EACH >>

Code: Select all

<?
$grab_usertitles = "SELECT * FROM titles WHERE recID = '$id'";
$result = @mysql_query($grab_usertitles);

sql_query("$result", "1", "$errors&#1111;03]");

while ($row = mysql_fetch_array($result))
&#123;
$tid = $row&#1111;"id"];
$title = $row&#1111;"title"];
$status = $row&#1111;"status"];

echo "<tr><td width="150">$tid - $title  </td><td width="400">
  <select name="status"><option value="$status">$status</option>
<option value="Received">Received</option>
<option value="Under Review">Under Review</option>
<option value="Approved">Approved</option>
<option value="Declined">Declined</option>
</select></td></tr>";
/*
  echo "<tr><td width="150">$title </td><td width="400">
  <input type="text" name="status" value="$status"></td></tr>";
  */
&#125;
?>
i'm no coder, so i'm learning by playing with this til i get it right. sometimes a snippet might take me a couple days... :o). anyway.

so the function that the form calls is (in another page):

Code: Select all

$grab_usertitles = "SELECT * FROM titles WHERE recID = '$id'";
$result = @mysql_query($grab_usertitles);
sql_query("$result", "1", "$errors&#1111;03]");

$tid = $row&#1111;"id"];

$input1 = "UPDATE titles SET
status = '$status'
WHERE (recID = '$id')";
$result1 = @mysql_query($input1);
sql_query("$result1", "1", "$errors&#1111;03]");

echo ("<font color="blue"><b>User Updated Successfully.</b></font>");

include ("user_display.inc");
obviously this returns whatever number of records with the same recID and it does read what happens to be the status of each individual field "status"... but if i select different options, the last one selected takes precedence and updates all the "status" fields to the same value. i can see i'm right next to gettin it right, but it's over my head.

can someone show my what query will get what i need done?

i thank you,
glenn
Post Reply