Jump to content

glendango

Members
  • Posts

    93
  • Joined

  • Last visited

Posts posted by glendango

  1. furlongs lol...  

    'something like that'  

    anyone care to look at rightmove and tell me what the hell is going on under the hood?  could be ' typeahead' j.s . with a json file of postcodes and counties,.Could be ajax calling the locations from the database...

    just because i type ajax into google doessnt mean that is the correct way to do it...  sweet jesus mother of god....   its like getting blood from bent coppers round here, so it is 

     

     

     

     

  2. They have a big database of locations. Probably purchased from and/or subscribed to a service that tracks stuff like that so they don't have to try to stay up to date themselves.

     

    interesting.   so do you think they use Ajax to get the locations from a database or would it be an API....   

    once a user selects  e.g.  Islington, London    .

    does this then add that as a $variable to a select statement to the database to create a list of properties on the next page ? 

    $location = islington

    select * from table where $location 

     

  3. Hi, i'am looking for best practices in 2019 for Search on a website.  Very similar to rightmove / zoopla etc. 

    1) They allow the user to search by county / postcode / town.  How is this list populated in the drop down?  is it a list of towns  in a plugin  which are then used as variables to populate the mysql select query,, or is it ajax populating the search input with a call to the db...

    Reason iam confused it i know of a site with no property in a certain area but the list still predicts the area ...i.e. if no matching address is in the db how is it populating?  

     

    2)  they also have a search function that once the user has arrived on the page by postcode..users are able to search 1/4 mile 1/2 mile radius etc from the  postcode for other properties...   how is this working?  

    thx for your time in advance .   

    in the jpeg i show the search box...when user types 'lon'    it brings up everything with lon in title i.e london, londonderry, long meadow  etc 

     

    onmark.JPG

  4. thx for your time but iam now equally confused..    Have you ever seen a search table / bar on a real estate property site?  

    it uses functions to query the database or the xml file with xpath. 

    where would you begin to search for these ready made functions ( granted i know i would have to fill in the gaps with my own data...

    think of it more like this:

    i want a hamburger.

    I could make a hamburger ( function)

    but macdonalds makes lots of ready made burgers..

     

    so , iam looking for directions of how to get to macdonalds..... to eat..... a burger  / function....

     

  5. I have been teaching myself xml manipulation as well as db queries to create a detailed search engine for users  ( a bit like rightmove uses to search through property and allow user to change e.g.. how many bedrooms or status of sold or available.. 

    I could keep on this path for another few weeks but i cant help thinking there must be php function  library that will basically give me the scripts i need to set up a real estate website with all the functions i need for searching property ..

    i dont mean wordpress either....  this is terrible experience and trying to glue the xml feeds into a parser and into a blog without some of the data being lost is annoying. 

    i started using laravel a few weeks ago and with 1 line of code a login system was created using COMPOSER...

    i thought this would be great..but on visiting composer i cant make head or tail of their  search bar  to even find what i'am looking for on the composer site.

     

    Does what i'am looking for exist ?   

    The site iam was hoping to find was:

     

    www. here you go, all the code you need to make a modern web site in 2018 , all divided into handy folders  and clear explanations of what they do      .com  

    so far i havent found anything that comes close....    

     

     

    cheers. 

  6. this is how it looks now but i dont get the last id i get (0) in the pictures and they still dont loop so i get 1 picture.

     

    $sql = "INSERT INTO properties( instructedDate, price_text, bedrooms, priority,  advert_heading, brochure) VALUES ('". $instructedDate ."','". $price_text ."','". $bedrooms ."','". $priority ."','". $advert_heading ."','". $brochure ."')";

    $prop_id = mysqli_insert_id($conn);

    foreach ($xml->branches->branch->properties->property->pictures->picture as $rows)
    $pictures = (string)$rows->filename;
    //$sql2 = "INSERT INTO pictures(property_id, filename) VALUES (LAST_INSERT_ID(),'". $pictures ."')";

    $sql2 = "INSERT INTO pictures( filename) VALUES ('". $prop_id ."' , '". $pictures ."')";

    print_r($sql);
    echo"<br><br>", print_r($sql2);echo"<br><br>";
     

  7. maybe that was lost in translation.. yes i have a primary key for every image. =    picture_id   in my case.  So i have 3 columns in the pictures table. 

    So,  how to get many pictures belonging to each product into the table with the same property_id  .  Any chance you could could edit my example..cant follow your foreach example. 

  8. Happy Thursday !   I will try to ruin it for you. 

    I have an xml file with products in it and i use xpath to get out what i need from the file.

    Nested in each product are all the elements =  $variables below.   i need the pictures of which there may be upto 20 in each product to go into a seperate mysql table because its relational. but have the same id as the property table. 

    i have managed to get the first picture to behave this way by using Last_insert_id .   What i cant do is get the remaining pictures->picture->filename  (nested) ; to insert into the table with the corresponding property id (which i auto increment) 

    the filename holds the text url (not a blob)  which i store and will echo once i start doing my select statements. 

     

    Hope this is clear enough....  thx

     

    $xml = simplexml_load_file('propertiesshort.xml') or die("can not find it");

     

    foreach($xml->branches->branch->properties->property as $row){
     
     

     $instructedDate = (string)$row->instructedDate;
    $price_text = (string)$row->numeric_price;
    $bedrooms = (int)$row->bedrooms;
    $priority =(string)$row->priority;
    $advert_heading = (string)$row->advert_heading;
    $brochure = (string)$row->brochure;

    foreach($xml->branches->branch->properties->property->pictures as $rows ){
     
    $pictures = (string)$rows->picture->filename;
     

    $sql = "INSERT INTO properties( instructedDate, price_text, bedrooms, priority,  advert_heading, brochure) VALUES ('". $instructedDate ."','". $price_text ."','". $bedrooms ."','". $priority ."','". $advert_heading ."','". $brochure ."')";

     

    $sql2 = "INSERT INTO pictures(property_id, filename) VALUES (LAST_INSERT_ID(),'". $pictures ."')";

    print_r($sql);
    echo"<br><br>",

    print_r($sql2);

    echo"<br><br>";

     


    ?>

        

  9. great thanks... you actually answered all my questions you couldnt understand at the end with your other answers..

    SO 

    database is better to store

    use simplexml  to get the xml and then use php to insert the xml into a database..( a cron job can be set up to do this automatically) 

     

    Sounds simple out loud but you would be amazed how hard it is to get this method confirmed as the correct way to do something...  

    Even in massive big php books xml  only gets about 1 page..... 

     

    i suppose i didnt get answer onn how you put all the elements into the database  , but iam guessing this is done by hand....  like this example...  

    foreach ($xml->children() as $row) {
        $title = $row->title;
        $link = $row->link;
        $description = $row->description;
        $keywords = $row->keywords;
        
        $sql = "INSERT INTO

     

     

  10. many thanks... so what is simplexml for ?    i thought the database option was most logical but got thrown by the use of this tool  .  

    also when it comes to  insert/update the database ,   would i set up a php statement for every element of a property (there are 4 fileds (tables) and over 50 eleements. 

    Do you hand write in every element to the code and the table titles?  i dont mind doing this as once its done once thats it.. but interested in the logic of xml to database to website....  

    nb..  is simplexml used to display basic information from an rss  / api type feed...    ?  you put the xml into a database when you need more control over data? 

     

  11. 1) Feed comes from a CRM which is a third party.  I will be creating a website that uses the feed to display over 100 products from the feed. 

    2) The feed is updated every 1 hour. 

    3) The data is property for estate agents..so basically a web site for an estate agents. 

    There are plugins for this on wordpress but i dont want to use them as i want full control of the data. 

    hope this helps...

     

  12. Before i get slaughtered on stack i wanted to reask a question i cant get an answer to....sorry.

    XML Project.

    What is the pro way of handling xml data feed  from a crm which i will eventually display the content on   a  searchable website….?

    Do you use simplexml or do you dump the ftp file into a database and then call what you need with php/html?

    Do you update a mysql database with a cron job / php script ?  If so i want to  overwrite the old data with the fresh data, is this possible?

    Why do we use simplexml? I ve tested it today and i like the way you can extract what you want from the .xml file  ..so if its that good... Do I need a database at all if my script can display the raw xml without the need for  a db..?

     

    What ive done so far is :

    Use simplexml on some basic files which worked fine but as soon I started using a ‘real’ xml file I coudnt get anything out of it.(currently asking feeder what is going on, waiting for answer) 

    I cant find any straight advice on what pro devs do.. ive seen a lot on json as well which I like but all the crm houses  still use xml feeds…

    Thanks in advance.

  13. .   iam sure what you said is correct.... all the other elements will only have 1 entry..

    example 

    table 1 Properties 

    bullet1

    bullet2

    bullet3.....   

    bullet 10

    they are predefined values put in by the user of the crm...

     

    Thanks..

    DO i still have to manually put the fields in the table in by hand though?   ii could have done it by now tbf but i wanted to see if more speedier way to set up the db..

     

  14. that makes sense... so you might have many tables for an xml file with this many elements..i can feel a plugin coming on?

    in this case a table would be

    branches, properties, rooms, pictures, floorplans..

     

    And do you have to name all the fields in the table by hand or can you use a 'flat file' ??  

    i find all the buzz words i just cant piece them together. 

  15. Hi,,HAs anyone ever worked on .xml files with many elements in them. 

     

      iam working on an xml project which i will eventually receive a feed from the xml provider ,  but having same issue understanding the process. 

    I have a .xml practice file/doc  and its for property on the market..  example below of content ( this is a practice file the feed provider releases to 'help' with set up..)

    <?xml version="1.0"?>

    -<agency name="Baxters Group" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">


    -<branches>


    -<branch name=" Baxters Bath">


    -<properties>


    -<property reference="BB00000285">

    <availableFrom/>

    <department>Agricultural</department>

    <propertyofweek>NO</propertyofweek>

    <price_text>OIRO £749,950</price_text>

    <numeric_price>749950.0000</numeric_price>

    <bedrooms>4</bedrooms>

    <receptions>2</receptions>

    <bathrooms>0</bathrooms>

     

    -----------------------

     

     

     

    There are literally  a 100 more elements to make up a complete a property... 

    DO i actually have to manually create a field name for every element? 

    This will take hours and i dont want to do this if the theory is incorrect . 

    ALSO a house may have 10 photos or it may have 30 photos...how do i set up the schema to accomodate (pardon pun) all these different elements..

     

    i would ask but nothing online goes back to basics..everything assumes the db schema knowledge is normally about 4 elements...  i wish. 

    i could just use a plug-in on wordpress but i want to learn this for more unsupported apps i might build. 

    thanks

     

     

     

  16. i'am trying to get the users rank so i can display their rank in a div.. i.e you are 30 out of 400 users at getting sales. 
     
    So far i ve managed to get the order of the users but thats it:     i count the date_mades as sales made to get the totals. 
     
    SELECT usr_id, count(date_made) as dater, @curRank := @curRank + 1 AS rank FROM firsts 
    group BY usr_id order by dater desc
     
     
    gives me :
     
     

    usr_id dater dot.gif  rank    

       1        20      NULL

    16            3     NULL

    3             2        NULL

    5            1         NULL

    9             1        NULL

    22          1         NULL

    25          1       NULL

     

     

    i found this answer (Attached snippet) but i just get red crosses all over the statement when i try and run it:  does anyone else get errors just pasting this into their phpmyadmin? is it a parser problem or syntax?  

     

     

     
     
    SELECT pid, name, age, rank FROM
    (SELECT pid, name, age,
    @curRank := IF(@prevRank = age, @curRank, @incRank) AS rank,
    @incRank := @incRank + 1,
    @prevRank := age
    FROM players p, (
    SELECT @curRank :=0, @prevRank := NULL, @incRank := 1
    ) r
    ORDER BY age) s

     

     

     

×
×
  • 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.