Jump to content

jeliey

Learning
  • Content Count

    25
  • Joined

  • Last visited

Posts posted by jeliey


  1. need ur help :( Ada sapa2 x yg penah guna WPF? harap2 ada la yg boleh membantu... In my wpf, i have successfully saved the selected checkboxes in my database. But i got issue on how to display the checked checkboxes. Lets say there are 7 checkboxes in total, and user ticked 3 out of them. I was able to retrieve the Checkbox_id from database through webservice, but how to bind it to checkboxes? ni table yg aku save checkbox_id: User_ID : 1 Widget_ID : 1,2,3 It should only checked the selected id (1,2,3), but all i got is the whole checkboxes are checked. Please help me fix this...below is my code:

     

     xaml: xaml.cs: XDocument doc = XDocument.Parse(e.Result); 
    var query = from i in doc.Descendants("ResultTable") select i; foreach (XElement item in query) { 
    selectedWidget = item.Element("Widget_ID").Value; 
    } 
    
    for (Int32 i = LBWidget.Items.Count - 1; i >= 0; i--) { 
    
    ListBoxItem item = LBWidget.ItemContainerGenerator.ContainerFromIndex(i) as ListBoxItem;
    
    ContentPresenter myContentPresenter = FindVisualChild(item);
    
    DataTemplate dataTemplate = myContentPresenter.ContentTemplate;
    
    CheckBox chk = dataTemplate.FindName("chk", myContentPresenter) as CheckBox; 
    
    if (selectedWidget != null) { chk.IsChecked = true; } 
    
    }

  2. Code:
    <?php
       session_start();
       
       function isAdmin()
       {
          if($_SESSION['username']=='admin')
          {
             header('Location: view.php');
          }
          else
          {
             header('Location: view_user.php');
          }
       }
       
    // Connects to your Database
       mysql_connect("localhost", "root", "") or die(mysql_error());
       mysql_select_db("system") or die(mysql_error());

       //if the login form is submitted
       if (isset($_POST['submit']))
       { // if form has been submitted

          // makes sure they filled it in
          if(!$_POST['username'] | !$_POST['password'])
          {
             die('You did not fill in a required field.');
          }
          
          $check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error());

          //Gives error if user doesn't exist
          $check2 = mysql_num_rows($check);
          if ($check2 != 0)
          {
             $row = mysql_fetch_array($check);
             $_SESSION['userid'] = $row['userid'];
             
             $_SESSION['username']=$_POST['username'];
             isAdmin();
          }
          else
          {
             die('That user does not exist in our database. <a href=register.html>Click Here to Register</a>');
          }

          while($info = mysql_fetch_array( $check ))
          {
             $_POST['password'] = stripslashes($_POST['password']);
             $info['password'] = stripslashes($info['password']);
             $_POST['password'] = md5($_POST['password']);

             //gives error if the password is wrong
             if ($_POST['password'] != $info['password'])
             {
                die('Incorrect password, please try again.');
             }
             else
             {
                header("Location: view.php");
             }
          }
          
       }
       else
       {
          //if they are not log in
          ?>
          <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
             <table border="0">
                <tr>
                   <td colspan="2"><h1>Login</h1></td>            
                </tr>         
                <tr>
                   <td>Username:</td>
                   <td><input type="text" name="username"></td>            
                </tr>
                <tr>
                   <td>Password:</td>
                   <td><input type="password" name="password"></td>            
                </tr>
                <tr>
                   <td colspan="2" align="right"><input type="submit" name="submit" value="Login"></td>            
                </tr>
             </table>
          </form>
       <?php
       }
    ?>

  3. sama je error yg dapat...still tak leh insert userid...dapat error macam ni
    Code:

    Notice: Undefined index: userid in /opt/lampp/htdocs/system/submit.php on line 19
    INSERT INTO issues(title,catid,idesc,pid,idate,userid) VALUES ('issue',1,'Put your issue here',1,'2009-11-30',)ERROR:.Query was empty


    ni coding tuk submit.php...dah ubah sket kot,tambah session pun still xleh insert gak userid..tak paham toll
    Code:

    <?php
       session_start();

       if(isset($_POST['submit']))
       {
          //check form input for errors
          //check title
          if(trim($_POST['title'])=='')
          {
             die('ERROR:Please enter title');
          }
          
          //generate and execute query to insert question
          $title=$_POST['title'];
          $catid=$_POST['catid'];
          $pid=$_POST['pid'];
          $idesc=$_POST['idesc'];
          $idate=date("Y-m-d");
          $userid=$_SESSION['userid'];
          
          $connection=mysql_connect("localhost","root","")or die('ERROR:Unable to connect!');
          mysql_select_db("system",$connection)or die('ERROR:Unable to select database!');
          $sql = "INSERT INTO issues(title,catid,idesc,pid,idate,userid) VALUES ('".$title."',".$catid.",'".$idesc."',".$pid.",'".$idate."',".$userid.")";
          echo $sql;
          $query=mysql_query($sql);
          
          $result=mysql_query($query)or die("ERROR:$query.".mysql_error());
          
          
          mysql_close($connection);
          
          //print success message
          echo "Issues successfully added to the database! Click <a href='view.php'>here</a> to view the posted issues";
       }
       else
       {
          die('ERROR:Data not correctly submitted');
       }
    ?>

  4. Aku dah ubah sket table issues,tambah userid coz nk display sape yg post issue
    pastu,sume values dlm table issues tu,aku masukkan manual dlm database,saje nk test...
    tp kalu insert mmg xmasuk la

    Code:

    -- phpMyAdmin SQL Dump
    -- version 2.9.1.1
    -- http://www.phpmyadmin.net
    --
    -- Host: localhost
    -- Generation Time: Nov 24, 2009 at 09:19 PM
    -- Server version: 5.0.45
    -- PHP Version: 5.2.9
    --
    -- Database: `system`
    --

    -- --------------------------------------------------------

    --
    -- Table structure for table `category`
    --

    CREATE TABLE `category` (
      `catid` int(11) NOT NULL auto_increment,
      `catname` varchar(255) NOT NULL,
      `catdesc` varchar(255) NOT NULL,
      PRIMARY KEY  (`catid`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

    --
    -- Dumping data for table `category`
    --

    INSERT INTO `category` (`catid`, `catname`, `catdesc`) VALUES
    (1, 'PHP', 'Related to PHP'),
    (2, '.NET', 'Related to .NET'),
    (3, 'Java', 'Related to Java');

    -- --------------------------------------------------------

    --
    -- Table structure for table `issues`
    --

    CREATE TABLE `issues` (
      `id` int(11) NOT NULL auto_increment,
      `title` varchar(255) NOT NULL,
      `catid` int(11) NOT NULL,
      `desc` varchar(255) NOT NULL,
      `pid` int(11) NOT NULL,
      `date` date NOT NULL default '0000-00-00',
      `userid` int(11) NOT NULL,
      PRIMARY KEY  (`id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

    --
    -- Dumping data for table `issues`
    --

    INSERT INTO `issues` (`id`, `title`, `catid`, `desc`, `pid`, `date`, `userid`) VALUES
    (2, 'Foreign Key', 1, 'How to create foreign key in MySQL database?', 3, '2009-11-17', 1),
    (3, 'Online Shopping System', 1, 'Is it possible to drag the items into cart? it means that, users don''t have to click', 2, '2009-11-24', 1);

    -- --------------------------------------------------------

    --
    -- Table structure for table `priority`
    --

    CREATE TABLE `priority` (
      `pid` int(11) NOT NULL auto_increment,
      `pname` varchar(255) NOT NULL,
      PRIMARY KEY  (`pid`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

    --
    -- Dumping data for table `priority`
    --

    INSERT INTO `priority` (`pid`, `pname`) VALUES
    (1, 'Normal'),
    (2, 'Important'),
    (3, 'Urgent');

    -- --------------------------------------------------------

    --
    -- Table structure for table `users`
    --

    CREATE TABLE `users` (
      `userid` int(11) NOT NULL auto_increment,
      `username` varchar(255) NOT NULL,
      `email` varchar(255) NOT NULL,
      `password` varchar(255) NOT NULL,
      PRIMARY KEY  (`userid`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

    --
    -- Dumping data for table `users`
    --

    INSERT INTO `users` (`userid`, `username`, `email`, `password`) VALUES
    (1, ' liana ', ' [email protected] ', ' liana ');

    --
    -- Constraints for dumped tables
    --

    --
    -- Constraints for table `issues`
    --
    ALTER TABLE `issues`
      ADD CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`id`) REFERENCES `category` (`catid`) ON DELETE CASCADE;

  5. neorology, xdapat la...error sama jgk

    ni table:

    Code:

    $sql="CREATE TABLE category
       (
          catid int(11) NOT NULL auto_increment PRIMARY KEY,
          catname varchar(255) NOT NULL,
          catdesc varchar(255) NOT NULL
       )
       engine='innodb'";
       
    $sql="CREATE TABLE issues
          (
          id int(11) NOT NULL auto_increment PRIMARY KEY,
          title varchar(255) NOT NULL,
                    catid int(11) NOT NULL,
          desc varchar(255) NOT NULL,
                    pid int(11) NOT NULL,
          date date NOT NULL
       )
       engine='innodb'";

    $sql="CREATE TABLE priority
       (
          pid int(11) NOT NULL auto_increment PRIMARY KEY,
          pname varchar(255) NOT NULL
       )
       engine='innodb'";   

  6. skarang ni nk insert value dlm table issues(id,title,catid,desc,pid,date)

    pid dan catid tu foreign key...

    pid is PK for priority table and catid is PK for category table

    yang bawah ni form utk user input data
    Code:

    <h3>New Post</h3>
    <form action='submit.php' method='POST'>
       <table>
          <tr>
             <td>Title</td><td>:</td><td><input type='text' name='title'></td>            
          </tr>
          <tr>      
             <td>Category</td><td>:</td><td>
                <?php
                
                   mysql_connect("localhost","root","") or die (mysql_error());
                   mysql_select_db("system") or die (mysql_error());
       
                   $query="SELECT catid,catname FROM category";
                   $result=mysql_query ($query);
                   echo "<select name='catid'>";
                   
                   while ($nt=mysql_fetch_array($result))
                   {
                      echo "<option value=$nt[catid]>$nt[catname]</option>";
                   }
                   echo "</select>";
                ?>               
             </td>            
          </tr>
          <tr>
             <td>Priority</td><td>:</td><td>
                <?php
                
                   mysql_connect("localhost","root","") or die (mysql_error());
                   mysql_select_db("system") or die (mysql_error());
                   
                   $query="SELECT pid,pname FROM priority";
                   $result=mysql_query($query);
                   echo "<select name='pid'>";
                   
                   while ($nt=mysql_fetch_array($result))
                   {
                      echo "<option value=$nt[pid]>$nt[pname]</option>";
                   }
                   echo "</select>";
                ?>
             </td>      
          </tr>
          <tr>
             <td>Description</td><td>:</td>
                <tr><td><td></td></td><td><textarea name='desc' rows='15' cols='50'></textarea></td></tr>            
          </tr>
          <tr>
             <td><td></td></td><td align='right'><input type='submit' name='submit' value='Post Issue'></td>                       
          </tr>
       </table>
    </form>


    tp bila user click post kuar error yg macam atas tu

  7. Ada tak sesapa yg leh tolong...

    ERROR:INSERT INTO issues (title,catid,pid,desc,date) VALUES ('Online Selling System','1','2','How to create cart?',NOW()).You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc,date) VALUES ('Online Selling System','1','2','How to create cart?',NOW())' at line 1

    aku dapat error macam kat atas tu...ni coding aku...dah tak larat daa

    Code:

    <?php

       if(isset($_POST['submit']))
       {
          //check form input for errors
          //check title
          if(trim($_POST['title'])=='')
          {
             die('ERROR:Please enter title');
          }
          
          mysql_connect("localhost","root","") or die (mysql_error());
          mysql_select_db("system") or die (mysql_error());
          
          //generate and execute query to insert question
          $query="INSERT INTO issues (title,catid,pid,desc,date) VALUES ('{$_POST['title']}','{$_POST['catid']}','{$_POST['pid']}','{$_POST['desc']}',NOW())";
          $result=mysql_query($query)or die("ERROR:$query.".mysql_error());
          
          //print success message
          echo "Issues successfully added to the database! Click <a href='view.php>here</a> to view page";
       }
       else
       {
          die('ERROR:Data not correctly submitted');
       }
    ?>
    ::icon_redface::

  8. Please guys, help me solving dis prob...when run the proj,got the error: Must declare the scalar variable "@email"...so frustrating...here goes my code

    <table border="0" width="750">
    <tr>
    <td valign="top" style="width: 369px">
    <asp:GridView ID="GridView1" runat="server" AllowPaging="true" AutoGenerateColumns="false" DataKeyNames="CartID" DataSourceID="SqlDataSource1" Width="370px" ForeColor="Black">
    <Columns>
    <asp:BoundField DataField="email" HeaderText="Email" ><HeaderStyle HorizontalAlign="Left" /></asp:BoundField>
    <asp:BoundField DataField="firstname" HeaderText="First Name" SortExpression="firstname" ><HeaderStyle HorizontalAlign="Left" /></asp:BoundField>
    <asp:BoundField DataField ="lastname" HeaderText="Last Name"><HeaderStyle HorizontalAlign ="Left" /></asp:BoundField>
    <asp:CommandField ShowSelectButton="True" ><ItemStyle Width="50px" /></asp:CommandField>
    </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
    SelectCommand="SELECT [Cart.CartID],[Cart.ProdID],[Cart.email],[Cart.ProdName],[Cart.ProdPrice],[Cart.Quantity],[Cart.Total]
    FROM [Cart] INNER JOIN [Customers] ON (Customers.email=@email)">
    </asp:SqlDataSource>
    </td>
    <td valign="top">
    <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1" DataKeyNames="CartID" Width="373px">
    <EmptyDataTemplate >
    Please select a customer<br /><br />
    </EmptyDataTemplate>
    <ItemTemplate >
    <asp:Label ID="Label1" runat="server" Text="Cart ID:" Width="100px"></asp:Label>
    <asp:TextBox ID="txtCartID" runat="server" ReadOnly="True" Width="200px" Text='<%# Eval("CartID") %>' ></asp:TextBox>

    <asp:Label ID="Label2" runat="server" Text="Product ID:" Width="100px"></asp:Label>
    <asp:TextBox ID="txtProdID" runat="server" ReadOnly="True" Width="200px" Text='<%# Eval ("ProdID") %>'></asp:TextBox>

    <asp:Label ID="Label3" runat="server" Text="Product Name:" Width="100px"></asp:Label>
    <asp:TextBox ID="txtProdName" runat="server" ReadOnly="true" Width="200px" Text='<%# Eval("ProdName") %>'></asp:TextBox>

    <asp:Label ID="Label4" runat="server" Text="Product Price:" Width="100px"></asp:Label>
    <asp:TextBox ID="txtProdPrice" runat="server" ReadOnly="true" Width="200px" Text='<%# Eval ("ProdPrice","{0:C}") %>'></asp:TextBox>

    <asp:Label ID="Label5" runat="server" Text="Quantity:" Width="100px"></asp:Label>
    <asp:TextBox ID="txtQuantity" runat="server" ReadOnly="true" Width="200px" Text='<%# Eval("Quantity") %>'></asp:TextBox>

    <asp:Label ID="Label6" runat="server" Text="Total:" Width="100px"></asp:Label>
    <asp:TextBox ID="txtTotal" runat="server" ReadOnly="true" Width="200px" Text='<%# Eval("Total","{0:C}") %>'></asp:TextBox>

    </ItemTemplate>
    </asp:FormView>
    &nbsp;
    </td>
    </tr>
    </table>

  9. kenapa image tak kuar?Ada sesapa leh tolong?ke tak leh wat image button dalam DataList?

    <asp:Content ID="Content1" runat="Server" ContentPlaceHolderID="ContentPlaceHolder1" >
    <br />
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
    SelectCommand="SELECT [ProdID], [ProdName],[ProdDesc],[ProdPrice], [ProdThumbnail],[ProdUrl] FROM [Products]">
    </asp:SqlDataSource>

    <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1" RepeatColumns="4"
    RepeatDirection="Horizontal">
    <ItemTemplate>
    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='<%# Eval("ProdUrl", "Images\\thumb_{0}") %>' PostBackUrl='<%# Eval("ProdID", "ProductDetails.aspx?ProdID={0}") %>' /><br />
    <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("ProdName") %>'></asp:Label><br />
    <asp:Label ID="PriceLabel" runat="server" Text='<%# Eval("ProdPrice", "{0:C}") %>'></asp:Label><br />
    <br />
    <br />
    </ItemTemplate>
    </asp:DataList><br />
    <asp:HyperLink ID="CartLink" runat="server" NavigateUrl="~/Cart.aspx">View Shopping Cart</asp:HyperLink><br />
    </asp:Content>

  10. Ape problem ni?aku rasa cam dah btol je...tp ada error:use of unassigned local variable'grading' yg aku bold kan ni...ada sesapa leh tlg x?aku tau dis is so simple, tp aku mmg dh blank sgt2 ni...



    using System;
    using System.Collections.Generic;
    using System.Text;

    namespace MarkGrade
    {
    class MarkGrade
    {
    static void Main(string[] args)
    {
    string mark,grading;

    Console.Write("Please enter your mark:");
    mark=Console.ReadLine();
    //double d = Convert.ToDouble(mark);


    switch (mark)
    {
    case "mark >= 80 && mark <= 100":
    grading="Distinction";
    break;

    case "mark >= 70 && mark < 80":
    grading = "Very Good";
    break;

    case "mark >= 60 && mark< 70":
    grading = "Good";
    break;

    case "mark >= 50&& mark < 60":
    grading = "OK";
    break;

    case "mark >= 40 && mark < 50":
    grading = "Average";
    break;

    case "mark<40":
    grading = "Poor";
    break;
    }
    Console.WriteLine();
    Console.WriteLine(grading);
    Console .ReadLine ();
    }
    }
    }

  11. ::icon_cry:: helo everyone...

    since i'm new in vb.net
    can anyone help me in this problem

    how to display details of the data from DataGridView into textboxes.
    in my DataGridView, there's only have the cust_id and cust_name. when the user select any row of the DataGridView, and click the button 'Show Details' then all the info of that customer will be displayed in the textboxes...

    hope quick answer....tq

  12. 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....

  13. 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>

  14. 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 ::icon_sad::

  15. sy baru je join forum ni... ::icon_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

    ::icon_cry::

    help me...tq
×
×
  • Create New...