Jump to content

rcharris

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Posts posted by rcharris

  1. Hi all,

    Something I;ve never done here before, so any help would be appreciated, if you have time please :)

    I've got the following code, and basically, I want to order a manually entered in date (mm/dd/yyyy with the latest date at the top and the furthest away at the bottom
    [quote]
                          <?php

    // Connect to the database server
    $dbcnx = @mysql_connect('n/a', 'n/a', 'n/a');
    if (!$dbcnx) {
    exit('<p>Unable to connect to the ' .
        'database server at this time.</p>');
    }

    // Select teh portfolio database
    if (!@mysql_select_db('n/a')) {
    exit('<p>Unable to locate the portfolio ' .
        'database at this time.</p>');
    }

    // Request the text of all the news stories
    $result = @mysql_query('SELECT title, id, content,date1, updated, url, picturename FROM news ORDER BY date1 ASC');
    if (!$result) {
    exit('<p>Error performing query: ' . mysql_error() . '</p>');
    }

    // Display the text of each joke in a paragraph
    while ($row = mysql_fetch_array($result)) {
        echo "{$row['date1']}<br /><a href=\"newsstory.php?story={$row['id']}\" class='noba_10_news_nav'>{$row['title']}</a><br /><img src='images/whiteline_154.gif' width='154' height='9'><br />";
    }
    ?>
          [/quote]

    (obv. ive removed the db details :))

    Thanks :)
  2. Hi there

    This is probably such a silly question ... but is there any way that I can define a table/css to display content from another page, instead of using an Iframe?

    Or do you know any other techniques, or do i have to use iFrames?

    PHP is not an option here for what I exactly want to

    Sorry about the silly question, and thanks in adnvance.
  3. Hi there,

    Seem to get a

    [quote]
    Parse error: parse error, unexpected T_STRING in \path\i\do\not\wanr\to\release\Web Design and Build.php on line 174[/quote] error and I cant see where!
  4. Hi all, apologies for the possible n00bness of this post, but I'm self taugh, and i've never done this query before

    I have a query running at the moment which is

    [quote]SELECT title, id, type, description, updated FROM portfolio WHERE type = \'Web Design and Build\' ORDER BY id DESC[/quote]

    but what I want the query to do is, yes, still retrieve that type, but only rows with a type of Web Design and Build, and "Main Page"

    Any ideas?

    Muchly grateful in advance :),

    rcharris
  5. Even though Im not the best PHP Dude, far from it, MD5 has been the best solution, I use it on all my systems.


    All you have to do (if I remember, I use the same markup for all my DB's) is that you set the particular row to MD5.

    To make the Login Box convert what the user types in as their password to MD5 Encryption I think you do add the following to your code (the code that follows the

    [quote]

    // This converts the PW to MD5 Hash.

    $pw_login = md5($pw_login);

    [/quote]

    Of Course Im using the variable $pw_login in the rest of my code and this bit to represent the password field.

    Sorry if its all blurry, no good explaining things

    _R


  6. Hi there  ;D

    Thanks for stepping up and helping me. Im grateful :)

    Im getting this when trying to implement the full code above

    [quote]You are missing a required field, please go back[/url] and correct before proceeding![/quote]

    Thanks =D

    Richard
  7. Hi there

    This is probably a really simple PHP Question for someone who knows what theyre doing, and thats not me.

    Im building a really simple PHP Content Management System, and I havent got the faintest how to implement an Image Upload into the following code:

    [quote]<?php
    session_start();
    if(!$_SESSION['username']){
    header("Location: login.php");
    exit();
    }
    include('../includes/config.inc.php');
    include('../includes/dbconnect.inc.php');

    if($_GET['delete']){
    $sql = "DELETE FROM `portfolio` WHERE id='" . $_GET['delete'] . "'";
    $result = mysql_query($sql) or die ("<b>ERROR: </b>" . mysql_error() . "<b>SQL: </b>$sql");
    header("Location: pages.php");
    exit();
    }
    ?>
    <html>
    <head>
    <title>NOBA Admin - Add or Edit News Story</title>
    <meta http-equiv="description-Type" description="text/html;">
    <style type="text/css">
    <!--
    .style1 {font-size: 14px}
    -->
    </style>
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_jumpMenu(targ,selObj,restore){ //v3.0
      eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
      if (restore) selObj.selectedIndex=0;
    }
    //-->
    </script>
    </head>
    <body>
    <form  id="editArticleForm"  name="editArticleForm"    method="post" action="<?=$_SERVER['PHP_SELF'];?>"  enctype="multipart/form-data" >
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><div align="center">
                  <?php
    if(!isset($_POST['Submit'])){
    $id = $_GET['edit'];
    $sql = "SELECT * FROM `news` WHERE id='$id'";
    $result = mysql_query($sql) or die ("<b>ERROR: </b>" . mysql_error() . "<b>SQL: </b>$sql");
    $rows = mysql_num_rows($result);
    while ($news = mysql_fetch_array($result)) {
    $news_title = $news["title"];
    $news_content = $news["content"];
                            $news_picturename = $news["picturename"];
    $news_alt = $news["alt"];
    $news_url = $news["url"];
    }
      ?>
                      <img src="assets/toplogo.gif" width="771" height="127"></div></td>
                    </tr>
      </table>
                  <table width="589" height="414" border="0" align="center" cellpadding="3" cellspacing="1">
                    <tr>
                      <td bgcolor="#000033"><strong> <img src="assets/title.gif" width="30" height="12"></strong></td>
                      <td><input name="title" type="text" class="txtboxlrg" value="<?=$news_title;?>" size="50"></td>
                    </tr>
                    <tr>
                      <td valign="top" bgcolor="#000033"><strong> <img src="assets/story.gif" width="38" height="15"></strong></td>
                      <td><textarea name="content" cols="50" rows="22" class="txtboxlrg" id="content" width="472"><?=$news_content;?>
                      </textarea></td>
                    </tr>
                    <tr>
                      <td valign="top" bgcolor="#000033"><strong> <img src="assets/pic_filename_and_ext.gif" width="178" height="12"></strong></td>
                      <td>[b]I NEED IT HERE. [/b]</td>
                    </tr>
                    <tr>
                      <td width="218" bgcolor="#000033"><strong> <img src="assets/alt_tag.gif" width="53" height="12"></strong></td>
                      <td width="484"><input name="alt" type="text" class="txtboxlrg" id="alt" value="<?=$news_alt;?>" size="50"></td>
                    </tr>
                    <input name="id" type="hidden" value="<?=$id;?>">

                    <tr>
                      <td bgcolor="#000033"><p><strong> <img src="assets/url.gif" width="53" height="12"></strong></p></td>
                      <td align="center" class="header2"><div align="left">
                        <input name="url" type="text" class="txtboxlrg" id="url" value="<?=$news_url;?>" size="50">
                      </div></td>
                    </tr>
                    <tr>
                      <td></td>
                      <td align="center" class="header2"><input name="Submit" type="submit" onFocus="this.blur();" value="Update"></td>
                    </tr>
      </table>
    </form>
    <?php
    } else {
    if((!$_POST['title']) || (!$_POST['content']) || (!$_POST['picturename']) || (!$_POST['alt']) || (!$_POST['url'])){
    echo "You are missing a required field, please <a href=\"javascript:history.back()\">go back</a> and correct before proceeding!";
    } else {
    if($_POST['id']){
    $sql = "UPDATE `news` SET title='" . $_POST['title'] . "', content='" . $_POST['content'] . "', picturename='" . $_POST['picturename'] . "', alt='" . $_POST['alt'] . "', url='" . $_POST['url'] . "', author='" . $_SESSION['firstname'] . " " . $_SESSION['lastname'] . "', updated=NOW() WHERE id = '" . $_POST['id'] . "'";
    $result = mysql_query($sql) or die ("<b>ERROR: </b>" . mysql_error() . "<b>SQL: </b>$sql");
    echo "news \"" . $_POST['title'] . "\" updated successfully - return to <a href=\"news.php\" onFocus=\"this.blur();\">news</a>!";
    } else {
    $sql = "INSERT INTO `news`  ( `id` , `title` , `content` , `picturename` , `alt` , `url` , `author`,  `added` ) VALUES('', '" . $_POST['title'] . "', '" . $_POST['content'] . "', '" . $_POST['picturename'] . "', '" . $_POST['alt'] . "', '" . $_POST['url'] . "', '" . $_SESSION['firstname'] . " " . $_SESSION['lastname'] . "', NOW())";
    $result = mysql_query($sql) or die ("<b>ERROR: </b>" . mysql_error() . "<b>SQL: </b>$sql");
    $id = mysql_insert_id();
    echo "Story \"" . $_POST['title'] . "\" added successfully - return to <a href=\"news.php\" onFocus=\"this.blur();\">news</a> or view <a href=\"../index.php?news=" . $id . "\" onFocus=\"this.blur();\">news here</a>!";
    }
    }
    }
    ?>
    </body>
    </html>
    [/quote]

    I have bolded out where I need the code, and have written I NEED IT HERE. Is it possible that one of you helpful chaps here could please write me a little bit of code to help me do this, but exxplaining it on the way? I need the image to upload to a directory, with the image name with extension being submitted to the database field, "picturename" which I have already inputted.

    I will be ever so grateful, thank you in advance


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