SitePoint Sponsor

User Tag List

Page 2 of 7 FirstFirst 123456 ... LastLast
Results 26 to 50 of 151
  1. #26
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    So, it means you fixed the Warning you were getting?

    Which page would you like to do next and what questions do you have about making them?
    -- Jelena --

  2. #27
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yah the warning was sentax error fixed.
    i think all start coding the main admin page using XHTML & CSS
    then all start adding some functionalitys like how many record in the DB, total heading
    and shown articles, then all move to coding delete page were the admin can read add delete change the status...etc.

    the idea is to combine the the display with the delete something like this

    article Name----Article summary----Date added----Status----Action To Take

    summercamp......tripToJapan..........13-04-2006......active......read--Edite--Delete


    what do you think ?

  3. #28
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yep, that's the way I would go!
    You can also create a filter/little search on that page with one select where he will be able to choose if he wants to see only pending articles or only active ones.
    If you get stucked with it, just post your code and we'll try to solve the problem.
    -- Jelena --

  4. #29
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks jelena apriciated

  5. #30
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the mainpage of the addmin will be something like this

    any extra functionallty you think should be there please let me know

    thanks

    see attachment
    Attached Images Attached Images

  6. #31
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    that layout is fine, but maybe you don't need those links but just one select with those options:
    show all/approved/not approved
    Just my opinion.
    -- Jelena --

  7. #32
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry i dont realy understand what you mean.
    ah do you mean i remove the links
    Display All, Display Active and Display Inactive
    to
    Show all/Approved/Not Approved

  8. #33
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Nope, but create this:

    Code:
    Display
    <form action="" method="get">
    <select name="status">
    <option value="">All</option>
    <option value="1">Active</option>
    <option value="0">Inactive</option>
    </select>
    </form>
    Last edited by jelena; Mar 28, 2006 at 09:39.
    -- Jelena --

  9. #34
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok i did a small code for the number of rows in the table its not efficient
    but it does the job any suggestions on making it better.


    PHP Code:
    <?php

        $dbhost 
    'localhost';
        
    $dbuser 'roots';
        
    $dbpass '555456';
        
    $dbname 'site';
        
        
    $conn mysql_connect($dbhost$dbuser$dbpass) or die ('connecting to MySQL failed');
        
    mysql_select_db($dbname);

    $result1mysql_query("SELECT * FROM articles");
    $result2mysql_query("SELECT * FROM articles WHERE status = '1'");
    $result3mysql_query("SELECT * FROM articles WHERE status = '0'");
        
    $num_rows1 mysql_num_rows($result1);
        echo 
    "total record " .$num_rows1;
        echo 
    '<br />';
        
        
    $num_rows2 mysql_num_rows($result2);
        echo 
    "approvid records " .$num_rows2;
        echo 
    '<br />';
        
        
    $num_rows3 mysql_num_rows($result3);
        echo 
    "not approvid records records " .$num_rows3;
        echo 
    '<br />';
        
    mysql_close($conn);

    ?>

  10. #35
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Haven't tested this, but you will get an idea how you could do it:
    PHP Code:
    <?php

    $status 
    $_GET["status"];


        
    $dbhost 'localhost';
        
    $dbuser 'roots';
        
    $dbpass '555456';
        
    $dbname 'site';
        
        
    $conn mysql_connect($dbhost$dbuser$dbpass) or die ('connecting to MySQL failed');
        
    mysql_select_db($dbname);

    $sql "SELECT * FROM articles";
    if(
    $status != "")
        
    $sql .= " WHERE Status = '".$status."'";

    $result1mysql_query($sql);
        
    $num_rows1 mysql_num_rows($result1);
        echo 
    "total record for ";
        if(
    $status == "")
            echo 
    "all records";
        elseif(
    $status == 1)
            echo 
    "approved records";
        else
            echo 
    "pending records";
        echo 
    " is ".$num_rows1;
        echo 
    '<br />';
        
        
    mysql_close($conn);

    ?>
    -- Jelena --

  11. #36
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    very intersting nesting

    but what does this do ?

    if($status != "")
    $sql .= " WHERE Status = '".$status."'";

  12. #37
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i got it very coool intersting WOW

  13. #38
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    1 query instead of 3 Cool indeed
    -- Jelena --

  14. #39
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    please tell me what do you think of this
    i made it as a brief discription of all the articles

    and all all add a buttens for delete and edite on each article listed.

    but there is a warning for this code
    Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in E:\Practise\test1\listarticles.php on line 69

    PHP Code:
    <?php

    $status 
    $_POST["status"];


        
    $dbhost 'localhost';
        
    $dbuser 'roots';
        
    $dbpass '555456';
        
    $dbname 'site';
        
        
    $conn mysql_connect($dbhost$dbuser$dbpass) or die ('connecting to MySQL failed');
        
    mysql_select_db($dbname);

    $sql "SELECT * FROM articles";
    if(
    $status != "")
        
    $sql .= " WHERE Status = '".$status."'";

    $result1mysql_query($sql);
        
    $num mysql_num_rows($result1);
        
        if(
    $status == ""){
            for(
    $i=0;$i<$num;$i++) { // Start looping
            
    $array mysql_fetch_array($result1);

            
    $articleid $array[0];
            
    $articlename $array[1];
            
    $summary $array[2];
            
    $date $array[6];
                    
            echo 
    $articleid;
            echo 
    $articlename;
            echo 
    $summary;
            echo 
    $date;
            echo 
    "<br />";
            }
            }
     elseif(
    $status == 1)
    for(
    $i=0;$i<$num;$i++) { // Start looping
            
    $array mysql_fetch_array($result1);

            
    $articleid $array[0];
            
    $articlename $array[1];
            
    $summary $array[2];
            
    $date $array[6];
                    
            echo 
    $articleid;
            echo 
    $articlename;
            echo 
    $summary;
            echo 
    $date;
            echo 
    "<br />";
            }
            
        else{
            for(
    $i=0;$i<$num;$i++) { // Start looping
            
    $array mysql_fetch_array($result1);

            
    $articleid $array[0];
            
    $articlename $array[1];
            
    $summary $array[2];
            
    $date $array[6];
                    
            echo 
    $articleid;
            echo 
    $articlename;
            echo 
    $summary;
            echo 
    $date;
            echo 
    "<br />";
            }
            }
        
    mysql_free_result($sql);
        
        
    mysql_close($conn);
    ?>

  15. #40
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Try this out:
    PHP Code:
    <?php

    $status 
    $_POST["status"];


        
    $dbhost 'localhost';
        
    $dbuser 'roots';
        
    $dbpass '555456';
        
    $dbname 'site';
        
        
    $conn mysql_connect($dbhost$dbuser$dbpass) or die ('connecting to MySQL failed');
        
    mysql_select_db($dbname);

    $sql "SELECT * FROM articles";
    if(
    $status != "")
        
    $sql .= " WHERE Status = '".$status."'";

    $result1mysql_query($sql);
    $num mysql_num_rows($result1);

    echo 
    "Results for";
    if(
    $status == "")
        echo 
    "all articles.";
    if(
    $status == 1)
        echo 
    "active articles.";
    if(
    $status == 0)
        echo 
    "inactive articles.";
    while(
    $array mysql_fetch_assoc($result1))
    {
        echo 
    $array["ArticleID"]; // element coresponds to field name in db table, change accordingly
            
    echo $array["ArticleName"]; // element coresponds to field name in db table, change accordingly
            
    echo $array["Summarty"]; //element coresponds to field name in db table, change accordingly
            
    echo $array["Date"]; //element coresponds to field name in db table, change accordingly
            
    echo "<br />"
    }

        
    mysql_free_result($result1);
        
        
    mysql_close($conn);
    ?> 

    You don't need 3 for loops. It's ok to go with only one while loop.
    -- Jelena --

  16. #41
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hahahhahahaha
    you are killing me with 3 to 1

    by the way how did you make it to this level in php and mysql ?

    some advices please


    i still have this warning according to the php manual it should be fine using mysql_free_result() to free the memory i dont get it
    Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in E:\Practise\test1\listarticles.php on line 69

  17. #42
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    After you finish this small system, you'll realize this is just the beginning of php/mysql programming
    Seriously, there is much more then submitting forms/inserting records in db and fetching them. Although, you have chosen perfect system for start!

    Practice, practice, practice and you'll very easily accomplish good level of knowledge.

    Advice:
    1. learn to use PHP manual (that should be your best friend for learning)

    Quote Originally Posted by PHP Manual
    mysql_free_result() only needs to be called if you are concerned about how much memory is being used for queries that return large result sets. All associated result memory is automatically freed at the end of the script's execution.
    In other words, you don't need to call it.

    When you get at the point that you have too much articles, it will be time for per page
    -- Jelena --

  18. #43
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Taking about paging whats he princible of it where to start.
    if my guess is right the guery will be LIMIT. or may be its not the time for it
    there are othere things in the system first.

    thanks jelena for the advice

  19. #44
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I would suggest you to finish the system firstly, view/edit pages in admin section, and I could explain you my way of handling pagination, but yes, I use LIMIT in query.
    -- Jelena --

  20. #45
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok then am still thinking of the style to use for the admin

    my idea is
    when the admin click show all the article will be displayed
    see the attachment
    or better still just display the article name and the date and there are
    options to read, delete, edite and activate

    i would love to see your comment


    thanks
    Attached Images Attached Images
    Last edited by hisham777; Mar 29, 2006 at 04:06.

  21. #46
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    While waiting for attachment to get approved, I would say what I would do: on page which lists all articles, I would display only title, date, author and options to read/edit/delete. It's more cleaner that way.
    -- Jelena --

  22. #47
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thats what i mean
    ok then all get right into it

    thanks

  23. #48
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is this a right approch

    PHP Code:
     while($array mysql_fetch_assoc($result1))
     {
     
     
     echo 
    '<table width="720" border="1" cellpadding="0" cellspacing="0">
       <!--DWLayoutTable-->
       <tr>
         <td width="140" height="40" valign="top">Article Name: </td>
         <td width="460" valign="top">'
    .$array["article_name"].'</td>
         <td width="120" valign="top"><a href="Read.php?article_ID=' 
    $array["articleID"] . '">Read </a></td>
       </tr>
       <tr>
         <td height="40" valign="top">Date Posted: </td>
         <td valign="top">'
    .$array["date_added"] .'</td>
         <td valign="top"><a href="Edit.php?article_ID=' 
    $array["articleID"] . '">Edit </a></td>
       </tr>
       <tr>
         <td height="40" valign="top">Author: </td>
         <td valign="top">'
    .$array["author"] .'</td>
         <td valign="top"><a href="delete.php?article_ID=' 
    $array["articleID"] . '">Delete </a></td>
       </tr>
     </table>'


  24. #49
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    What about something like this:
    PHP Code:
    <table width="720" border="1" cellpadding="0" cellspacing="0">
    <tr>
        <td>Title</td>
        <td>Date</td>
        <td>Author</td>
        <td>Action</td>
    </tr>
    <?php
    while($array mysql_fetch_assoc($result1))
    {

        
    ?>
        <tr>
            <td><?php echo $array["article_name"];?></td>
            <td><?php echo $array["date_added"];?></td>
            <td><?php echo $array["article_author"];?></td>
            <td><a href="Read.php?article_ID=<?php echo $array["articleID"] ;?>">View</a> | 
            <a href="Edit.php?article_ID=<?php echo $array["articleID"] ;?>">Edit</a> | 
            <a href="delete.php.php?article_ID=<?php echo $array["articleID"] ;?>">Delete</a> 
            </td>
        </tr>
        <?php
    }
    ?>
    </table>
    -- Jelena --

  25. #50
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    You could of course just hire Jelena.......
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....


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
  •