Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Apr 2003
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Databased Website won't process PHP

    Ok, I have a ratings section for professors on my site. I first had the original like this
    http://www.campus-resource.com/ratin...ucsb/index.php
    Ok, go here and notice the advertisements on the right and the menu on the left. Both load off of php functions such as include.

    Ok, I have recently started databasing pages due to file number restrictions and have this here

    http://www.campus-resource.com/ratin...2.php?userid=3

    Ok, i have the php coding copied into the database but it doesn't get processed and is left blank instead. How can I get these processes to continue to function?

    Here is how I want my final index.php to look [or whatever works]:
    <?php
    include '../../../myscon/db.php';
    $userid = $_REQUEST['userid'];
    $sql = mysql_query("SELECT * FROM dbtester WHERE userid='$userid'");
    $row = mysql_fetch_array($sql);
    $body = $row['html'];
    echo $body;
    ?>

    That's what I have now and this is what I have in the 'html' section of DB:

    <html>
    <head>
    <title>Campus Resource- Class Ratings of UC Santa Barbara</title>
    <meta name="keywords" content="teacher, teacher, class number, class name, campus name, class, ratings, rating, evaluation">
    <meta name="description" content="Offers ratings on listed teachers and classes at UCSB">

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style>a:link { color:#20255F; text-decoration:none; }
    a:visited { color:#20255F; text-decoration:none; }
    a:hover { color:#C9C8CE; text-decoration:none; }
    a:active { color:#C9C8CE; text-decoration:none; }</style>
    </head>

    <body>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td><div align="center"><font color="#999999">*Please note that there may
    not be a relationship between class and teacher on same row.</font></div></td>
    </tr>
    </table>

    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td align="center"><img src="../../images/campuslogo/ucsb.gif" width="619" height="50"></td>
    </tr>
    </table>

    <table width="100%" align="center" border="0" cellpadding="0" cellspacing="0">
    <!--DWLayoutTable-->
    <tr>
    <td width="19%" height="594" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
    <!--DWLayoutTable-->
    <tr valign="top">
    <td width="100%" height="594">
    <?php include("http://www.campus-resource.com/ads/leftbar.txt"); ?>
    </td>
    </tr>
    </table></td>
    <td width="62%" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="2%"></td>
    <td width="48%" height="32" background="../../images/bg1.jpg">
    <div align="center"><strong><font color="#010A73">Teacher Name</font></strong></div></td>
    <td width="2%"></td>
    <td width="48%" height="32" background="../../images/bg2.jpg">
    <div align="center"><strong><font color="#010A73">Class Name/Number</font></strong></div></td>
    </tr>
    </table>
    <br>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr valign="top">
    <td width="2%">&nbsp;</td>
    <td width="48%"><a href="dickey.php"><strong>Dickey, T</strong></a>
    <br>
    <a href="?userid=1"><strong>Harmon, C</strong></a> <br>
    <strong><a href="klein.php">Klein, S</a></strong> <br>
    <strong><a href="krouse.php">Krouse, C</a></strong><br>
    <a href="maass.php"><strong>Maass, L</strong></a>
    <br>
    <a href="proulx.php"><strong>Proulx, C</strong></a> <br>
    <a href="sander.php"><strong>Sander, H</strong></a></td>
    <td width="2%">&nbsp;</td>
    <td width="48%"><a href="econ100B.php"><strong>Econ 100B</strong></a><br>
    <a href="econ116.php"><strong>Econ 116</strong></a>
    <br>
    <a href="econ118.php"><strong>Econ 118</strong></a><br>
    <a href="econ136A.php"><strong>Econ 136A</strong></a>
    <br>
    <strong><a href="econ136B.php">Econ 136B</a></strong> <br>
    <strong><a href="econ136C.php">Econ 136C</a></strong> <br>
    <strong><a href="maass.php#137B">Econ 137B</a></strong> <br>
    <strong><a href="econ139.php">Econ 139</a></strong><br>
    <strong><a href="geog3A.php">Geog 3A</a></strong><br>
    <strong><a href="psy102.php">Psych 102</a></strong></td>
    </tr>
    </table>


    </td>
    <td width="19%" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
    <!--DWLayoutTable-->
    <tr valign="top">
    <td width="145" height="594"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr valign="top">
    <td valign="top">
    <?php

    $include_file_array[] = "http://www.campus-resource.com/ads/ad1.txt";
    $include_file_array[] = "http://www.campus-resource.com/ads/ad2.txt";
    $include_file_array[] = "http://www.campus-resource.com/ads/ad3.txt";
    $include_file_array[] = "http://www.campus-resource.com/ads/ad4.txt";
    $include_file_array[] = "http://www.campus-resource.com/ads/ad5.txt";

    $include_file = $include_file_array[ rand( 0, ( sizeof($include_file_array) -1 ) ) ];

    include($include_file);

    ?>
    </td>
    </tr>
    </table></td>
    </tr>
    </table></td>
    </tr>
    </table>
    </body>
    </html>

    This is what loads and it never processes the php variables in 'html'.

    Pay no attention to the a href links for they will be changed to database setup later. I need the two processes to load also. But how?

    Thanks
    Ryan
    The Can Magazine- Best Online Entertainment Magazine. Updated Daily.

    Find Your Toy- List your vehicle on this powerful listing service for free.

  • #2
    Regular Coder
    Join Date
    Feb 2003
    Location
    California
    Posts
    925
    Thanks
    0
    Thanked 0 Times in 0 Posts
    $include_file_array[] = "http://www.campus-resource.com/ads/ad1.txt";
    $include_file_array[] = "http://www.campus-resource.com/ads/ad2.txt";
    $include_file_array[] = "http://www.campus-resource.com/ads/ad3.txt";
    $include_file_array[] = "http://www.campus-resource.com/ads/ad4.txt";
    $include_file_array[] = "http://www.campus-resource.com/ads/ad5.txt";

    $include_file = $include_file_array[ rand( 0, ( sizeof($include_file_array) -1 ) ) ];


    I didn't pay to much attention but right here it looks like you are overwritting the arrays with different ad numbers so you will always have number 5....just so you know...

    oh, looking closer at your db call in my sql it looks like you are only calling a single column from the DB, the "html" column. you might change the SELECT statment to "SELECT html FROM dbtester WHERE userid='$userid'" that way you start with that and you don't need to use the $row['html'] command to get the correct column...

    Jason
    Last edited by Jason; 11-11-2003 at 01:35 AM.

  • #3
    New Coder
    Join Date
    Apr 2003
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Ahhh, OK

    Ok, these two PHP functions work perfect in a normal php file. HOwever, they do not work anymore when loaded from the database. How do I get them to work?

    Thanks
    Ryan
    The Can Magazine- Best Online Entertainment Magazine. Updated Daily.

    Find Your Toy- List your vehicle on this powerful listing service for free.

  • #4
    Regular Coder
    Join Date
    Feb 2003
    Location
    California
    Posts
    925
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I would suggest looking at the output and see if the HTML is being translated or if you even have the right calls. Do some debuggin per-se...


    Jason


  •  

    Posting Permissions

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