Jump to content

ryanfilard

Members
  • Posts

    252
  • Joined

  • Last visited

Posts posted by ryanfilard

  1. I have created a script to insert data into a database, but it returns this.

     

    Warning: mysql_select_db() expects parameter 2 to be resource, null given in /RJFWS198/testing/elemata_project/admin/elements/create_page.php on line 51

     

    Here is the code

     

    <?PHP 
    
    //Protect Against Attacks
    
    if (empty($_SESSION['E_User']))
    {
    die("Access Denied");
    }
    
    ?>
    <?php
    
    if (!empty($_REQUEST['title']) && (!empty($_SESSION['E_User'])))
    { 
    require_once('../Connections/default.php');
    
    if (empty($_REQUEST['password'])) { $password = "0"; }else{ $password = $_REQUEST['password']; }
    
    if (empty($_REQUEST['menu_order'])) { $mo = "0"; }else{ $mo = $_REQUEST['menu_order']; }
    
    if (empty($_REQUEST['meta_keywords'])) { $meta_keywords = "0"; }else{ $meta_keywords = $_REQUEST['meta_keywords']; }
    
    if (empty($_REQUEST['meta_desc'])) { $meta_desc = "0"; }else{ $meta_desc = $_REQUEST['meta_desc']; }
    
    if (empty($_REQUEST['meta_copyright'])) { $meta_copyright = "0"; }else{ $meta_copyright = $_REQUEST['meta_copyright']; }
    
    $author = $_SESSION['E_User'];
    
    $date = date("m.d.y");
    
    $day = date("d");
    
    $month = date("n");
    
    $year = date("Y");
    
    $time = ''.date("g").''.date("i").''.date("a").'';
    
    $ptitle = $_REQUEST['title'];
    
    $post_content = $_REQUEST['postContent'];
    
    $searchable = $_REQUEST['seachable'];
    
    $locked = $_REQUEST['privacy'];
    
    $tags = $_REQUEST['tags'];
    
    $meta_robots = $_REQUEST['robots'];
    
    mysql_select_db($database_default, $default);
    mysql_query("INSERT INTO posts (`time`, `year`, `month`, `day`, `date`, `author`, `title`, `content`, `searchable`, `locked`, `password`, `menu_order`, `tags`, `meta_keywords`, `meta_desc`, `meta_robots`, `meta_copyright`) VALUES ('$time', '$year', '$month', '$day', '$date', '$author', '$ptitle', '$post_content', '$searchable', '$locked', '$password', '$mo', '$tags', '$meta_keywords', '$meta_desc', '$meta_robots', '$meta_copyright')");
    
    }
    ?>

  2. About a year ago I started a CMS system called Elemata CMS. I stopped working on it for a while then I went back to it. There is so much to program, and I need help. I wasn't sure where to post this, but I posted it here.

     

    If you would like to help message me.

  3. I have a mysql table with the columns ip, date, and page. How would I get the total number of rows with the same ip address.

     

    My Table:

    ip:                date:          page:

    192.168.1.1  1.1.2011    1

    192.168.1.1  1.1.2011    2

    192.168.1.1  1.1.2011    3

    192.168.1.1  1.1.2011    4

    192.168.1.1  1.1.2011    3

    192.179.1.1  1.1.2011    2

    192.179.1.1  1.1.2011    7

    192.179.1.1  1.1.2011    1

    192.179.1.1  1.1.2011    2

     

    All the IPs that are the same should be grouped together.

    mysql_num_rows should output 2

     

  4. I am tying to make my category menus mysql based but all my sub categories end up under the last category. Here is my code.

          <ul class="sf-menu">
                                <li><a href="http://www.mysite.com/index.php">Home</a></li>
                                <?PHP do { ?>
                                <li><a href="news.php?c=<?PHP echo $row_bodynav['id']; ?>"><?PHP echo $row_bodynav['catname']; ?></a>
    						<?PHP if ($row_bodynav['slug'] == $row_bodynav_sub['parent']) {echo '<ul>'; do { ?><li><a href="news.php?c=<?PHP echo $row_bodynav['id'];?>&sc=<?PHP echo $row_bodynav_sub['id']; ?>"><?PHP echo $row_bodynav_sub['subcatname']; ?></a></li> <?PHP } while ($row_bodynav_sub = mysql_fetch_assoc($bodynav_sub)); echo '</ul>';} ?>
                                </li>
                                 
    						 <?PHP } while ($row_bodynav = mysql_fetch_assoc($bodynav)); ?>
                                 </ul>

  5. I currently am using this

     <?PHP do { ?>
    <h1><?PHP echo $texthead; ?></h1>
    <p><?PHP echo $text; ?></p>
                                 <?PHP } while ($row_bodynav = mysql_fetch_assoc($bodynav)); ?>

    I am not sure how to make it display something different for the first result.

     

    It would usually be like this

    • Text
    • Text
    • Text
    • Text

    But I would like it to do something like this.

    • Text
    • Text
    • Text
    • Text

     

  6. I am currently trying to make a line graph out of data using php and javascript. How do I add up the values of a column and separate them by month. For example the database has 74 amount of rows. Then the values from the "views" column get added up and then displayed by month.

     

       <table width="70%" class="linechart">
         <thead>
           <tr>
             <td></td>
             <th scope="col">Jan</th>
             <th scope="col">Feb</th>
             <th scope="col">Mar</th>
             <th scope="col">Apr</th>
             <th scope="col">May</th>
             <th scope="col">Jun</th>
             </tr>
           </thead>
         
         <tbody>
           <tr>
             <th scope="row">Post Views</th>
             <td>24324</td>
             <td>29634</td>
             <td>15435</td>
             <td>56545</td>
             <td>23543</td>
             <td>2123</td>
             </tr>
             
           </tbody>
       </table>
    

  7. I already have a script that uploads the image but I would like to make a copy of the image resized down by 50% and uploaded to a new folder (imgups/thumbnails) I want it to do this all in one php script. I am not sure how to do this.

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