SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2001
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To any php and/or MySQL programmers out there,

    I am a newbie in php & MySQL technologies and I am trying to get them operational on a site that I'm working on (which will have articles and lots of other things). I realize the power of php and I want to incorporate it into the site. I've been reading the article found on http://www.webmasterbase.com about php & mySQL but I still have some questions.

    Is it possible to have a php script within a php script? That is, to retrieve information from the database that contains php coding? It didn't seem to work when I tried it. I am not sure if this is at all possible.

    I was wondering how the http://www.webmasterbase.com used php3. If you look at their site, you'll notice that their navigation links are to a subcats.php?id=some_number. And when clicking on one of those links, you'd find all the articles within that section. I wondered if the listing of articles was done by grabbing information from the database from the articles database they use, or from the database that the subcats use. I would think it's grabbing info from the articles database, because they would be tremoundously more efficient as you wouldn't have to update both databases to reflect new changes. Does this make sense to you? Any help on how to do this would be very appreciated.

    Regards,

    Leo Chan

  2. #2
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Leo Chan
    Is it possible to have a php script within a php script?
    Take a look at the eval function, which can be used to process a text string as PHP code.

    I was wondering how the http://www.webmasterbase.com used php3. [...] I wondered if the listing of articles was done by grabbing information from the database from the articles database they use, or from the database that the subcats use.
    Indeed, the article titles and descriptions are being pulled from our database table of articles, while the listing itself is coming from a lookup table that associates article ID's with category and subcategory ID's. An SQL join is then used in the SELECT query to pull information from several tables at once (articles, categories, article/category lookup).

    This type of database design and the use of SQL joins is covered in detail in my PHP/MySQL article series, which from your post you are currently reading.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •