Jump to content

gitn32

Members
  • Posts

    26
  • Joined

  • Last visited

Posts posted by gitn32

  1. If fixed this on my real code. Let me re-explain the problem. I have 2 pieces of data. They are both displayed on the webpage. They each have the own account balance. For example, 1 can be 500, and the other can be 750. Lets say 500 is on the top of the page. I click the remove button, and 750 (which is on the bottom of the page) is subtracted from the account balance. I would like to make it where, when I click the top amount (500), that 500 is subtracted from the account balance, instead of 750. Your guys are telling me what's wrong with my HTML, which I have fixed. I appreciate that, but it's not the question. Please trty and help with the one above, if you can't help then that's fine. I appreciate your guys' time.

  2. Ok the first problem is solved, how about this:

    	$result = mysql_query ("SELECT * FROM invoices WHERE username='$user'");
    	
            
            while($row = mysql_fetch_array($result))
                {   
                    
                    
                    
    				$username = $row['username'];
    				$bill = $row['invoice'];
    				$ammount = $row['ammount'];
    				$id = $row['id'];
                 
    		
    				
    			
                    
                    
                    echo "
    				
    				
                    <font size='3' face='arial'>
                    
    				
    				
                    <table width='250' border='0' cellspacing='1' cellpadding='0'>
    				<tr>
    					<td><b>$id, $bill: $$ammount</b></td>
    				</tr>
    				<tr>
    					<td><form action=bills.php method=POST<input type=submit name=submit value=Remove</form></td>
    				</tr>
    
    				
    	
    				</table>
    					
    			
                        
                        
    					
    				
                    </font>
                    ";
                    
         
    	if(isset($_POST['submit'])) {
    	
    	
    	$got_error = 0;
    	
    	
    	
    	if ($accbal > $ammount){  
            
    		
    		 
    		$naccbal = $accbal - $ammount; 
    			require ("userconnect.php");
    			mysql_query("UPDATE users SET accbal = '$naccbal' WHERE username = '$user'");
    
    		
            }
    		
    		else {
    			$got_error = 1;
    			echo "Not enough money in account.";
    			
    		}
    		}
    
    //$accbal IS defined before code starts
    //And there is an extra $ before $ammount so it displays a dollar sign, and the ammount.

    I'm also having the same problem with this, and this is different because your updating not deleting. This is a virtual funding system.

    There it is.

  3. Yes that was helpful. But not to this question:

     

    I have multiple pieces of data. Each piece of data has its own submit button when displayed. If there is 2 pieces of data and I hit the top button, the bottom data is the accbalance. I want to make it so that if I hit the top button the top button the newaccbal is the amount of the top.

  4. Ok the first problem is solved, how about this:

    	$result = mysql_query ("SELECT * FROM invoices WHERE username='$user'");
    	
            
            while($row = mysql_fetch_array($result))
                {   
                    
                    
                    
    				$username = $row['username'];
    				$bill = $row['invoice'];
    				$ammount = $row['ammount'];
    				$id = $row['id'];
                 
    		
    				
    			
                    
                    
                    echo "
    				
    				
                    <font size='3' face='arial'>
                    
    				
    				
                    <table width='250' border='0' cellspacing='1' cellpadding='0'>
    				<tr>
    					<td><b>$id, $bill: $$ammount</b></td>
    				</tr>
    				<tr>
    					<td><form action=bills.php method=POST<input type=submit name=submit value=Remove</form></td>
    				</tr>
    
    				
    	
    				</table>
    					
    			
                        
                        
    					
    				
                    </font>
                    ";
                    
         
    	if(isset($_POST['submit'])) {
    	
    	
    	$got_error = 0;
    	
    	
    	
    	if ($accbal > $ammount){  
            
    		
    		 
    		$naccbal = $accbal - $ammount; 
    			require ("userconnect.php");
    			mysql_query("UPDATE users SET accbal = '$naccbal' WHERE username = '$user'");
    
    		
            }
    		
    		else {
    			$got_error = 1;
    			echo "Not enough money in account.";
    			
    		}
    		}
    
    //$accbal IS defined before code starts
    //And there is an extra $ before $ammount so it displays a dollar sign, and the ammount.

    I'm also having the same problem with this, and this is different because your updating not deleting. This is a virtual funding system.

    Can someone please reply.

  5. Ok the first problem is solved, how about this:

    	$result = mysql_query ("SELECT * FROM invoices WHERE username='$user'");
    	
            
            while($row = mysql_fetch_array($result))
                {   
                    
                    
                    
    				$username = $row['username'];
    				$bill = $row['invoice'];
    				$ammount = $row['ammount'];
    				$id = $row['id'];
                 
    		
    				
    			
                    
                    
                    echo "
    				
    				
                    <font size='3' face='arial'>
                    
    				
    				
                    <table width='250' border='0' cellspacing='1' cellpadding='0'>
    				<tr>
    					<td><b>$id, $bill: $$ammount</b></td>
    				</tr>
    				<tr>
    					<td><form action=bills.php method=POST<input type=submit name=submit value=Remove</form></td>
    				</tr>
    
    				
    	
    				</table>
    					
    			
                        
                        
    					
    				
                    </font>
                    ";
                    
         
    	if(isset($_POST['submit'])) {
    	
    	
    	$got_error = 0;
    	
    	
    	
    	if ($accbal > $ammount){  
            
    		
    		 
    		$naccbal = $accbal - $ammount; 
    			require ("userconnect.php");
    			mysql_query("UPDATE users SET accbal = '$naccbal' WHERE username = '$user'");
    
    		
            }
    		
    		else {
    			$got_error = 1;
    			echo "Not enough money in account.";
    			
    		}
    		}
    
    //$accbal IS defined before code starts
    //And there is an extra $ before $ammount so it displays a dollar sign, and the ammount.

    I'm also having the same problem with this, and this is different because your updating not deleting. This is a virtual funding system.

  6. Here is my code:

    $result = mysql_query ("SELECT * FROM $tbl_name WHERE username='$user'");
    	
            
            while($row = mysql_fetch_array($result))
                {   
                    
                    
                    
    				$username = $row['username'];
    				$email = $row['password'];
    				$age = $row['age'];
    				$id = $row['id'];
                 
    		
    				
    			
                    
                    
                    echo "
    				
    				
                    <font size='3' face='arial'>
                    
    				
    				
                    <table width='250' border='0' cellspacing='1' cellpadding='0'>
    				<tr>
    					<td><b>$id, $username,$password,$email,$age</b></td>
    				</tr>
    				<tr>
    					<td><form action=delete.php method=POST><input type=submit name=submit value=Remove></form></td>
    				</tr>
    
    				
    	
    				</table>
    					
    			
                        
                        
    					
    				
                    </font>
                    ";
                    
         
    	if(isset($_POST['submit'])) {
    	
    	$got_error = 0;
    	
    	
    			mysql_query(" DELETE $id FROM $tbl_name);
    
    		 
            }
    		
    		else {
    			$got_error = 1;
    			echo "Error.";
    			
    		}
    		}
    

    I have multiple pieces of data. Each piece of data has its own submit buttton when displayed. If there is 2 pieces of data and I hit the top button, the bottom data is deleted. I want to make it so that if I hit the top button the top button is deleted. Please help.

  7. Well I was thinking like a virual funding system for roleplay. First a login (without a register page and were I have to add the members). Then a bank page were you can view your account balance/citations/bills. And if you have any citations/bills were you can pay them and your account balance will automaticly be subtracted. And lastly a my account page were you can change your password/ email. Thats basiclly it. But I need to be able to add members, and add citations/bills. Like I said im new to PHP so im not sure if you can really even do this. But hopefully its possible.

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