Re: array-problems

From: Date: Wed, 24 Oct 2001 19:49:48 +0000
Subject: Re: array-problems
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-13686@lists.php.net to get a copy of this message
It looks like you need only one array, $date[begin] = $date[end]. Let's see, I think it'll work. I'll write it in your code then you try: $i=0; $result = mysql_query ("SELECT DISTINCT date FROM linktracker WHERE name LIKE '$PHP_AUTH_USER' ORDER BY date"); if ($row = mysql_fetch_array($result)) { do { $date[$i] = $row["date"]); $i++; } while ($row = mysql_fetch_array($result)); } else {print ("Sorry, no record were found."); } file://end else $result print("<table><tr><td>Begindate</td<td>Enddate</td></tr>\n". "<tr><td><form method=\"post\" action=\"index.php\" name=\"date_select\">". "<input type=\"hidden\" name=\"action\" value=\"date_select\">". "<select name=\"date_begin\">"); $i = 0; while ($date[$i]) { echo "<option value=\"".$date_begin ."\">" . $date_begin . "</option>\n"; $i++; } print("</select></td><td><select name=\"date_end\">"); $i--; while ($date[$i]) { echo "<option value=\"".$date_end ."\">" . $date_end . "</option>\n"; $i--; } print("</select></td></tr>\n<tr><td colspan=\"2\">". "<input type=\"submit\" name=\"Submit\" value=\"Submit\">". "</form></td></tr</table>"); mysql_free_result ($result); mysql_close();

« previous php.db (#13686) next »