Forum Sementara Putera.com

Would you like to react to this message? Create an account in a few clicks or log in to continue.
Forum Sementara Putera.com

Bersama kita perkemaskan forum ini sementara forum asal dalam pemulihan.

Forum putera dah kembali. Masalah sudah berjaya diselesaikan. Sila lawati http://forum.putera.com/tanya


4 posters

    system problem

    avatar
    jeliey
    Ahli Baharu
    Ahli Baharu


    Number of posts : 26
    Registration date : 01/04/2009

    system problem Empty system problem

    Post by jeliey Wed Apr 01, 2009 9:52 pm

    sy baru je join forum ni... Razz
    sy ada problem ngn system (PHP) yg sy ngah develop skang ni...harap boleh tolong

    system sy ni online book selling,dlm database ada table 'book'...and then dalam table tu ada field 'status'.
    problem skang ni, sy nak buat bila seller add new book, then automatically field status tu jadi 'On Sale'.
    pastu bila buyer beli buku tu, automatically field status tu bertukar 'Reserve'.

    tp sy tak tau macam mana nak buat table dlm database tu update status tu automatically, xpayah admin or seller tu fill in manually

    Crying or Very sad

    help me...tq
    avatar
    Farlee
    Ahli Baharu
    Ahli Baharu


    Gender : Male Number of posts : 38
    Age : 40
    Location : Kuala Lumpur, Kuala Terengganu (Malaysia)
    Job/hobbies : Looking at Computer
    Registration date : 16/03/2009

    system problem Empty Re: system problem

    Post by Farlee Thu Apr 02, 2009 11:38 am

    Ha... slamat dtg ke forum Putera.com Very Happy

    Anyway, awk boleh bagikan maklumat teliti pasal database (nama database, table, & column) dan coding yang anda usahakan itu, supaya dapatlah kami mengkaji masalah projek sistem awk ini.

    Semoga dengan masalah awk dapatlah kami selesaikan dengan jayanya Smile
    Kuzie
    Kuzie
    Ahli Baharu
    Ahli Baharu


    Gender : Male Number of posts : 125
    Age : 40
    Location : eVeRyWhErE
    Registration date : 13/02/2009

    system problem Empty Re: system problem

    Post by Kuzie Thu Apr 02, 2009 10:10 pm

    jeliey wrote:sy nak buat bila seller add new book, then automatically field status tu jadi 'On Sale'.

    tang ni aku xfaham...kata user xinput..tapi seller add new book tu camne..???ke seller tu curik2 masuk sistem...(gurau jek jgn marrah nooo...)
    avatar
    Farlee
    Ahli Baharu
    Ahli Baharu


    Gender : Male Number of posts : 38
    Age : 40
    Location : Kuala Lumpur, Kuala Terengganu (Malaysia)
    Job/hobbies : Looking at Computer
    Registration date : 16/03/2009

    system problem Empty Re: system problem

    Post by Farlee Fri Apr 03, 2009 11:54 am

    Sistem ini untuk para "seller" (penjual) sajo la lol! Tgk molek sket! Napa ni kei! Laughing
    Kuzie
    Kuzie
    Ahli Baharu
    Ahli Baharu


    Gender : Male Number of posts : 125
    Age : 40
    Location : eVeRyWhErE
    Registration date : 13/02/2009

    system problem Empty Re: system problem

    Post by Kuzie Fri Apr 03, 2009 11:56 am

    dah tu sape yg add new book??bukan ke seller ke...???
    avatar
    Farlee
    Ahli Baharu
    Ahli Baharu


    Gender : Male Number of posts : 38
    Age : 40
    Location : Kuala Lumpur, Kuala Terengganu (Malaysia)
    Job/hobbies : Looking at Computer
    Registration date : 16/03/2009

    system problem Empty Re: system problem

    Post by Farlee Fri Apr 03, 2009 12:04 pm

    Boleh set mana satu "super admin", yg lagi satu "admin" iaitu seller sniri (mcm "member of system" la, katakan). Ada certain part dlm sistem yg seller x bleh sentuh mcm admin sebenar. So kemungkinan "super admin" tu ialah 'developer' Exclamation

    Btul x, jeliey? (Arap2 cepat responnya!!) Very Happy
    avatar
    jeliey
    Ahli Baharu
    Ahli Baharu


    Number of posts : 26
    Registration date : 01/04/2009

    system problem Empty Re: system problem

    Post by jeliey Fri Apr 03, 2009 6:27 pm

    ha...btol la tu...

    em..mcm mana prob sy bleh d selesaikan x?
    avatar
    jeliey
    Ahli Baharu
    Ahli Baharu


    Number of posts : 26
    Registration date : 01/04/2009

    system problem Empty Re: system problem

    Post by jeliey Fri Apr 03, 2009 6:33 pm

    to kuzie...
    seller log in cam biasa la
    die bley add new books dlm system tu for sale...
    bila die add book tu, table book dlm dtbase tu ada 1 field nama nye status...bila seller add new books,otomatic field tu terupdate sendiri jadi on sale...

    em...faham ke tak ni??hehe...aku plak yg pening Sad
    Kuzie
    Kuzie
    Ahli Baharu
    Ahli Baharu


    Gender : Male Number of posts : 125
    Age : 40
    Location : eVeRyWhErE
    Registration date : 13/02/2009

    system problem Empty Re: system problem

    Post by Kuzie Sat Apr 04, 2009 2:44 am

    faham2...

    1)bagi semua field dalam database tu dan nama database tu(untuk wat demo database)
    2)bagi coding form yg berkaitan dari seller addnewbook sampai die leh jadi otomatik

    nnti kiteorang tengok putera.com tengok mana leh alter...copy paste je kat sini...
    avatar
    jeliey
    Ahli Baharu
    Ahli Baharu


    Number of posts : 26
    Registration date : 01/04/2009

    system problem Empty Re: system problem

    Post by jeliey Sun Apr 05, 2009 7:42 pm

    CREATE TABLE `book` (
    `ISBN_num` varchar(50) NOT NULL default '',
    `title` varchar(50) NOT NULL default '',
    `categories` varchar(30) NOT NULL default '',
    `book_author` varchar(50) NOT NULL default '',
    `original_price` float NOT NULL default '0',
    `sell_price` double NOT NULL default '0',
    `start_date` date NOT NULL default '0000-00-00',
    `seller_id` varchar(50) NOT NULL default '',
    `buyer_id` varchar(50) NOT NULL default '',
    `book_id` int(100) NOT NULL auto_increment,
    `status` varchar(50) NOT NULL default '',
    PRIMARY KEY (`book_id`)
    )

    CREATE TABLE `seller` (
    `seller_id` varchar(50) NOT NULL default '',
    `password` varchar(50) NOT NULL default '',
    `name` varchar(50) NOT NULL default '',
    `email` varchar(50) NOT NULL default '',
    `phone_num` varchar(12) NOT NULL default '',
    `address` text NOT NULL,
    PRIMARY KEY (`seller_id`)
    )


    addbooks.php


    <?php
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
    break;
    }
    return $theValue;
    }

    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
    $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    }

    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
    $insertSQL = sprintf("INSERT INTO book (ISBN_num, title, categories, book_author, original_price, sell_price, start_date, seller_id) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
    GetSQLValueString($_POST['ISBN_num'], "text"),
    GetSQLValueString($_POST['title'], "text"),
    GetSQLValueString($_POST['categories'], "text"),
    GetSQLValueString($_POST['book_author'], "text"),
    GetSQLValueString($_POST['original_price'], "double"),
    GetSQLValueString($_POST['sell_price'], "double"),
    GetSQLValueString($_POST['start_date'], "date"),
    GetSQLValueString($_POST['seller_id'], "text"));

    mysql_select_db($database_system, $system);
    $Result1 = mysql_query($insertSQL, $system) or die(mysql_error());

    $insertGoTo = "viewbooks_seller.php";
    if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
    }
    header(sprintf("Location: %s", $insertGoTo));
    }

    $colname_Recordset1 = "-1";
    if (isset($_SESSION['MM_Username'])) {
    $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
    }
    mysql_select_db($database_system, $system);
    $query_Recordset1 = sprintf("SELECT seller_id, name FROM seller WHERE seller_id = '%s'", $colname_Recordset1);
    $Recordset1 = mysql_query($query_Recordset1, $system) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);

    mysql_select_db($database_system, $system);
    $query_Recordset2 = "SELECT * FROM book";
    $Recordset2 = mysql_query($query_Recordset2, $system) or die(mysql_error());
    $row_Recordset2 = mysql_fetch_assoc($Recordset2);
    $totalRows_Recordset2 = mysql_num_rows($Recordset2);

    <form action="<?php echo $editFormAction; ?>" name="form2" id="form1" method="POST">
    <table width="489" border="1">
    <tr>
    <td><strong>Seller Name </strong></td>
    <td><input name="seller_id" type="hidden" id="seller_id" value="<?php echo $row_Recordset1['seller_id']; ?>" />
    <?php echo $row_Recordset1['name']; ?></td>
    </tr>
    <tr>
    <td width="122"><strong>ISBN*</strong></td>
    <td width="351"><input name="ISBN_num" type="text" id="ISBN_num" size="50" /></td>
    </tr>
    <tr>
    <td><strong>Title*</strong></td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td><strong>Category*</strong></td>
    <td><label>
    <select name="categories" id="categories">
    <option value="Accounting" selected="selected">Accounting</option>
    <option value="Business">Business</option>
    <option value="Computer &amp; IT">Computer &amp; IT</option>
    <option value="Engineering">Engineering</option>
    </select>
    <input name="title" type="text" id="title" size="50" />
    </label></td>
    </tr>
    <tr>
    <td><strong>Book Author* </strong></td>
    <td><label>
    <input name="book_author" type="text" id="book_author" />
    </label></td>
    </tr>
    <tr>
    <td><strong>Original Price* </strong></td>
    <td>RM
    <input name="original_price" type="text" id="original_price" /></td>
    </tr>
    <tr>
    <td><strong>Sell Price* </strong></td>
    <td>RM
    <input name="sell_price" type="text" id="sell_price" /></td>
    </tr>
    <tr>
    <td><strong>Post date </strong></td>
    <td><p>
    <input name="start_date" type="hidden" id="start_date" value=" <?php $b=time(); print date("Y-m-d",$b);?>" />
    <?php
    $b = time ();
    print date("Y-m-d",$b) . "<br>";

    ?></p> </td>
    </tr>
    </table>
    <p>&nbsp;</p>
    <p>
    <input type="submit" name="Submit" value="Submit" />
    <input type="reset" name="Submit2" value="Reset" />
    </p>


    <input type="hidden" name="MM_insert" value="form2">
    </form>


    viewbooks_seller.php

    <?php require_once('Connections/system.php'); ?>
    <?php
    $colname_Recordset2 = "-1";
    if (isset($_POST['categories'])) {
    $colname_Recordset2 = (get_magic_quotes_gpc()) ? $_POST['categories'] : addslashes($_POST['categories']);
    }
    mysql_select_db($database_system, $system);
    $query_Recordset2 = sprintf("SELECT * FROM book WHERE categories = '%s'", $colname_Recordset2);
    $Recordset2 = mysql_query($query_Recordset2, $system) or die(mysql_error());
    $row_Recordset2 = mysql_fetch_assoc($Recordset2);
    $totalRows_Recordset2 = mysql_num_rows($Recordset2);


    <table width="447" border="1">
    <tr>
    <td width="22" height="18"><div align="center"><strong>No.</strong></div></td>
    <td width="143"><div align="center"><strong>Book ID </strong></div></td>
    <td width="119"><div align="center"><strong>Title</strong></div></td>
    <td width="135"><div align="center"><strong>Status</strong></div></td>
    </tr>
    <?php $count=0 ?>
    <?php do { ?>
    <tr>
    <td><div align="center">
    <?php $count=$count+1; echo $count; ?>
    </div></td>
    <td><div align="center"><?php echo $row_Recordset2['book_id']; ?></div></td>
    <td><div align="center"><a href="bookinfo.php?book_id=<?php echo $row_Recordset2['book_id']; ?>"><?php echo $row_Recordset2['title']; ?></a></div></td>
    <td><div align="center"><?php echo $row_Recordset2['status']; ?></div></td>
    </tr>
    <?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?>
    </table>
    Kuzie
    Kuzie
    Ahli Baharu
    Ahli Baharu


    Gender : Male Number of posts : 125
    Age : 40
    Location : eVeRyWhErE
    Registration date : 13/02/2009

    system problem Empty Re: system problem

    Post by Kuzie Tue Apr 07, 2009 9:42 am

    sorry dah 3 hari xjmpe internet..hehehe....ko bagi sikit record die bro...sbb aku tengok nak add buku ni die punye seller macam guna session jek...ikut id login kan....
    avatar
    jeliey
    Ahli Baharu
    Ahli Baharu


    Number of posts : 26
    Registration date : 01/04/2009

    system problem Empty Re: system problem

    Post by jeliey Sat May 09, 2009 1:11 pm

    ai everyone...
    sorry gell lama dah tak join forum ni...
    emmm...
    kalu sesape leh tlg,nk tny tau x cmne nak update status bila times up?
    kiranya admin dah set kan 3 hari,bila dah lebih 3 hari otomatic status dlm table tukar...

    hopefully quick answer....
    Kuzie
    Kuzie
    Ahli Baharu
    Ahli Baharu


    Gender : Male Number of posts : 125
    Age : 40
    Location : eVeRyWhErE
    Registration date : 13/02/2009

    system problem Empty Re: system problem

    Post by Kuzie Tue May 12, 2009 11:58 am

    Buat guna "schedule task" ... Autorunning every day. Pastu kena wat script bila running, script akan update table mana...
    avatar
    SHiDi
    Ahli Baharu
    Ahli Baharu


    Gender : Male Number of posts : 30
    Age : 40
    Location : Ampang
    Job/hobbies : Geek
    Registration date : 03/03/2009

    system problem Empty Re: system problem

    Post by SHiDi Thu May 14, 2009 6:33 pm

    jeliey wrote:ai everyone...
    sorry gell lama dah tak join forum ni...
    emmm...
    kalu sesape leh tlg,nk tny tau x cmne nak update status bila times up?
    kiranya admin dah set kan 3 hari,bila dah lebih 3 hari otomatic status dlm table tukar...

    hopefully quick answer....

    Hosting apa? Unix ke? Kalau Unix / Linux, belajar pasal Cron job.

    Sponsored content


    system problem Empty Re: system problem

    Post by Sponsored content


      Current date/time is Mon Nov 18, 2024 8:16 am