silverbullet126
-
Posts
7 -
Joined
-
Last visited
Never
Posts posted by silverbullet126
-
-
Thanks Ken,
--
[b]Got another problem [/b] now (keep digging myself holes :))
This one kinda kinda hard to explain, but here i go :)
I have strings coming like before, but this time each V## corresponds to one answer of the 5 part question (rate how you like each of the 5 shows listed), you can see some example of the form code below (the 5 V## are combined b4 being entered into the database).
1 2 3 4 5
V01V02V04V05V03
V04V04V04V05V01
V02V05V03V01V04
----
1 x V01
1 x V04
1 x V02
--------------
HOT 20 -
<select name="R14a" id="R14a">
<option value="V05">5 - Favourite</option>
<option value="V04">4 - Above Average</option>
<option value="V03">3 - Average</option>
<option value="V02">2 - Below Average</option>
<option value="V01">1 - Least Favourite</option>
</select>
----------
Here is what i have so far, it's not working, but again I think I'm close:
$R14a_1=0;
$R14a_2=0;
$R14a_3=0;
$R14a_4=0;
$R14a_5=0;
$R14b_1=0;
$R14b_2=0;
$R14b_3=0;
$R14b_4=0;
$R14b_5=0;
$R14c_1=0;
$R14c_2=0;
$R14c_3=0;
$R14c_4=0;
$R14c_5=0;
$R14d_1=0;
$R14d_2=0;
$R14d_3=0;
$R14d_4=0;
$R14d_5=0;
$R14e_1=0;
$R14e_2=0;
$R14e_3=0;
$R14e_4=0;
$R14e_5=0;
$query2="SELECT R14 FROM bpm_survey_2";
$result2 = mysql_query($query2);
while ($row=mysql_fetch_array($result2, MYSQL_ASSOC)){
$array = spliti ("V", $row['R14']);
for ($i_R14 = 0; $i_R14 < count($array); ++$i_R14) {
if ($array[1]=="01") { $R14a_1++; }
if ($array[1]=="02") { $R14a_2++; }
if ($array[1]=="03") { $R14a_3++; }
if ($array[1]=="04") { $R14a_4++; }
if ($array[1]=="05") { $R14a_5++; }
if ($array[2]=="01") { $R14b_1++; }
if ($array[2]=="02") { $R14b_2++; }
if ($array[2]=="03") { $R14b_3++; }
if ($array[2]=="04") { $R14b_4++; }
if ($array[2]=="05") { $R14b_5++; }
if ($array[3]=="01") { $R14c_1++; }
if ($array[3]=="02") { $R14c_2++; }
if ($array[3]=="03") { $R14c_3++; }
if ($array[3]=="04") { $R14c_4++; }
if ($array[3]=="05") { $R14c_5++; }
if ($array[4]=="01") { $R14d_1++; }
if ($array[4]=="02") { $R14d_2++; }
if ($array[4]=="03") { $R14d_3++; }
if ($array[4]=="04") { $R14d_4++; }
if ($array[4]=="05") { $R14d_5++; }
if ($array[5]=="01") { $R14e_1++; }
if ($array[5]=="02") { $R14e_2++; }
if ($array[5]=="03") { $R14e_3++; }
if ($array[5]=="04") { $R14e_4++; }
if ($array[5]=="05") { $R14e_5++; }
}
} # close while R14
-
Thanks, i just got it now ...
$R6_1=0;
$R6_2=0;
$R6_3=0;
$R6_4=0;
$R6_5=0;
$R6_6=0;
$R6_7=0;
$query2="SELECT R6 FROM bpm_survey_2";
$result2 = mysql_query($query2);
while ($row=mysql_fetch_array($result2, MYSQL_ASSOC)){
$array = spliti ("V", $row['R6']);
#print_r($array);
for ($i_R6 = 0; $i_R6 < count($array); ++$i_R6) {
if ($array[$i_R6]=="01") { $R6_1++; }
if ($array[$i_R6]=="02") { $R6_2++; }
if ($array[$i_R6]=="03") { $R6_3++; }
if ($array[$i_R6]=="04") { $R6_4++; }
if ($array[$i_R6]=="05") { $R6_5++; }
if ($array[$i_R6]=="06") { $R6_6++; }
if ($array[$i_R6]=="07") { $R6_7++; }
}
} # close while R6 -
see problem 2 below .. thanks :)
-
Thanks obsidian and kenrbnsn.
obsidian already have yours in testing .. should be up and working tomorrow ... man you saved me so much time :)
thanks -
Hey all,
Our website has chart (top 20 kinda thing) and its updated every Monday, I don't have any problem with getting the database working and having the chart up to update on the Mondays etc. But the boss wants to see past charts posted, this isn't a big deal, but doing it dynamically could be a problem. Here is what i have going on now:
$sql_week=date ('W');
if ($sql_week == 42) {
$weekof="week of October 16th";
$show_week="42";
}
I have one of these for each week, 42 to 45, but i now need to go back to week 32 and that’s a lot of typing. I was wondering if someone could help me out and make a script based on the week of the year that would bring up the date of each Monday (base on that week of the year) .. like $show_week="42" and $monday_date="16" ... and this would be dynamic based on $sql_week.
Anyone ? ..
-
Hey all,
I did some searching and really didn't find anything that helped. I know somewhat how to get an xml file to show on the page, but not how to get a specific part of the data out.
Here is what i'm looking for:
--
On Now
$show_name_on_now
Coming Up
3:30pm - $show_name_30min
4:00pm - $show_name_1hr
4:30pm - $show_name_130min
5:00pm - $show_name_2hr
--
Here is the format of my XML file. I've got the time and date formated and rounding correctly, no problem there .. but searching through an XML file ... i got nothing ???
<synweek>
<starttime>06:00:00</starttime>
<title>Good Dog</title>
<subepis>Preventing Problems</subepis>
<air_date>08/28/06</air_date>
<house>G</house>
<synopsis>Great show bah bah..</synopsis>
</synweek>
--
I need to be able to continually pick out the show title based on the current date/time of the day. The sql file holds an entire week of data... anyone have any thoughts ? I could do this in a second if it was just an SQL database, but with XML I'm totally lost :(
SOLVED - DB, Arrays and counting.
in PHP Coding Help
Posted
$R21a_1=0;
$R21a_2=0;
$R21a_3=0;
$R21a_4=0;
$R21a_5=0;
$R21b_1=0;
$R21b_2=0;
$R21b_3=0;
$R21b_4=0;
$R21b_5=0;
$R21c_1=0;
$R21c_2=0;
$R21c_3=0;
$R21c_4=0;
$R21c_5=0;
$R21d_1=0;
$R21d_2=0;
$R21d_3=0;
$R21d_4=0;
$R21d_5=0;
$piece=3;
$query2="SELECT R21 FROM pn_survey_2";
$result2 = mysql_query($query2);
while ($row=mysql_fetch_array($result2, MYSQL_ASSOC)){
$piece1 = substr($row['R21'],0,$piece);
$piece2 = substr($row['R21'],3,$piece);
$piece3 = substr($row['R21'],6,$piece);
$piece4 = substr($row['R21'],9,$piece);
$piece5 = substr($row['R21'],12,$piece);
if ($piece1=="V01") { $R21a_1++; }
if ($piece1=="V02") { $R21a_2++; }
if ($piece1=="V03") { $R21a_3++; }
if ($piece1=="V04") { $R21a_4++; }
if ($piece1=="V05") { $R21a_5++; }
if ($piece2=="V01") { $R21b_1++; }
if ($piece2=="V02") { $R21b_2++; }
if ($piece2=="V03") { $R21b_3++; }
if ($piece2=="V04") { $R21b_4++; }
if ($piece2=="V05") { $R21b_5++; }
if ($piece3=="V01") { $R21c_1++; }
if ($piece3=="V02") { $R21c_2++; }
if ($piece3=="V03") { $R21c_3++; }
if ($piece3=="V04") { $R21c_4++; }
if ($piece3=="V05") { $R21c_5++; }
if ($piece4=="V01") { $R21d_1++; }
if ($piece4=="V02") { $R21d_2++; }
if ($piece4=="V03") { $R21d_3++; }
if ($piece4=="V04") { $R21d_4++; }
if ($piece4=="V05") { $R21d_5++; }
} # close while R21