Now I am doing it in a few hours and I think what I'm looking for. Here's an example of what I'm doing:
$ query1 = mysql_query ("Select 1 to Table 1 where name = 'Blah'"); While ($ queryvalue1 = mysql_fetch_array ($ query1)) {$ array1 = $ queryvalue1 ['column1'] $ option = ""; $ Query2 = mysql_query ("Select from 2 to the table where id ($ array1)"); While ($ queryvalue2 = mysql_fetch_array ($ query2)) {$ var1 = $ queryvalue2 ['column2']; $ Var2 = $ queryvalue2 ['column3']; $ Option = "& Lt; OPTION VALUE = \" $ var1 \ "& gt; $ Var2; }} If I resonate $ var1 and $ var2 in the loop, I get all the appropriate values, but when I wrap them in html tags and do echo options Only gives me the first value. If I take the first time in the array loop, I can use the $ option code properly, this happens when I use it in the loop for the array array.
I am at the end of my mind, do anyone know why this problem is? Does anyone know a way to fix it? Any help would be appreciated!
In addition to the missing semi-colonel on line # 3, Options are clearing the string.
Try something like this
$ options = array (); $ Query1 = mysql_query ("Select 1 to Table 1 where name = 'Blah'"); While ($ queryvalue1 = mysql_fetch_array ($ query1)) {$ array1 = $ queryvalue1 ['column1']; $ Query2 = mysql_query ("Select from 2 to the table where id ($ array1)"); While ($ queryvalue2 = mysql_fetch_array ($ query2)) {$ var1 = $ queryvalue2 ['column2']; $ Var2 = $ queryvalue2 ['column3']; $ Option [] = sprintf ('& lt; option value = "% s">% s ; htmlspecialchars ($ var1), htmlspecialchars ($ var2)); }} $ Options = implode (PHP_EOL, $ option);
Comments
Post a Comment