Jump to content

coupe-r

Members
  • Posts

    328
  • Joined

  • Last visited

    Never

Everything posted by coupe-r

  1. Here is the entire code. I just need the names of the drop down boxes to be different for each record so I can capture them. It seems like its only registering the last records input. Is this the right way to do it? $results1 = ''; while($row = mysql_fetch_array($result)) { $id = $row['property_id']; $t_id = $row['tenant_id']; $address = $row['prop_address']; $city = $row['prop_city']; $state = $row['prop_state']; $zip = $row['prop_zip']; $rent = '$ '.$row['prop_rent']; $tenant = $row['ten_lastname'] . ', '.$row['ten_firstname']; if(isset($row['apt']) && !empty($row['apt'])) { $apt = 'Apt '.$row['apt']; $ten_address = $address.', '.$apt.', '.$city.', '.$state.', '.$zip; } else { $ten_address = $address.', '.$city.', '.$state.', '.$zip; } $months = array('January '.date('Y'), 'February '.date('Y'), 'March '.date('Y'), 'April '.date('Y'), 'May '.date('Y'), 'June '.date('Y'), 'July '.date('Y'), 'August '.date('Y'), 'September '.date('Y'), 'October '.date('Y'), 'November '.date('Y'), 'December '.date('Y')); $pay_month = "<select name=month_box[] id=month_box>"; foreach ($months as $key => $name) { $key++; $selected = ($key == $month) ? ' selected' : ''; $pay_month .= "<option value=$key$selected>$name</option>\n"; } $pay_month .= '</select>'; $results1 .= '<table width="100%" border="0" cellpadding="5" cellspacing="0" class="underline">'; $results1 .= '<tr>'; $results1 .= '<td width="4%" align="center">'.'<input type="checkbox" name="checkbox[]" id="checkbox" value="'.$t_id.'"/>'.'</td>'; $results1 .= '<td width="36%" align="left">'.$tenant.'</td>'; $results1 .= '<td width="13%" align="center">'.$pay_month.'</td>'; $results1 .= '<td width="15%" align="center"> <select name="type_box[]" id="type_box"> <option value="select" selected="selected">Select Payment</option> <option value="check">Check</option><option value="cash">Cash</option> <option value="credit">Credit Card</option> <option value="other">Other</option> </select> </td>'; $results1 .= '<td width="26%" align="center"> <input type="radio" name="radio" id="radio" value="1" />Full <input type="radio" name="radio" id="radio2" value="2" />Partial $ <input name="payment_txt" type="text" id="payment_txt" size="8" maxlength="8" /> </td>'; $results1 .= '<td width="6%" align="center"> <input type="checkbox" name="checkbox1[]" id="checkbox1"/> </td>'; $results1 .= '</tr>'; $results1 .= '</table>'; } }
  2. $month is an array of months (Jan, Feb, March .....) The HTML output is as follows. 1st line 29 2 select 1 1 2nd line is always correct. It seems the last line always works, but if there are more than 1 lines, only the very last line outputs correctly. 29 = The Tenant ID of the first checkbox, this is correct 2 = Februarys value, but it always outputs 2 no matter which month is selected select = Always outputs select because this is the initial value, regardless of what is selected. 1 = This is outputting fine 1 = This is outputting fine
  3. I meant to write: mysql_query("update destinations SET selected= '".$orderCounter."' WHERE id= '".$destChose."'"); I tried this but I am getting a parse error. I tried it without the "."s and without the " ' "s too. Any other suggestions?
  4. Try mysql_query("update destinations SET selected= '".orderCounter."' WHERE id=");
  5. Hey Guys, Attached is a screen shot of what my page looks like. What I am essentially trying to do is select a property and view the tenants for the property. When you check the box to the left of the tenant, the input fields will be inserted into the DB under their Tenant_id. The problem I'm having is the Payment Month and Payment Type drop downs are not outputting correctly. The top 2 in the picture always output their selected="selected" value, but the bottom 2 drop downs output the correct selected value. If I could get help with the first Drop Down, I could do the second. Here is the code for the Payment month Drop Down: $months = array('January '.date('Y'), 'February '.date('Y'), 'March '.date('Y'), 'April '.date('Y'), 'May '.date('Y'), 'June '.date('Y'), 'July '.date('Y'), 'August '.date('Y'), 'September '.date('Y'), 'October '.date('Y'), 'November '.date('Y'), 'December '.date('Y')); $pay_month = "<select name=month_box id=month_box>"; foreach ($months as $key => $name) { //array is zero based, so +1 the month number $key++; $selected = ($key == $month) ? ' selected' : ''; $pay_month .= "<option value=$key$selected>$name</option>\n"; } $pay_month .= '</select>'; Does the name= have to be name=month_box[]??? Thanks in advance. [attachment deleted by admin]
  6. Hey Guys, I want the drop down to select the current month. Currently, it always selects December, the last month in the list. $pay_month = "<select name=month_box id=month_box>"; $pay_month .="<option value=1 if($month==01) echo selected='selected' >January</option>"; $pay_month .="<option value=2 if($month==02) echo selected='selected' >February</option>"; $pay_month .="<option value=3 if($month==03) echo selected='selected' >March</option>"; $pay_month .="<option value=4 if($month==04) echo selected='selected' >April</option>"; $pay_month .="<option value=5 if($month==05) echo selected='selected' >May</option>"; $pay_month .="<option value=6 if($month==06) echo selected='selected' >June</option>"; $pay_month .="<option value=7 if($month==07) echo selected='selected' >July</option>"; $pay_month .="<option value=8 if($month==08) echo selected='selected' >August</option>"; $pay_month .="<option value=9 if($month==09) echo selected='selected' >September</option>"; $pay_month .="<option value=10 if($month==10) echo selected='selected' >October</option>"; $pay_month .="<option value=11 if($month==11) echo selected='selected' >November</option>"; $pay_month .="<option value=12 if($month==12) echo selected='selected' >December</option>"; $pay_month .="</select>";
  7. Hey Guys, What I am trying to do is populate a drop down box with properties (Addresses), only if the # of occupants have not been reached. If a property has 2 occupants and only 1 tenants has that property id, it should still be populated. Property Tenants Property_id Teanant_id occupants property_id SELECT * FROM property LEFT JOIN tenants ON property.property_id = tenants.property_id WHERE ......................... Clueless on how I compare the count of tenants.property_id's and property.occupants. Please help
  8. PERFECT. Thank you very much for the quick replies.
  9. Thanks for the reply. I had something like that before, but here is what it echos 10001 Company 1 10002 Disney Inc. 10004 a It should only have 10001 and 10002 on that link and then a seperate line for 10004, but it does not create a new row. Here is the code now: $results = ''; $results .= '<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">'; $results .= '<tr>'; $i=1; while($row = mysql_fetch_array($result)) { if ($i%2 == 0) { echo "</tr><tr>"; } $results .= "<td>".$row['client_id']."</td>"; $results .= "<td>".$row['client_company']."</td>"; $i++; } $results .= '</tr></table>';
  10. Hello All. Here is what I have: Client ID Company name Client ID Company name I then need a script to echo 2 results per row then start a new row. I've tried many things, but never could get a second row to appear. Each row will have 4 columns. Here is my code without the "guts" My vars will be $id and $company. $result = mysql_query("SELECT * FROM client"); if(mysql_num_rows($result) < 1) { $results = 'You have 0 clients.'; } else { $results = ''; $results .= '<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">'; $results .= '<tr>'; while($row = mysql_fetch_array($result)) { } $results .= '</table>'; }
  11. If the user enters the correct account information, you can set a session var. if user logged in { $_SESSION['user_id'] = $user_id } Once you have a session var, you can move that around, page to page. On each page, you will search for the Session var, if the user does not have one, they are not logged in. Then, redirect to the login page. make sense?
  12. Hey guys, I have been playing around with a script that draws a 3d pie chart. Unfortunately, I cannot figure out how to use it the way I want to. basically, I want a pie chart with 7 slices, 1 for each day of the week. eg. Mon = 4 Tues = 10 etc I would like it to draw the chart and display a legend, used the same color code for the corresponding day. The script I have randomly generates colors and the number of slices. Does anyone know of a site to get a customizable script? Thanks alot.
  13. All I can find is GD support for Linux servers. Anyone have experience with WAMP and GD/JPG support?
  14. I cannot thank you guys here enough. You always give excellent help. Thanks again.
  15. Thank you.... But how do I write php so that after the query and all the days are set to 0, how would php know that row[0] will become there own variables? and row[1] are the values?
  16. here is the query: $result = t_day, count(t_id) AS t_daycount FROM tickets WHERE t_company = '".$_SESSION['company']."' AND t_day BETWEEN Date1 AND Date2 Group By t_day As of right now, I have 2 rows t_day t_daycount Mon 2 Wed 1 What I want to do, is get vars for each day of the week, regardless if there are rows and set them to the day so... $mon = 2 $tue = 0 (no record) $wed = 1 etc..
  17. I took out the unix stuff and it seems to be working. Thanks
  18. I was just using the query that was posted.
  19. t_date is DATETIME in the Database. 1 Record which is 2009-06-08 00:00:00 If that helps anymore
  20. $result = mysql_query("SELECT * FROM tickets WHERE t_company = '".$_SESSION['company']."' AND UNIX_TIMESTAMP(t_date) BETWEEN UNIX_TIMESTAMP('".$from_date."') AND UNIX_TIMESTAMP('".$to_date."'");
  21. I typed it in wrong. I have $to_date = $to_year . '-' . $to_mon . '-' . $to_day; $from_date = $from_year . '-' . $from_mon . '-' . $from_day; and it still does not work. Sorry
  22. Thanks for the reply. Do I need to convert the drop downs from a string to somthing else? because of the following $from_mon = $_POST['from_mon_box']; $from_day = $_POST['from_day_box']; $from_year = $_POST['from_year_box']; $to_mon = $_POST['to_mon_box']; $to_day = $_POST['to_day_box']; $to_year = $_POST['to_year_box']; $to_date = $to_mon . '-' . $to_day . '-' . $to_year; $from_date = $from_mon . '-' . $from_day . '-' . $from_year; I am not getting any results so far
  23. Hey guys. I am trying to allow users to search between certain dates. I have a from date, which has 3 drop down boxes (Month, Date, Year) and a to date, which has 3 drop down boxes. In my test DB, I have a t_date which captures a date such as 6/8/2009. I also have a t_mon, t_day, t_year just in case I needed to separate for the search. Currently, I have this: $result = mysql_query ("SELECT * FROM tickets WHERE t_company = '".$_SESSION['company']."' AND t_month BETWEEN '".$from_mon."' AND '".$to_mon."' AND t_day BETWEEN '".$from_day."' AND '".$to_day."' AND t_year BETWEEN '".$from_year."' AND '".$to_year."'"); or $result = mysql_query("SELECT * FROM tickets WHERE t_company = '".$_SESSION['company']."' AND t_date BETWEEN '".$from_date."' AND '".$to_date."'"); Neither is working properly. I've stared for an hour and know its wrong, but can think of a way to make it work perfectly. Thanks in advance.
  24. Im not at a computer to test this code, but shouldn't it look more like this? <option value="<?php echo $seller; ?>" selected="selected"><?php echo $seller; ?></option>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.