Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7
  1. #1
    Junior Member
    Join Date
    Jun 2005
    Posts
    7
    Member #
    10402
    This is the basics! i am creating a site inwhere people are able
    to place ads. these ads are displayed for all to see in a displaying page. so through a form they fill in the data, this data goes to the database and because the displaying page queries the database, the content will immidiately be displayed! I need to have a sort of content management system here in where one of my database field is a hidden field in the form itself but visiable in my updating page, as a checkbox. so that i may check or uncheck this field which contains the data inserted into the table before it would be displayed.
    So thats it. its just that i don't know how to go about it! whether this query would go into the displaying page and or in the updating page or just in the form page! and what would be the query itself. I would deffinitely appreacite any step by step that you can provide!

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    WDF mucked up, would not let me post biggish posts so I have attached my reply.

  4. #3
    Junior Member
    Join Date
    Jun 2005
    Posts
    7
    Member #
    10402
    thanks

    thanks for the very indepth short tutorials you have
    provide for me truly i ahve search up and down to avail!
    truly i appreciate your aid!

  5. #4
    Junior Member
    Join Date
    Jun 2005
    Posts
    7
    Member #
    10402
    want to thank you againg for you help,
    the code works fine, but the things is that
    i have implemented your script to my script
    and now the page will not display!
    but what i really want is to have it work
    in the following matter:
    to display all content in database disregarding
    the ones that have the value of "0" to them.
    the name of the field which is a checkbox is "public"
    this field will act as the one who activates & deactivates
    the ads that i want or don't want to be displayed. how can
    i go about it? i think its through the ads ID#'s!!!???
    iwould like to thank you in advance for any help.
    here is my code:


    <?php require_once('Connections/comvenautos.php'); ?>
    <?php
    $currentPage = $_SERVER["PHP_SELF"];

    $maxRows_RScomvenautos = 100;
    $pageNum_RScomvenautos = 0;
    if (isset($_GET['pageNum_RScomvenautos'])) {
    $pageNum_RScomvenautos = $_GET['pageNum_RScomvenautos'];
    }
    $startRow_RScomvenautos = $pageNum_RScomvenautos * $maxRows_RScomvenautos;

    mysql_select_db($database_comvenautos, $comvenautos);
    $query_RScomvenautos = "SELECT * FROM comvenautos ";
    $query_limit_RScomvenautos = sprintf("%s LIMIT %d, %d", $query_RScomvenautos, $startRow_RScomvenautos, $maxRows_RScomvenautos);
    $RScomvenautos = mysql_query($query_limit_RScomvenautos, $comvenautos) or die(mysql_error());
    $row_RScomvenautos = mysql_fetch_assoc($RScomvenautos);
    $result = mysql_query($query_RScomvenautos);
    $row = mysql_fetch_array($result);

    if ($row['public'] == "1") {
    $row = mysql_fetch_array($result);
    } else {
    die(mysql_error());
    }
    if (isset($_GET['totalRows_RScomvenautos'])) {
    $totalRows_RScomvenautos = $_GET['totalRows_RScomvenautos'];
    } else {
    $all_RScomvenautos = mysql_query($query_RScomvenautos);
    $totalRows_RScomvenautos = mysql_num_rows($all_RScomvenautos);
    }
    $totalPages_RScomvenautos = ceil($totalRows_RScomvenautos/$maxRows_RScomvenautos)-1;

    $queryString_RScomvenautos = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
    $params = explode("&", $_SERVER['QUERY_STRING']);
    $newParams = array();
    foreach ($params as $param) {
    if (stristr($param, "pageNum_RScomvenautos") == false &&
    stristr($param, "totalRows_RScomvenautos") == false) {
    array_push($newParams, $param);
    }
    }
    if (count($newParams) != 0) {
    $queryString_RScomvenautos = "&" . htmlentities(implode("&", $newParams));
    }
    }

    $queryString_RScomvenautos = sprintf("&totalRows_RScomvenautos=%d%s", $totalRows_RScomvenautos, $queryString_RScomvenautos);
    ?>

  6. #5
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Okay. I will give you some example code that I use. Just to save you going through the code, I will give a brief description of what it does.

    1: It extracts all rows from a table named "code"
    2: In that table, it checks a column named "display" for a value of "yes"
    3: If that row's display value is yes then that row is displayed
    4: Else, it is not displayed

    [The only thing you should have to change is the table name, column names, and the value you are checking for (in this case 1)]

    Code:
    <?php
    include ("db.php"); // db connection code
    	$query = "SELECT * FROM code";
    	$result = mysql_query($query) or die("Query failed: ".mysql_error());
    	$numrows = mysql_num_rows($result);
    	if ($numrows == "0") {
    		echo "No rows returned.<br /><br />";}	
    	else {
    	while($row = mysql_fetch_array($result))
    	{
    		if ($row[display] == "yes") { // if this is row is set to be displayed then display it
    		echo $row[column_name];
                    echo $row[other_colum_names];
    	} // end if statement
            } // end while loop
            } // end else statement
    ?>
    If your stuck just ask.

  7. #6
    Junior Member
    Join Date
    Jun 2005
    Posts
    7
    Member #
    10402
    I would like to thank you for your help
    this was exactly what i need it!!!
    you were truelly detailed and most importantly
    objective in your tutorial.
    i truelly appreaciate it! cause i was looking and
    looking for over 3 weeks! againg thanks!

    Respectfully,

    James Vaughn de Minier

  8. #7
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Hey man thats what Im here for.

    Oh, heres your invoice :P


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 07:11 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com