Jump to content

Jragon

Members
  • Posts

    148
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Jragon

  1. <form action="" method="POST">
    Product name: <input type="text" name="product" />
    Catagory: <select name="cat">
    <?php 
    $query = "SELECT id, catagory FROM `catagorys`";
    $result = mysql_query($query) or die(mysql_error());
    
    while($row = mysql_fetch_row($result)){
    echo "<option value=\"$row[0]\">$row[1]</option>";
    }
    ?>
    </select><br />
    At stores:
    <?php
    $query = "SELECT id,short FROM `stores`";
    $result = mysql_query($query) or die(mysql_error());
    while($row = mysql_fetch_row($result)){
    echo "<input type=\"checkbox\" name=\"store\" value=\"$row[0]\" />$row[1]<br />";
    }
    ?>
    Price:<input type="text" name="price" />
    
    <input type="submit" value="Submit" />
    
    </form>
    <?php
    
    $query = 'SELECT products.product, catagorys.catagory, price.price, stores.short, price.pid, products.id
    FROM  `products` 
    JOIN  `catagorys` ON products.cid = catagorys.id
    JOIN  `price` ON price.pid = products.id
    JOIN  `stores` ON price.sid = stores.id;';
    $result = mysql_query($query) or die(mysql_error());
    $rows = mysql_num_rows($result) or die(mysql_error());
    $ppid = "";
    while($row = mysql_fetch_row($result)){
    if($ppid != $row[4]){
    	$ppid = $row[4];
    	echo <<<_ENDHTML
    Product: $row[0] <br />
    Catagory: $row[1]<br />
    _ENDHTML;
    	$query = "SELECT price.price, stores.short, price.pid, products.id
    	FROM  `products` 
    	JOIN  `price` ON price.pid = products.id
    	JOIN  `stores` ON price.sid = stores.id
    	WHERE products.id =  '$row[5]'";
    	$result = mysql_query($query) or die(mysql_error());
    	while($row = mysql_fetch_array($result)){
    		echo "$$row[0] at $row[1]<br />";
    	}	
    	echo <<<_ENDHTML
    
    <form action="" method="post">
    <input type="hidden" name="delete" value="yes" />
    <input type="hidden" name="product" value="$row[0]" />
    <input type="hidden" name="price" value="$row[2]" />
    <input type="hidden" name="store" value="$row[3]" />
    <input type="hidden" name="cat" value="$row[1]" />
    <input type="hidden" name="pid" value="$row[4]" />
    <input type="submit" value="DELETE RECORD" /></form>
    </form>
    _ENDHTML;
    }elseif($ppid == $row[4]){
    	echo "<br />$row[2] at $row[3]";
    }
    }
    

     

    From line 28

  2. Awesome! Thanks guys! That's the display problems fixed. But now, I can't seem to insert stuff :S

     

    
    <?php
    require_once('connect.php');
    include('functions.php');
    if(isset($_POST['product']) && isset($_POST['cat']) && isset($_POST['store']) && isset($_POST['price'])){
    $product = escape('product');
    $cat = escape('cat');
    $store = escape('store');
    $price = escape('price');
    
    
    if (isset($_POST['delete']) && $product != ""){
    	$pid = escape('pid');
    	$query = "DELETE FROM `products` where product='$product'
    			  DELETE FROM `prices` when pid='$pid'";
    	mysql_query($query) or die(mysql_error());
    }else{
    	$query = "INSERT INTO `product` VALUES(null, '$cat', '$product')";
    	mysql_query($query);
    	$query = "SELECT id FROM products WHERE product='$product'";
    	$result = mysql_query($query) or die(mysql_error());
    	$row = mysql_fetch_array($result);
    	$pid = $row[0];
    	$query = "INSERT INTO `price` VALUES('$pid', '$store', '$price')";			
    }
    mysql_query($query);
    }
    ?>
    <form action="" method="POST">
    Product name: <input type="text" name="product" />
    Catagory: <select name="cat">
    <?php 
    $query = "SELECT id, catagory FROM `catagorys`";
    $result = mysql_query($query) or die(mysql_error());
    
    while($row = mysql_fetch_row($result)){
    echo "<option value=\"$row[0]\">$row[1]</option>";
    }
    ?>
    </select><br />
    At stores:
    <?php
    $query = "SELECT id,short FROM `stores`";
    $result = mysql_query($query) or die(mysql_error());
    while($row = mysql_fetch_row($result)){
    echo "<input type=\"checkbox\" name=\"store\" value=\"$row[0]\" />$row[1]<br />";
    }
    ?>
    Price:<input type="text" name="price" />
    
    <input type="submit" value="Submit" />
    
    </form>
    <?php
    
    $query = 'SELECT products.product, catagorys.catagory, price.price, stores.short, price.pid, products.id
    FROM  `products` 
    JOIN  `catagorys` ON products.cid = catagorys.id
    JOIN  `price` ON price.pid = products.id
    JOIN  `stores` ON price.sid = stores.id;';
    $result = mysql_query($query) or die(mysql_error());
    $rows = mysql_num_rows($result) or die(mysql_error());
    $ppid = "";
    while($row = mysql_fetch_row($result)){
    if($ppid != $row[4]){
    	$ppid = $row[4];
    	echo <<<_ENDHTML
    Product: $row[0] <br />
    Catagory: $row[1]<br />
    _ENDHTML;
    	$query = "SELECT price.price, stores.short, price.pid, products.id
    	FROM  `products` 
    	JOIN  `price` ON price.pid = products.id
    	JOIN  `stores` ON price.sid = stores.id
    	WHERE products.id =  '$row[5]'";
    	$result = mysql_query($query) or die(mysql_error());
    	while($row = mysql_fetch_array($result)){
    		echo "$$row[0] at $row[1]<br />";
    	}	
    	echo <<<_ENDHTML
    
    <form action="" method="post">
    <input type="hidden" name="delete" value="yes" />
    <input type="hidden" name="product" value="$row[0]" />
    <input type="hidden" name="price" value="$row[2]" />
    <input type="hidden" name="store" value="$row[3]" />
    <input type="hidden" name="cat" value="$row[1]" />
    <input type="hidden" name="pid" value="$row[4]" />
    <input type="submit" value="DELETE RECORD" /></form>
    </form>
    _ENDHTML;
    }elseif($ppid == $row[4]){
    	echo "<br />$row[2] at $row[3]";
    }
    }
    
    ?>
    

     

    I have no idea what I've done wrong.

  3. Hi!

     

    When I execute my code, I get:

    1iPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at HTCiPhone 4 at 

     

    Over and over again

     

    What I need it to be like:

    Product: iPhone 4 
    Catagory: HTC
    400$ at store 1
    412$ aat store 2
    ect.
    [button]DELTE RECORD
    

     

    Here is my php code:

    <?php
    require_once('connect.php');
    include('functions.php');
    if(isset($_POST['product']) && isset($_POST['cat']) && isset($_POST['store']) && isset($_POST['price'])){
    $product = escape('product');
    $cat = escape('cat');
    $store = escape('store');
    $price = escape('price');
    $pid = escape('pid');
    
    if (isset($_POST['delete']) && $product != "" && $pid != ""){
    	$query = "DELETE FROM `products` where product='$product'
    			  DELETE FROM `prices` when pid='$pid'";
    	mysql_query($query) or die(mysql_error());
    }else{
    	$query = "INSERT INTO `product` VALUES(null, '$cat', '$prouct')";
    	mysql_query($query);
    	$query = "SELECT id FROM product WHERE catagory='$cat' product='$product'";
    	while(mysql_fetch_row(mysql_query($query))){
    		$pid = $row[0];
    	}
    	$query = "INSERT INTO `price` VALUES('$pid', '$store', '$price')";			
    }
    mysql_query($query);
    }
    ?>
    <form action="" method="POST">
    Product name: <input type="text" name="product" />
    Catagory: <select name="cat">
    <?php 
    $query = "SELECT id, catagory FROM `catagory`";
    $result = mysql_query($query);
    
    while($row = mysql_fetch_row($result)){
    echo "<option value=\"$row[0]\">$row[1]</option>";
    }
    ?>
    </select><br />
    At stores:
    <?php
    $query = "SELECT id,short FROM `stores`";
    $result = mysql_query($query) or die(mysql_error());
    while(mysql_fetch_row($result)){
    echo "<input type=\"checkbox\" name=\"store\" value=\"$row[0]\" />$row[1]<br />";
    }
    ?>
    Price:<input type="text" name="price" />
    
    </form>
    <?php
    
    $query = 'SELECT products.product, catagorys.catagory, price.price, stores.short, price.pid, products.id
    FROM  `products` 
    JOIN  `catagorys` ON products.cid = catagorys.id
    JOIN  `price` ON price.pid = products.id
    JOIN  `stores` ON price.sid = stores.id;';
    $result = mysql_query($query) or die(mysql_error());
    $rows = mysql_num_rows($result) or die(mysql_error());
    $ppid = "";
    while($row = mysql_fetch_row($result)){
    if($ppid != $row[4]){
    	$ppid = $row[4];
    	echo <<<_ENDHTML
    Product: $row[0] <br />
    Catagory: $row[1]<br />
    _ENDHTML;
    	$query = "SELECT price.price, stores.short, price.pid, products.id
    	FROM  `products` 
    	JOIN  `price` ON price.pid = products.id
    	JOIN  `stores` ON price.sid = stores.id
    	WHERE products.id =  '$row[5]'";
    	echo $row[5];
    	$result = mysql_query($query) or die(mysql_error());
    	while(mysql_num_rows($result)){
    		echo "$row[0] at $row[1]";
    	}	
    	echo <<<_ENDHTML
    
    <form action="" method="post">
    <input type="hidden" name="delete" value="yes" />
    <input type="hidden" name="product" value="$row[0]" />
    <input type="hidden" name="price" value="$row[2]" />
    <input type="hidden" name="store" value="$row[3]" />
    <input type="hidden" name="cat" value="$row[1]" />
    <input type="hidden" name="pid" value="$row[4]" />
    <input type="submit" value="DELETE RECORD" /></form>
    </form>
    _ENDHTML;
    }elseif($ppid == $row[4]){
    	echo "<br />$row[2] at $row[3]";
    }
    }
    
    ?>
    

     

    Here is my database dump:

    -- phpMyAdmin SQL Dump
    -- version 3.3.9
    -- http://www.phpmyadmin.net
    --
    -- Host: localhost
    -- Generation Time: Aug 17, 2011 at 11:12 PM
    -- Server version: 5.5.8
    -- PHP Version: 5.3.5
    
    SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
    
    --
    -- Database: `pos`
    --
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `catagorys`
    --
    
    CREATE TABLE IF NOT EXISTS `catagorys` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `catagory` varchar(255) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
    
    --
    -- Dumping data for table `catagorys`
    --
    
    INSERT INTO `catagorys` (`id`, `catagory`) VALUES
    (1, 'HTC'),
    (2, 'iPhone');
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `employees`
    --
    
    CREATE TABLE IF NOT EXISTS `employees` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `sid` int(11) NOT NULL,
      `fname` varchar(255) NOT NULL,
      `lname` varchar(255) NOT NULL,
      `pass` int(11) NOT NULL,
      `hours` int(11) NOT NULL,
      `clocked` tinyint(1) NOT NULL,
      `wage` int(11) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
    
    --
    -- Dumping data for table `employees`
    --
    
    INSERT INTO `employees` (`id`, `sid`, `fname`, `lname`, `pass`, `hours`, `clocked`, `wage`) VALUES
    (1, 1, 'Rory', 'Anderson', 123456, 1, 0, 50),
    (2, 1, 'Phil', 'Brown', 1337, 0, 0, 15);
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `price`
    --
    
    CREATE TABLE IF NOT EXISTS `price` (
      `pid` int(11) NOT NULL,
      `sid` int(11) NOT NULL,
      `price` int(11) NOT NULL,
      PRIMARY KEY (`pid`,`sid`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    
    --
    -- Dumping data for table `price`
    --
    
    INSERT INTO `price` (`pid`, `sid`, `price`) VALUES
    (1, 31, 112),
    (1, 32, 60000);
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `products`
    --
    
    CREATE TABLE IF NOT EXISTS `products` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `cid` int(11) NOT NULL,
      `product` varchar(255) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
    
    --
    -- Dumping data for table `products`
    --
    
    INSERT INTO `products` (`id`, `cid`, `product`) VALUES
    (1, 1, 'iPhone 4');
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `sales`
    --
    
    CREATE TABLE IF NOT EXISTS `sales` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `eid` int(11) NOT NULL,
      `pid` int(11) NOT NULL,
      `sold` int(11) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
    
    --
    -- Dumping data for table `sales`
    --
    
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `stores`
    --
    
    CREATE TABLE IF NOT EXISTS `stores` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `address` varchar(255) NOT NULL,
      `state` varchar(255) NOT NULL,
      `phone` varchar(255) NOT NULL,
      `tax` int(11) NOT NULL,
      `short` varchar(255) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=33 ;
    
    --
    -- Dumping data for table `stores`
    --
    
    INSERT INTO `stores` (`id`, `address`, `state`, `phone`, `tax`, `short`) VALUES
    (31, 'Here', '100', '100000', 10, 'here'),
    (32, 'There', '101', '1000001', 111, 'there');
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `tills`
    --
    
    CREATE TABLE IF NOT EXISTS `tills` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `sid` int(11) NOT NULL,
      `eid` int(11) NOT NULL,
      `open` int(11) NOT NULL,
      `cash` int(11) NOT NULL,
      PRIMARY KEY (`id`,`sid`,`eid`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
    
    --
    -- Dumping data for table `tills`
    --
    
    

     

    I don't have a clue how I can get this to work

     

     

    Thanks

     

    JRagon

  4. So, I need to make a little form, that has the names of all the articles. With check boxes next to the name. When submitted it sends through the checked title names. Then it it gets the articles from using the titles. After that it runs the articles through my filter, and updates the articles. How on earth would I do this :S I've got good knowladge of PHP, but not so much of WordPress

     

    I don't have a clue how I could create a plugin like that.

  5. Hi!

     

    I'm trying to use the bing API thingy to search through a few results.... I can search 50 results but any higher and it gives me:

    PHP Notice:  Undefined variable: returnValue in /var/www/lib/Msft/Bing/Search.php on line 738
    PHP Notice:  Undefined property: stdClass::$Web in /var/www/lib/bing.php on line 68
    PHP Notice:  Trying to get property of non-object in /var/www/lib/bing.php on line 68
    PHP Warning:  Invalid argument supplied for foreach() in /var/www/lib/bing.php on line 68
    

     

    My code is:

    function __autoload($className)
    {
        $fileName = strtr($className,'_',DIRECTORY_SEPARATOR).".php";
        include $fileName;
        return;
    }
    
    $apiKey = '0291518CA7B6C789903D60F8AEB4CD30194F1F07';
    //$search = $_GET['search'];
    //if(isset($_GET['search'])){
    $o = new Msft_Bing_Search($apiKey);
    $o->setQuery('photography')
    ->setSource('Web');
    
    $raw = $o->search();
    $result = json_decode($raw);
    foreach($result->SearchResponse->Web->Results as $value) {
    	$feed = locateFeedUrl($value->Url);
    	$fh = fopen('feeds.txt', 'a');
    	fwrite($fh, $feed . "\n");
    }
    
    //}

  6. Fatal error: Cannot redeclare getparsedhost() (previously declared in /hermes/bosweb/web199/b1999/ipg.jragoncouk/jragon/lib/bing.php:10) in /hermes/bosweb/web199/b1999/ipg.jragoncouk/jragon/lib/bing.php on line 10

     

    I can't see why it is doing that... Maybe becuase it's a function inside of a function...

  7. Hi!

     

    I've been trying to make a google/bing dork scanner, I need to search for feed.php pages related to Photography. And then compile the list, so I have a nice bit XML feed list. I've not seen a google/bing API thing that would allow me to do this.. So I was wondering if you could help...

     

    Thanks

     

    Jragon

  8. Hi!

     

    I really really need some help... Do you know how I could do a batch file rename. I need to rename all .JPG files to .jpg... I've tried:

    <?php
    $cmd =<<<STUFF
    rename 'y/A-Z/a-z/' *
    STUFF;
    
    system($cmd);
    
    echo "Hopefully that would have worked.";
    ?>

     

    I have no idea what so ever! What shall I do :S

  9. Ok.. I found out it was the MySQL =S... I fixed it.. And now I have a whole load of errors

     

    object(PDOException)#3 ( { ["message":protected]=> string(85) "SQLSTATE[42S02]: Base table or view not found: 1146 Table 'cakes.ranks' doesn't exist" ["string":"Exception":private]=> string(0) "" ["code":protected]=> string(5) "42S02" ["file":protected]=> string(49) "C:\xampp\htdocs\rankonator\classes\user.class.php" ["line":protected]=> int(116) ["trace":"Exception":private]=> array(3) { [0]=> array(6) { ["file"]=> string(49) "C:\xampp\htdocs\rankonator\classes\user.class.php" ["line"]=> int(116) ["function"]=> string(7) "execute" ["class"]=> string(12) "PDOStatement" ["type"]=> string(2) "->" ["args"]=> array(0) { } } [1]=> array(6) { ["file"]=> string(49) "C:\xampp\htdocs\rankonator\classes\user.class.php" ["line"]=> int(27) ["function"]=> string(10) "createUser" ["class"]=> string(4) "user" ["type"]=> string(2) "->" ["args"]=> array(0) { } } [2]=> array(6) { ["file"]=> string(36) "C:\xampp\htdocs\rankonator\index.php" ["line"]=> int(12) ["function"]=> string(7) "newUser" ["class"]=> string(4) "user" ["type"]=> string(2) "->" ["args"]=> array(3) { [0]=> string(6) "Jragon" [1]=> string( "blenders" [2]=> object(PDO)#1 (0) { } } } } ["previous":"Exception":private]=> NULL ["errorInfo"]=> array(3) { [0]=> string(5) "42S02" [1]=> int(1146) [2]=> string(33) "Table 'cakes.ranks' doesn't exist" } } =D
    

     

    here is the updated sql

    
    -- phpMyAdmin SQL Dump
    -- version 3.3.9
    -- http://www.phpmyadmin.net
    --
    -- Host: localhost
    -- Generation Time: Jun 02, 2011 at 07:10 PM
    -- Server version: 5.5.8
    -- PHP Version: 5.3.5
    
    SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
    
    --
    -- Database: `cakes`
    --
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `cakes`
    --
    
    CREATE TABLE IF NOT EXISTS `cakes` (
      `UID` int(11) NOT NULL AUTO_INCREMENT,
      `cake` int(11) NOT NULL,
      PRIMARY KEY (`UID`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
    
    --
    -- Dumping data for table `cakes`
    --
    
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `users`
    --
    
    CREATE TABLE IF NOT EXISTS `users` (
      `UID` int(11) NOT NULL AUTO_INCREMENT,
      `user` varchar(11) NOT NULL,
      `pass` varchar(32) NOT NULL,
      `salt` int(11) NOT NULL,
      PRIMARY KEY (`UID`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
    
    --
    -- Dumping data for table `users`
    --
    
    INSERT INTO `users` (`UID`, `user`, `pass`, `salt`) VALUES
    (2, 'Jragon', '82ee1cd9be48fb781f40456fbd0ffef9', 205);
    

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