Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About kutchbhi

  • Rank

Profile Information

  • Gender
    Not Telling
  1. kutchbhi

    Parsing JSON data and inserting to MySQL

    For now don't worry about JSON. The following converts JSON into a regular PHP array. An array which has more arrays inside it ( Multidimensional array) //convert json object to php associative array $data = json_decode($jsondata, true); Simple explanation: For an array $carsArr = array( array("Volvo", 22, 18), array("BMW", 15, 13), array("Saab", 5, 2), array("Land Rover", 17, 15) ); $carsArr[0] - first item in the array . Basically $carsArr[0] is equal to ("Volvo", 22, 18) Now $carsArr[0][1] would be the second item of $carsArr[0] . That is '22' here. $carsArr[0][0] would be the - "Volvo " And so on
  2. DI isn't a basic feature of OOP. It's a design principle/technique. https://en.wikipedia.org/wiki/Dependency_injection Here is where I got a fair idea about this: https://knpuniversity.com/screencast/dependency-injection
  3. Trying to deeply learn about - dependency injection / factories and other software engineering concepts. My Goal is to architecture my apps better, by writing modular components. I can find plenty of blog posts and random videos about learning these, but It would be great if someone can suggest a proper video series or book for this. Or please just suggest what/where can I search for finding a course for this. As in does this land under 'design patterns ' , 'software architecture' or something else ? Any help ? Thanks
  4. Hello I am using fpdf to generate pdf files based on certain csv files. Now the client wants certain fields of the generated pdf file to be 'interactive' . Is this possible ? Googling about editable (interactive pdf's) only confused me . any help ? btw by interactive I mean fields that can be typed into directly by the client and then saved into the pdf .
  5. kutchbhi

    delete from - a statement with a join

    nvmind I added an index to the pid column and the delete worked fine!
  6. The following query selects the rows that I want to delete- select bad_rows.* from products as bad_rows inner join ( select pid, MAX(last_updated_date) as maxdate from products group by pid having count(*) > 1 ) as good_rows on good_rows.pid= bad_rows.pid and good_rows.maxdate <> bad_rows.last_updated_date; Now to actually delete them I tried changing the first word - 'select' to 'delete', but in this case the query seems to run forever and no rows are deleted. Why ? How else can these rows be deleted? btw what I am trying to do is get rid of duplicates. the selelct query works just fine in selecting the records, all I have to do is figure out a way of deleteting them Thanks
  7. I am building a site that will have a basic form for user submitted content. I would like to screen / moderate the content before it goes live. Is there an existing script that can be just plugged in to my code ? I don't need anything fancy, just a script that would work something like this: load data from a specified table and have a couple of buttons to toggle a columns value from approved to unapproved etc.. Thanks
  8. kutchbhi

    Handling select unescaped insert data in mysqli

    Ah thanks man! I should have seen this myself. Meanwhile I came up with a ghetto solution : using preg_replace to convert the ' to ' and then addslashes to escape it. Works but I think I'll stick with html_entity_decode way.
  9. So I have an old bit of database that is inserting data into a table unescaped. Which means quotes are unescaped. Now I have to do a select with a LIKE comparison on the data. But since the data in the table isn't escaped, I get no match if I escape the data while selecting. Basically the LIKE comparison takes place between "Tom Clancy's: Splinter Cell%" and "Tom Clancy's: Splinter Cell%" Now I am not sure how to handle this . Any suggestions please ? $escapedTitle = $db_connection->escape_string($title) ; $res = select_sql('products', "product_name LIKE '" .$escapedTitle . "%' AND subtitle = '" . $db_connection->escape_string($sub) . "' LIMIT 1") ; Thanks
  10. kutchbhi

    'How' does one use a CMS ?

    This may sound strange, but I really struggle to use ANY php CMS, even though I am fine with frameworks..reason I think is because while using a CMS, I have to google a lot. For every little thing I have to google for several minutes, and keep thinking only if I wasn't using a CMS, I would know exactly what to do... Now I am building another classified like site, a site that could really benefit from a CMS . But I am wary of giving wordpress another try, since I know I'll spend more time googling than coding. So if anyone understands my predicament and can offer some suggestions OR knows what I am doing wrong and can suggest a suitable CMS ? btw I am VERY comfortable with coding in php, its just that CMS seem to require more research than actual coding.. Thanks

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.