Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8286697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:50:57+00:00 2026-06-08T11:50:57+00:00

Table 1 – users id username items 1 Paul 1(0020);2(0001); Table 2 – items

  • 0

Table 1 – users

id username items
1 Paul 1(0020);2(0001);

Table 2 – items

id name 
1 name_here

In my user’s items I put 2(0001) which means: 2=item id, 0001 is the amount of it
Here is a function that displays my item list

function getitems() {
$username = $_SESSION['user'];
$connect = mysql_connect("localhost","root","x") or die("Conexiune nereusita!");
mysql_select_db("skameron") or die("Baza de date nu exista!");
$query = mysql_query("SELECT * FROM users WHERE username='" . $username . "'") or            die(mysql_error());
if(mysql_num_rows($query) == 0) {
        echo "<tr><td colspan=\"3\">Nu ai iteme in inventar!</td></tr>";
} else {
        while($itm = mysql_fetch_assoc($query)) {
    $str = $itm['items'];
    $items = preg_split("/;/", $str); 
    foreach ($items as $item){ 
 
$temp_item =  preg_split("/,/", $item); 
if($temp_item){ 
    foreach ($temp_item as $temp_i){ 
    If($temp_i=="")
    {
    }
    else{
    $pieces = substr($temp_i, -5, 4);
    $piecesold = $pieces;
    $pieces = $pieces/1;
    //$arrnr = array(0,1,2,3,4,5,6,7,8,9,"(",")");
    //$temp_i = str_replace($arrnr,"",$temp_i);
    $query2 = mysql_query("SELECT * FROM items WHERE id='" . $temp_i . "'") or die(mysql_error());
        if(mysql_num_rows($query2) == 0) {
        echo "<tr><td colspan=\"3\">Nu ai iteme in inventar!</td></tr>";
} else {
        while($itm2 = mysql_fetch_assoc($query2)) {
        $temp_i = $itm2['name'];
        $temp_id = $itm2['id'];
        echo $temp_i . " <a href='items.php?del=". $temp_id."(".$piecesold.")'>Delete all</a>(". $pieces . ")/<a href='items.php?del=". $temp_id."(".$piecesold.")&nr=1'>Delete 1</a><br>"; 
    }}}}} else { 
    echo $item;     
}}}}}

I made the page to delete an item but I can’t find a way to delete just the amount of items…for example to change this: 2(0100);1(0001); to this: 2(0099);1(0001);

Here is how I did to delete a value like this:

$delitem = $_GET['del'];
$queryreg = mysql_query("UPDATE users SET items = REPLACE(items, '$delitem;', '');");

I can delete with this page a value like 2(0099); and the others remain…
But I can’t only change the amount of item which is 0099/1=99

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:50:59+00:00Added an answer on June 8, 2026 at 11:50 am

    You really should consider changing the layout of your data

    Table1 - Users
    Id Name
    1  Paul
    
    Table2 - Items
    Id Name
    1  SomeItem
    2  AnotherItem
    
    Table3 - UserItems
    UserId ItemId Quantity
    1      1      100
    1      2      99
    

    Now paul has 100 of SomeItem and 99 of AnotherItem

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

table: user id name ------------- 1 john 2 paul 3 mattew table: nickname id
Table users id - Primary Key, AI username - varchar (50) Table logins login_time
Table: activities: id, userId, description, objectId users: id, name usersFriends, id, userId, friendUserId objects:
Table A has two columns: ID and name I want to input 3 ID
Table: items Create Table: CREATE TABLE `items` ( `ite_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
Table A has a number of rows, only some of which have (multiple) children
TABLE tab sl_no name marks status 1 dude 33 y 2 dudz 38 y
Table users: id | firstname | lastname ---+-----------+--------- 1 | John | Smith 2
Table Layout: TABLE ORDER: id localizedInfoId Table OrderLocalizedInfo: id localizedInfoId name With the following
Table Schema Table Name: file_manager_folder Rows: id , parentId , name My query simulates

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.