Jump to content

Duncan Disorderly

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

About Duncan Disorderly

  • Birthday 03/25/1960

Contact Methods

  • Website URL
    http://

Profile Information

  • Gender
    Not Telling
  • Location
    Birmingham UK

Duncan Disorderly's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Got it...now i understand.... yes the <select......... needed to be closed with > thanks guys and I apologise for my stupidity. <select id="CB_T" name="CB_T" style="font-family: Arial,Helvetica,Geneva,Sans-serif; font-size: 10px; color: rgb(255,102,51);">      <-----the missing bit!
  2. WF, interestingly enough, the rendered source shows all records being returned yet the first option (option value="1") still fails to be displayed..here is an extract.. <select id="CB_V" name="CB_V" style="font-family: Arial,Helvetica,Geneva,Sans-serif; font-size: 10px; color: rgb(255,102,51);" <OPTION VALUE="1">Any</option> <OPTION VALUE="2">Below 10,000</option> <OPTION VALUE="3">10,001 to 25,000</option> <OPTION VALUE="4">25,001 to 50,000</option> <OPTION VALUE="5">50,001 to 100,000</option> <OPTION VALUE="6">100,001 to 200,000</option> <OPTION VALUE="7">200,001 to 500,000</option> <OPTION VALUE="8">500,001 to 1,000,000</option> <OPTION VALUE="9">1,000,001 to 5,000,000</option> </select> <b><span style="font-family: Arial,Helvetica,Geneva,Sans-serif; font-size: 10px; color: rgb(255,102,51);">9</span></b></p>
  3. I apologise,I forgot to include the database conn when I extracted the code...! However, it would be fair to assume from my previous posts that the dbase conn works as the combo boxes get populated except for the first record. and the $No_x vars count the records which they of course would not if the dbconn failed. The issues remains...first record not being displayed in the combo boxes... any ideas?
  4. Redarrow, thanks tried it ..failed to display any records. Here is the full form code.. basically three combo boxes and a submit button (the browse all button has not yet been coded..) Please note I am echoing the $No_A, $No_T and $No_V variables to  see how many records are being returned - they do match the number of records in each table. Cheers DD Here is the code extracted and placed in a page: <head>   <title></title> </head> <body> <!-- This is the Quicksearch Form --> <div id="Form_QSLYR" style="border-left-color:  rgb(255,102,51); border-top-color:  rgb(255,102,51); border-right-color:  rgb(255,102,51); border-bottom-color:  rgb(255,102,51);"><layer id="Form_QSLYR" visibility="inherit" top="166" left="6" width="216" height="184" z-index="5"> <form name="FORM_QS" action="./html/results.php" target="Iframe" method="POST">         <table id="Form_QS" border="1" BORDERCOLOR="#FF6633" cellspacing="1" cellpadding="1" width="215" height="162">         <tr height="16">           <td width="201" style="font-family: Arial,Helvetica,Geneva,Sans-serif; font-size: 14px; color: rgb(255,255,255); background-color: rgb(255,102,51);">           <p style="text-align: center;"><span style="color: rgb(255,255,255);">Quick Property Search</span></p>           </td>         </tr>         <tr height="27">           <td>           <p>             <table width="34" border="0" cellspacing="0" cellpadding="0" align="left" nof="te">             <tr>               <td class="TextObject" style="font-family: Arial,Helvetica,Geneva,Sans-serif; font-size: 12px; color: rgb(0,0,255); text-align: left;">               <p><b><span style="color: rgb(255,102,51);">&nbsp;Area</span></b></p>               </td>             </tr>             </table> <select id="CB_A" name="CB_A" style="font-family: Arial,Helvetica,Geneva,Sans-serif; font-size: 10px; color: rgb(255,102,51);" <? $sql="SELECT id, Area FROM Listings_a"; $result=mysql_query($sql); $options_a=""; $No_A =mysql_num_rows($result); while ($row=mysql_fetch_array($result)) {     $id=$row["id"];     $value=$row["Area"];     $options_a.="<OPTION VALUE=\"$id\">".$value.'</option>'; } echo $options_a ?> </select>             <b><span style="font-family: Arial,Helvetica,Geneva,Sans-serif; font-size: 10px; color: rgb(255,102,51);"><?echo $No_A?></span></b></p>           </td>         </tr>         <tr height="27">           <td>           <p>             <table width="33" border="0" cellspacing="0" cellpadding="0" align="left" nof="te">             <tr>               <td class="TextObject" style="font-family: Arial,Helvetica,Geneva,Sans-serif; font-size: 12px; color: rgb(0,0,255); text-align: left;">               <p><b><span style="color: rgb(255,102,51);">&nbsp;Cost</span></b></p>               </td>             </tr>             </table> <select id="CB_V" name="CB_V" style="font-family: Arial,Helvetica,Geneva,Sans-serif; font-size: 10px; color: rgb(255,102,51);" <? $sql="SELECT id, Value FROM Listings_v"; $result=mysql_query($sql); $options_v=""; $No_V =mysql_num_rows($result); while ($row=mysql_fetch_array($result)) {     $id=$row["id"];     $value=$row["Value"];     $options_v.="<OPTION VALUE=\"$id\">".$value.'</option>'; } echo $options_v ?>             </select>             <b><span style="font-family: Arial,Helvetica,Geneva,Sans-serif; font-size: 10px; color: rgb(255,102,51);"><?echo $No_V?></span></b></p>           </td>         </tr>         <tr height="27">           <td>           <p>             <table width="34" border="0" cellspacing="0" cellpadding="0" align="left" nof="te">             <tr>               <td class="TextObject" style="font-family: Arial,Helvetica,Geneva,Sans-serif; font-size: 12px; color: rgb(0,0,255); text-align: left;">               <p><b><span style="color: rgb(255,102,51);">&nbsp;Type</span></b></p>               </td>             </tr>             </table> <select id="CB_T" name="CB_T" style="font-family: Arial,Helvetica,Geneva,Sans-serif; font-size: 10px; color: rgb(255,102,51);" <? $sql="SELECT id, Type FROM Listings_t"; $result=mysql_query($sql); $options_t=""; $No_T =mysql_num_rows($result); while ($row=mysql_fetch_array($result)) {     $id=$row["id"];     $value=$row["Type"];     $options_t.="<OPTION VALUE=\"$id\">".$value.'</option>'; } echo $options_t ?>             </select>             <b><span style="font-family: Arial,Helvetica,Geneva,Sans-serif; font-size: 10px; color: rgb(255,102,51);"><?echo $No_T?></span></b></p>           </td>         </tr>         <tr height="27">           <td style="border-left-style: none; border-top-style: none; border-right-style: none; border-bottom-style: none;">           <p style="text-align: center;"><input type="submit" name="Button_QS" style="color: rgb(255,0,0); font-weight: bold;" value="Search" id="Button_QS"></p>           </td>         </tr> <!-- This is the BrowseAll Button on the Quick Search Form -->         <tr height="27">           <td>           <p style="text-align: center;"><input type="button" name="Button_BAL" style="color: rgb(255,0,0); font-weight: bold;" value="Browse All Listings" id="Button_BAL"></p>           </td>         </tr>         </table>       </form>       </layer></div> </body> </html>
  5. Chaps...Thanks for your replies but I am now well confused.... Just a note to confirm, records are displayed and are selectable within the combo box EXCEPT the first record from the dbase, which does not get listed.
  6. Firstly, XYN :Thank you for your excellent example, unfortunately I believe I may have inadvertantly mislead you when I wrote "go menu". This Ladies and Gents is what I am trying to achieve: (without javascript if at all possible) Issue 1: I have a combo box with options (page titles) and button, I wish the user to select the options from the combo box and use this to load a page into an Iframe on the same page as the combo box. - similar to a go menu but use an Iframe Issue 2 As issue 1 but the Iframe is on a differant page. Issue 3 I have a datapage, with paragraphs defined with anchors. I want to use the anchor titles as options in a combo box, I wish the user to be able to select an option and then use that selection to load the datapage into an iframe and move to the specified anchor. Additionally I know Iframes are frowned upon so any additional advice as to how to do this with Divs would be appreciated... Not asking much am I !!!!!!... Cheers DD
  7. I use the code below to populate a combo box from a Mysql database it works with the exception that it fails to display the first record. Could someone tell me where I am going wrong and how to fix it. <? $sql="SELECT id, Type FROM Listings_t"; $result=mysql_query($sql); $options_t=""; $No_T =mysql_num_rows($result); while ($row=mysql_fetch_array($result)) {     $id=$row["id"];     $value=$row["Type"];     $options_t.="<OPTION VALUE=\"$id\">".$value.'</option>'; } echo $options_t ?>
  8. Hi all, I want a "go menu" (on index) to load "data" (on data) in an "Iframe" (on info) and display selected data by moving to an anchor on the data page. Page1: Index.php with Form and go menu Page2: info.php with Iframe Id="InfoIframe" name="InfoIframe" src=data.php Page3: data.php with various anchors and Data - Currency, Climate, Customs etc This is my proposed form: <form name="Form_AB" method="POST"> id="CB_AB" name="CB_AB" <option value="0" SELECTED>Please Select</option> <option value="1">Customs</option> <option value="2">Currency</option> <option value="3">Culture</option> <option value="4">History</option> <input type="submit" name="Button_AB" value="Go" id="Button_AB"> 1: Should I use "Submit" and "post" the form? 2: if so what would be the action "action=" ? 3: Should I use "button" and onClick="document.location.href= 4: if so what would be the 'document.location.href='? Do I need to make other changes to ie: to the iframe src=data.php....etc ? or Is there a totally better way of achieiving this? Or can this not be done? thanks in advance for any constructive input or comments Kind regards DD
  9. Resolved Tip for all Noobies like me.... check your capitalisation... variables are case sensitive .... I had "If" when it should be "if" (thx cmgmyr) and "$l_Type" when it should be "$L_Type" Dowh... hrs wasted... DD 46 y.o idiot!
  10. [!--quoteo(post=388954:date=Jun 28 2006, 02:14 PM:name=cmgmyr)--][div class=\'quotetop\']QUOTE(cmgmyr @ Jun 28 2006, 02:14 PM) [snapback]388954[/snapback][/div][div class=\'quotemain\'][!--quotec--] try putting the "I" in lowercase "if" is something else not working? [/quote] cmgmyr, Thanks, lowercase "I" indeed helped, .....THIS NEEDS TO BE READ INCONJUNCTION WITH THE CODE IN MY ORIGINAL POST...... However (Hope you can follow this!....) I have three dropdowns, type, area and value, a user can select a value from "each box (or they default to "Any"- value =1) to search on. Problem: Selecting the "any record" (ie: value==1) option from any of the three dropdowns does not select "All" records of that option. Ie: if all three dropdowns were set to "any" it would mean.. Display all records of "any value" and "in any area" and "of any type" or variations currently as long as the dropdowns are NOT set to "any" the search works. I want to be able to select: All records (any,any,any) Records of Any Value and of Type=X and in Area=X Records of Any Type and of Value =X and in Area=X Records in Any Area and of Type=X and of Value=X Records in Area=X and of Type=X and of Value=X - this works currently And variations of the above.. if anyone can understand my babble above and offer some sound advice (other than give up..lol) I would be most grateful DD
  11. I would be grateful if someone could tell me the correct syntax to use with the code below. Additionally, is there some method I can use to process an "any / all records" option from a series of combo box/dropdowns kind regards DD If ($l_Type==1 AND $L_Area==1 AND $L_value==1) { $result = mysql_query("Select * FROM listings")or die(mysql_error()); } elseif ($l_Type>1 AND $L_Area==1 AND $L_Value==1) { $result = mysql_query("Select * FROM listings WHERE listings.`Type`='$L_Type'")or die(mysql_error()); } elseif($l_Type==1 AND $L_Area>=1 AND $L_Value==1) { $result = mysql_query("Select * FROM listings WHERE listings.`Area`='$L_Area'")or die(mysql_error()); } elseif($l_Type==1AND $L_Area==1 AND $L_Value>1) { $result = mysql_query("Select * FROM listings WHERE listings`.`Value`='$L_Val'")or die(mysql_error()); } elseif($l_Type>1 AND $L_Area>1 AND $L_Value==1) { $result = mysql_query("Select * FROM listings WHERE listings.`Type`='$L_Type' AND `listings`.`Area`='$L_Area'")or die(mysql_error()); } elseif($l_Type>1 AND $L_Area==1 AND $L_Value>1) { $result = mysql_query("Select * FROM listings WHERE listings.`Type`='$L_Type' AND `listings`.`Value`='$L_Val'")or die(mysql_error()); } elseif($l_Type==1 AND $L_Area>1 AND $L_Value>1) { $result = mysql_query("Select * FROM listings WHERE listings`.`Value`='$L_Val' AND `listings`.`Area`='$L_Area'")or die(mysql_error()); } else { $result = mysql_query("Select * FROM listings WHERE listings.`Type`='$L_Type' AND `listings`.`Value`='$L_Val' AND `listings`.`Area`='$L_Area'")or die(mysql_error()); }
  12. [!--quoteo(post=387396:date=Jun 24 2006, 02:48 AM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jun 24 2006, 02:48 AM) [snapback]387396[/snapback][/div][div class=\'quotemain\'][!--quotec--] Something like the following should work (UNTESTED): [code]SELECT l.*, p.* FROM listings AS l LEFT JOIN listings_p AS p ON ( p.L_ID = l.ID ) WHERE Type='$L_Type' AND Area='$L_Area'AND Value BETWEEN '$L_Val' AND '$H_Val'[/code] To which you'd need to add the "easier" query. [/quote] Fenway, Once again kind thanks for your response... I actually worked it out late last night...about 4am!.... <? $result = mysql_query("Select listings_P.`Path`,listings_P.`ID` ,listings.`Description`, listings.`ID` FROM `listings_p` RIGHT JOIN `listings` ON listings_p.`L_ID`=`listings`.`ID` WHERE listings.`Type`='$L_Type' AND `listings`.`Area`='$L_Area' AND `listings`.`Value`='$L_Value'") or die(mysql_error()); while ($row = mysql_fetch_array($result)) { >? <img src="<? echo $row['Path'];?>">, <? echo $row['ID'],": ",$row['Description'];?> <? } ?> This grabs all matching records from listings and each associated record (image) from listings_p (One to many) via listings_p.L_ID = listings.ID Cheers DD
  13. [!--quoteo(post=387095:date=Jun 23 2006, 02:37 AM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jun 23 2006, 02:37 AM) [snapback]387095[/snapback][/div][div class=\'quotemain\'][!--quotec--] Well, a JOIN will give you your "additional" records [/quote] Fenway, Thank you for your kind reply. I had thought it would require a join... unfortunately,I do not know which join to use or how to use it.. All I have asked a few people about this and the general response is .."use a join" which is great if i knew how but I dont. I have read the Mysql manual entries for it and just dont get it. I suppose what I am really asking is: can some kindly person write the query for me? I can then follow it to see how and why each portion of it goes where in the query, basically learning by example. I would like to know how to include the join into my query statement, given that I firstly need to get all "listings" records that match the search criteria (type,Val,Area) THEN get each "listing_p" record where listings_p.L_ID matches listings.ID from the "listings" records returned by the inital search criteria. a one to many relationship (many "listings_p" records for each "listings" record) This was my original query, which worked great until I decided I need to add X more pics to each listings record - hence the listings_p table to hold all the associated image paths. <? ............. $result = mysql_query("SELECT * FROM Listings WHERE Type='$L_Type'AND Area='$L_Area'AND Value='$L_Val'") or die(mysql_error()); while ($row = mysql_fetch_array($result)) { <img src="<? echo $row['Path'];?>">, <? echo $row['ID'],": ",$row['Description'];?> } ?> Having just written the above, it suddenly became apparent that i have another issue: I do not know how to extract/display the "listings_p" records for each "listings" records from the array, given that "path" is now from the listings_p table and both "ID and Description" are from the listings table. Any help here would be kindly accepted too!. Sorry for the confusing mail. Kind regards to all DD
  14. Hi All I think this falls into the PHP + Mysql Joins issues category Scenario: I have two tables: listings and listings_p listings has the following fields: ID,Type,Area,Value, Desc. listings_p has :ID, L_ID, Path - "path" being the path to a jpeg file. Note: a one to many relationship - listings_p.L_ID = listing.ID 2: I have three dropdown boxes that I use to search the listings, these are Type, Area and Value. Requirement: I need to display all the data from listings plus any matching records (photos) from listings_p. where Type=X AND Area=X AND Value BETWEEN X AND X Issue: Getting the relevant records from listing is easy but what I can not workout is the Query to get the records from listings AND the matching records from listings_p where listings_p.L_ID = listing.ID. ie: For every listing record there are many Listing_p records Also :I need to do the above but this time get only the first matching record from listings_p (ie first photo) For every listing record get only the first Listing_p record any advice gratefully received. Cheers DD
×
×
  • 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.