Web Analytics Made Easy -
StatCounter Dynamic PHP - CodingForum


No announcement yet.

Dynamic PHP

  • Filter
  • Time
  • Show
Clear All
new posts

  • Dynamic PHP

    I want to make a dynamic PHP page.
    My idea is store javascript in myql (in a text field) and load data into variable $dynamic when it want to use (only need to echo $dynamic).
    And the same idea to create static page with mysql (HTML only). All tag will store in mysql and when I need them, just to load it out.
    But both of my idea have problem with parsing error.
    Can anyone help me


  • #2
    You should post your code we see what you're doing!


    • #3
      Just select the data from the MySQL table when you need it.


      • #4
        I don't have my code at my home now. This my idea :
        I have a database name dynamic. It has a table named static.
        Static table has two fields : id (primary) ==> number of template; content (text) ==> all HTML tag neccessary.
        Connect to MySQL :

        $result=mysql_query("SELECT * FROM static";
        if(!$result) fail("database query failed, login page", true);
        // fail is my function

        Diplay in PHP :

        echo $content;


        • #5
          Your idea is perfectly fine and it's something that we (PHP scripters) use all the time (partially in my case!). The semantics are fine, it should be something with the syntax and without seeing your code I can't tell ya what it is.


          • #6
            In Mysql, I put in field static (style : TEXT)

            <TITLE>My template</TITLE>
            H1 {color:#CCCCCC; font:bold 16pt 'Verdana','Tahoma','Ariral'}
            H2 {color:#CCCCCC; font:bold 12pt 'Verdana','Tahoma','Ariral'}
            P {color:#CCCCCC; font:bold 10pt 'Verdana','Tahoma','Ariral'}
            A:link {color:#FF0000; font:bold 10pt}
            A:hover{color:#FFFF33;font:bold 10pt}
            A:visited{{color:#CC9900;font:bold 10pt}
            <BODY BGCOLOR='#000066' TEXT='#CCCCCC'>
            <H1 align='center'>$title</H1>


            • #7
              I see nothing wrong with your code, but lemme show ya one simple technique that I'm sure you know yourself, but sometimes we forget it. Try to reduce your code as much as possible and test it, if it works, then add some other lines to it and test it again, continue this test until you encounter your first error, this time you know what lines are buggy and you should fix them!


              • #8
                Welcome here!

                I see a lot of problems with both your HTML and your PHP code. Post back in you want info on them.

                If you just wan't to get rid of the errors, then post the errormessages you get + the actual code (the relevant parts) or follow ConfusedOfLifes advice.
                Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html


                • #9
                  I am trying to repair my code myself. I had split my code into smallest as possible. And the static is run well.
                  Here is the code :

                  $result=mysql_query("SELECT * FROM static");
                  if(!$result) echo "fail";
                  echo $content;
                  echo "Please try again.<BR>";
                  I had rejected " and "; in HTML text that I post last time (it is small error)
                  Now I am trying to test with dynamic part, if I got error I will ask you. If you have any example, can you send me (I just need to catch the idea, and simple example may helpful to me)