kekkaishi 18 Junior Poster

i wish to help u with this but im having a bit of difficulty understanding ur problem.

i've been doing while loops for this problem

what exactly is 'this problem'?
are u trying to retrieve a set of 'boxes' from a mysql database and arrange them in order?

kekkaishi 18 Junior Poster

u needa return the sorted array from the rotateRight function

public static int[] rotateRight(int[] array){

and at the end of the function

return array;

and in the main

list = rotateRight(list);

hope this helps

kekkaishi 18 Junior Poster
SELECT AES_DECRYPT(secretfield,'12345') as sf FROM table WHERE ID='$_SESSION[id]' AND secretfield = (AES_ENCRYPT('$secretvariable','12345'));

(did a little research myself since im not that familiar with this. i normally use md5 or sha1.)

kekkaishi 18 Junior Poster

it COULD be tht there is not a value stored in $_SESSION
echo it out and check if it has a value.

kekkaishi 18 Junior Poster

try this

//if('$choicetext'!="" && '$verb'=="other"){
if($choicetext !="" && $verb=="other"){ //see the difference? variables are without the single quote
kekkaishi 18 Junior Poster

if i may add in, can't u just do this?

public static void main(String[] args){
        int sum=0;
        for(String s: args){
            sum += Integer.parseInt(s);
        }
        System.out.println("Sum: "+sum);
    }
kekkaishi 18 Junior Poster

referin to ur sample tree the following would work i suppose.

int height = 9;
        int currentRow = 1; //current row count for iterating
        int stCount = 1; //star count for each row
        while(currentRow <= height){
            int checker = 1; //to keep check of already printed star

            if(currentRow == height){
                stCount = height/2;
                while(checker <= stCount){
                System.out.print("*");
                checker++;
                }
                System.out.println("");
                break;
            }
            while(checker <= stCount){
                System.out.print("*");
                checker++;
            }
            System.out.println("");
            stCount += 2; //in ur sample each consecutive row has 2 more stars than the previous row
            currentRow++;
        }

as for 2 sided, one soultion could be

int height = 12;
        int currRow = 1; //current row count (for iterating)
        int stCount = 1; //star count (for each row)

        int spaceCount = ((((height-1) * 4)-3))/2; //space count for each row except the last
        int spCountForLast = spaceCount-2; //space count for last row        
        while(currRow <= height){
            int stChecker = 1; //star checker (for each row)
            int spCheck = 1; //space checker (for each row)
            if(currRow == height){
                stCount = 5; //just assumed a constant width for the trunk
                while(spCheck <= spCountForLast){
                    System.out.print(" ");
                    spCheck++;
                }
                while(stChecker <= stCount){
                    System.out.print("*");
                    stChecker++;
                }
                System.out.println("");
                break;
            }
            while(stChecker <= stCount){
                while(spCheck <= spaceCount){
                    System.out.print(" ");
                    spCheck++;
                }
                System.out.print("*");
                stChecker++;
            }

            System.out.println("");
            currRow++;
            stCount = (currRow * 4)-3; 
            spaceCount -= 2;
        }

hope this helps.

kekkaishi 18 Junior Poster

first change the string to integer. that is

Scanner sc = new Scanner(System.in);
String st = sc.nextLine(); 
int x = Integer.parseInt(st);

//then goin to find the total of the sum of the individual digits. 
int total=0;

while(x>0){
  total += x%10;
  x = x/10;
}

its just simple maths. what happens here is, say x=123 and when x is divided by 10 the answer is gonna be 12 and 3 the reminder. so x%10 gives u the reminder. and then u r adding the reminder digits to the total and u r repeating it until the last digit.

hope this helps.

kekkaishi 18 Junior Poster

u know what im trying to say here right.
say

$x = "123asd";
$y = "123asd";
if($x == $y){
echo 1; //it should echo one right
}

due to the fact that ur code does not do so, we could conclude that they are not equal, couldnt we? so i'm sorry to ask again, but do compare the two actvtn codes side by side. (maybe the lengths are not the same. i had an issue like this once and it turned out that i had allowed 200 characters to be stored in the db and i was comparing a 250 character string with a 200 one. the longer string was exactly the same up until the 200th character. u see what i mean?)

kekkaishi 18 Junior Poster

ok.... do something for me (sorry im also tryin to figure out the prob)

do this

if($get_user_data['activationcode'] == $activationcode){
echo 1;
}

if it does not echo 1 could u paste the two codes.
echo $get_user_data;
and
echo $activationcode;

kekkaishi 18 Junior Poster

and yet the message is "Sorry that activation code seems to be invaid."?

kekkaishi 18 Junior Poster

echo the actvtn code within the block to check.. u know just in case.

//THIS SEEMS TO BE WHERE THE ERROR IS
$get_user_data = mysql_fetch_array($check_id);

echo $get_user_data['activationcode'];
echo $activationcode;

if($get_user_data['activationcode'] != $activationcode){
$final_report.="Sorry that activation code seems to be invaid.";
}else{
//THIS SEEMS TO BE WHERE THE ERROR IS^
kekkaishi 18 Junior Poster

if u want to convert string to int

String s = "2";

int x = Integer.parseInt(s);

but u could directly get the int value using nextInt

Scanner sc = new Scanner(System.in);
int x = sc.nextInt(); //edited to assign sc.nextInt() to int x

hope this helps.

kekkaishi 18 Junior Poster

thanks and much appreciated. :D

kekkaishi 18 Junior Poster

maybe this could help. (ive assumed a sample scenario)

public class Orange {

    private String name;

    public void setName(String name){
        this.name = name;
    }
    
    public String getName(){
        return this.name;
    }

 public void remove(Orange o[], Orange o1){
        for(int i=0; i<o.length; i++){
            if(o[i].getName().equals(o1.getName())){
                o[i] = new Orange();
            }
        }
    }
}

and to check

public static void main(String a[]){
        Orange[] o = new Orange[2];
        for(int i=0; i<o.length; i++){
            o[i] = new Orange();
            o[i].setName("Orange_" + (i+1));
        }
        
        Orange o2 = new Orange();
        o2.setName("Orange_1");

        o2.remove(o, o2);
        for(int i=0; i<o.length; i++){
            System.out.println(o[i].getName());
        }
    }
kekkaishi 18 Junior Poster

Sorry but that does not work at all. I tried to do this before and all I got was empty space. The output was empty spaces.

karim.naggar is right. and the solution i provided does work. ive compiled and checked.

and try this. it'd be easier this way to check i suppose.

System.out.println("value at " +i+ "," + j + " is: " + a[i][j]);

//value at 2,3 is: F
kekkaishi 18 Junior Poster

I did the ode but it's not working the way I want it too. For example if I change

int y = 2000, m = 5, d = 06; to int y = 2889, m = 44, d = 16; it prints it instead of what is in the if statement in class Date1.

public class Date1 {
	
	   private int year = 1; // any year
	   private int month = 1; // 1-12
	   private int day = 1; // 1-31 based on month
	   
	
	   //method to set the year
	   public void setYear(int y){
		 
		   
		   if (y <= 0)
		   {
		   System.out.println("That is too early");
		   year = 1;
		   }
		    
		   if (y > 2011)
		   {
		   System.out.println("That year hasn't happened yet!");
		   y = 2011;
		   }
		   else 
			   
		   year = y;
	   }
	   
	   public int setMonth(int theMonth){
		   if ( theMonth > 0 && theMonth <= 12 ) // validate month
		         return theMonth;
		      else // month is invalid 
		      { 
		         System.out.printf( 
		            "Invalid month (%d) set to 1.", theMonth);
		         return 1; // maintain object in consistent state
		      } // end else
		   
	   }
	   
	   public int setDay( int theDay){

		   int[] daysPerMonth = 
	         { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	   
	      // check if day in range for month
	      if ( theDay > 0 && theDay <= daysPerMonth[ month ] )
	         return theDay;
	   
	      // check for leap year
	      if ( month == 2 && theDay == 29 && ( year % 400 == 0 || 
	           ( year % 4 == 0 && year % 100 != 0 …
kekkaishi 18 Junior Poster

set values of day, month and year using the setter methods u've created. if u r to use the default constructor, then u cannot create objects of Date1 using the constructors u created (and there will be errors when uve called then after commenting).

so set the values using the setters u created. eg:

Date1 d1 = new Date1();

System.out.print("Enter the year (yyyy) ");
year = input.nextInt();
d1.setYear(year);

and in the setDay function in Date1 class i think u meant to say

public void setDay( int d){
    day = (( d >=1 && d < 31)? d : 1);
//d < 31 instead of d>31
}

hope this help.

kekkaishi 18 Junior Poster
System.out.print(a[i][j] + ' ');

change to

System.out.print(a[i][j] + " ");

and see.

kekkaishi 18 Junior Poster

have u tried after uncommenting ur constructors?

kekkaishi 18 Junior Poster

hi,
i'm trying to manipulate dynamic textboxes using jquery such that when the value of the textbox_1 is, say, 'abcd' a new text box textbox_2 would be introduced and when the value of textbox_2 is again 'abcd' a third one is introduced and so on. ive managed to do this with the following code, but with a little problem.

$(document).ready(function(){
    var cnt = 1;
    $("#inpu_"+cnt).keyup(function () {
        var value = $("#inpu_"+cnt).val();

        if(value == 'abcd'){
            $("#inpu_"+cnt).css("background-color", "red");
            cnt = cnt + 1;

            $("#content").append('<input type="text" id="inpu_' + cnt + '" />');
        }
     });

}).keyup();

the problem is that although textbox_2 is displayed instantaneously, the 3rd and 4th does not when the value of textbox_2 is 'abcd'. but they are displayed as soon as a key is pressed in the original textbox (textbox_1). that is the 3rd one is displayed when textbox_2's value is 'abcd' and a key is pressed while inside textbox_1. and so on.

[edit 1] btw, inside body tag ive created a div and given the id content. and inside it is the textbox_1 with the id 'inpu_1'. the original one that is.

what could be the problem? what am i doing wrong?
thanks in advance for ur help.

kekkaishi 18 Junior Poster

select id from your table, order by id in descending order and give it a limit of 1.

kekkaishi 18 Junior Poster

may be use explode() to get the individual phrases in the search string and then re-build the query string for each of the phrases...

kekkaishi 18 Junior Poster

u could use strrpos function to identify the positions of the dots.
but, i dont think a file would have two extensions. extension is the one that comes after the last dot no matter how many dots a file name has.
if you already do not know about it, you might find the global array $_FILES helpful. $_FILES["file"]["type"] would give you the type of the file.

kekkaishi 18 Junior Poster
kekkaishi 18 Junior Poster

you gotta try yourself first.
hint: you could use Euclid's gcd algorithm....

it goes like this,
gcd(a,b) = gcd(b, a%b)

kekkaishi 18 Junior Poster

you could may be do this

//do
		//{
		System.out.print("Please enter your guess(1-1000): ");
                n = in.next();
		if(isIntNumber(n))
                    num = Integer.parseInt(n);
                else
                    num = 0;
		//}
		//while(!isIntNumber(n));

		while(num != target)
		{
			if(num <1 || num >1000)
                            System.out.println("Stupidity");
                        else if(num >0 && num <1000 && num > target){
				System.out.println("Too high");
                                numberOfGuesses++;
                        }
			else if(num >0 && num <1000 && num < target){
                            numberOfGuesses++;
				System.out.println("Too low");
                        }

                        
                            

                        System.out.println("Please enter your guess again. it must be between 1 and 1000 inclusive");
			String nums = in.next();
                        if(isIntNumber(nums))
                            num = Integer.parseInt(nums);
                        else
                            num = 0;
                        //num = in.nextInt();
		}
kekkaishi 18 Junior Poster

hi,

i've been trying, without success, to maintain the style of the text in a jTextPane when it is copied into the clipboard. what I want is to copy the text in a jTextPane with styles (eg: bold, italic) and to be able to paste it into MS WORD with all those styles. if the text is bold in jTextPane then it must be bold in the word document when pasted.

the text in the TextPane is styled with a StyledDocument.

i'd be grateful for any help you guys could give me.
thanks.

kekkaishi 18 Junior Poster

i have a multiple select drop down menu where i select some courses however my problem is that i was to store the selected courses in an array for further use. i have tried creating an array but is is coming up empty. Can someone help me out here
here is the code where i was to store the courses in an array

$store=array();
			@$code1= $_POST['coursecode_1'];
			if( is_array($code1))
			{
				echo "The Course(s) that you have selected are:<br> ";
					//$sum= array();
				while (list ($key, $val1) = each ($code1)) 
				{
					$store[]=$val1;
					//echo $val1;
					$c="SELECT * FROM courses WHERE course_code= '$val1'";
					$r=mysql_query($c);
					$m=mysql_fetch_assoc($r);
					extract($m);
					echo "$course_name<br>";
					echo $store;
				}

first thing: i really dont think $code1 is an array since it is assigned the value of $_POST. so the if statement wont be executed.

kekkaishi 18 Junior Poster

I dont think the Db connection is the issue as other pages used the same connection and the have to issues. just this new page

so y dont u give the necessary tables a check out :)

kekkaishi 18 Junior Poster

I have tested the query in phpmyadmin and it pulls back the expected results. so it not working in the code is beyond me

If the connection is OK then try this.
u said its workin on the test server, so can u recheck the database in ur server and confirm if the tables and column names are exactly the same as ur db in the test server. remember, mysql is case sensitive.

kekkaishi 18 Junior Poster

just thought id also add in a bit.
remember that mysql fetch array returns only one row each time the query runs, first run returns first row of the mysql resource, the second run second row and so on and returns a false if there is no more... so the cleanest way to go about is to use a while loop as u did IF u r fetching from DB. As network18 said, the best way is to practice and 'explore' be it foreach loop or anything else :)

rouse commented: Kekkaishi as good energy and insight +2
kekkaishi 18 Junior Poster

jomanlk is correct. Sorry i couldnt focus on ur full qstn and I dunno any open source forum that allows user migration.

kekkaishi 18 Junior Poster

Does anyone know of a php based forum that is easily customizable to work with an existing user base so that members don't have to register or sign in a second time when they access the forum? I heard that this is possible with phpbb3 but I haven't seen anything in their documentation that covers this.

you heard right, but that is the user's choice. If the user TICKS THE REMEMBER ME CHECK BOX, then it remembers the user provided that the user do not clean his/her cookies or cache for that matter. phbb3 is a powerful one with a lot of features and to know more u might wanna give it a test.

kekkaishi 18 Junior Poster
kekkaishi 18 Junior Poster

Hi There,
I have had a look on the internet but not really been able to find the correct thing i'm looking for very easily, or at least not very well/easily explained.

I am trying to create a Search Form for my website which has 2 fields.

1) A Postcode Field.
and 2) a Category drop down Menu

When the user clicks search the search should enter a MYSQL table on my database and find the postcode entered and the selected category fields and display the results along with additonal information such as address and telephone number.

For instance.
I search L21 2AG
and pick the Category: Cafe

The search then brings up 3 results (for example)

1) LS1 2AG - Cafe - 12 Main Street, Leeds - 01313135432
2) LS1 2AG - Cafe - 16 The Green, Leeds - 01313352124
3) LS1 2AG - Cafe - 90 Grove Street, Leeds - 013131242342

Anyone got any idea's.
Any code I can use, and websites for tutorials or something maybe.
I have a basic idea of the code Im going to require, not not very detailied idea.

Thankyou very much, I do hope you can help me.
Also I hope this was posted in the correct post, I've used this website numerous times before but only just created an account and posted.

Cheers,
Jordan


EDIT: Also I understand I may need a search.php file to proccess this? Cheers

ok, …

kekkaishi 18 Junior Poster

Ok so im building a level editor for this game. What the code i cant working does is, when the button is clicked it should get the selected cell from the jtable and set a value for it. However, for some reason I cannont get it working. Here is the code:

for (int y = 0; y < 30; y++)
					{
					        for (int x = 0; x < 30; x++)
						{
							if(wallChooser.isCellSelected(y, x));
							{
								wallChooser.getModel().setValueAt(value, y, x);
								System.out.println("works again" + x + " " + y);
								value = "";
							}
					        }
                                           }

when i run the application for some reason it just print works again for every single cell. But the selected cell does not get the value.

Please help,

thanks
jakx12

how about when you removed the semi-colon from if(wallChooser.isCellSelected(y, x));

kekkaishi 18 Junior Poster

huh?

hehe, i meant that it shud work. and I asked y would u want to do that in the first place.

for example in ur case,

mysql_query("INSERT INTO users(`username`, `password`, `status`) VALUES('myusername', 'mypass', 'hehe')");

would work just fine.

kekkaishi 18 Junior Poster

theres NO error message. i just keep checking the table everytime i go to the page and theres no row.. omgawd. i forgot to conect to the database. oppseis.
anyways thanks for helping. but i have another question. do u know how i can insert straight text into the database. instead of using variables cause just having like

VALUES('THETEXT', 'TEXTMORE'

doesnt work for me

dont see any reason y u cant. but what so practical about it. or as Simon would say "wots the dream 'ere?" :D

kekkaishi 18 Junior Poster

its still NOT WORKING. i dont know why ive used my previous code on every single thing basically that ive made so far. i just dont understand why it doesnt work sometimes....

could u tell me the error message?

kekkaishi 18 Junior Poster

Okay, I am still going around in circles and not getting it to work. Let me put my actual code rather than trying to make up examples. This is for a blog, which I actually had working fine (well, this part of it), but I am building the whole thing into a class now, to make it easier to work with.

This is what I have it at now. The $_ptimeValref that gets passed to the function is right (I got it to echo it.) I tried "SELECT * FROM post WHERE ptime ='$_ptimeValref' and changing the * to post, title, ptime. I realize that I must just not be getting it. Each time I have done this I have gone through the same process, finally getting something that works, but not really sure why it does, and why so many other things I tried didn't.

function getPostValues($_ptimeValref){
          /* This function gets the value of ptime
          and returns the full set of values for a post: 
          post url, title and ptime as a time value */
          
      include 'DB_connection.php';
      $query = "SELECT * FROM post";
      $result = mysql_fetch_assoc($query);
      while ($row = mysql_fetch_array($result)){
          if ($row['ptime'] = $_ptimeValref){
              $post['url'] = $row['post'];
              $post['title'] = $row['title'];
              $post['ptime'] = $row['ptime'];
              }
          }
      return $post;     
  }

i think u r missing the actual queryin part. you'll obviously need mysql_query(....) ainni?
i think ur $result shud be equated to mysql_query($query)

kekkaishi 18 Junior Poster

i dont know why but sometimes i use the same exact thing ive used on other pages that it has worked for and it just doesnt work on the new page im working on.
i have a table called users. with columns called username password and status why isnt this working:

$var1 = "test1";
$var2 = "no app";
mysql_query("INSERT INTO users(`username`, `password`, `status`) VALUES('$var1', '$var2', '$var2')");

it also does not work if i take out the ` marks and when i add a $this = mysql....

try this

mysql_query("INSERT INTO users(`username`, `password`, `status`) VALUES('".$var1."', '".$var2."', '".$var2."')");
kekkaishi 18 Junior Poster

Can PHP be the alternative for ASP.net, or it is different from other.

it is different and, using PHP as an alternative for ASP is all up to you. i personally prefer PHP and it's been 6 years since i started using it and loving it ever since. :)

kekkaishi 18 Junior Poster

look at the comment in the code

public int loop() { 
    if(isInventoryFull()) { 
    dropAllExcept(pickId);   
    return 600; 
    } 
 
    RSObject rock = getNearestObjectByID(tinId); 
    if(rock == null) { 
    return 500; 
// MAYBE U WERE MEANING TO END THIS IF BEFORE GOIN ANY FURTHR. so right before atObject(tinId, "Mine");  try inserting the close parenthesis }
}
    atObject(tinId, "Mine");  
    return 1100; 
    }
 
    public void onFinish()  { 
    log("Script completed. Thank you for using my script.");
    log("Please report any bugs to me at ********@hotmail.com.");
            } 
 
       }
}

so it could be the problem. im really sorry man i need to rush out so i cant stay any longer. I just thought id give u this hin b4 goin.

kekkaishi 18 Junior Poster

OK I'm making a script and I get this error and have no clue off have to fix heres the code all help is thanked:

import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.logging.Level;
import javax.accessibility.*;
import javax.swing.*;

import org.rsbot.bot.Bot;
import org.rsbot.script.*;
import org.rsbot.script.wrappers.*;
import org.rsbot.accessors.*;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.event.listeners.ServerMessageListener;
import org.rsbot.event.events.ServerMessageEvent;
import org.rsbot.util.ScreenshotUtil;
import org.rsbot.script.wrappers.RSInterface;
import org.rsbot.script.wrappers.RSItem;
import org.rsbot.script.wrappers.RSItemTile;
import org.rsbot.script.wrappers.RSNPC;
import org.rsbot.script.wrappers.RSPlayer;
import org.rsbot.script.wrappers.RSTile;
import org.rsbot.script.wrappers.RSTilePath;
import org.rsbot.script.wrappers.RSObject;

@ScriptManifest(authors = { "Ubot" }, category = "Mining", name = "UbotsMiner", version = 1.00, description = "<html><head></head><body> Welcome to my first script! Please report all bugs & suggestions to Narutoguy312@hotmail.com.</body></html\n")  
public class UbotsMiner extends Script {


    //** Ints
    public int[] tinId = {11957,11958,11959};
    public int[] copperId = {11962,11960,11961};
    public int[] pickId = {1275,1265,15259,1267,1273,1271,1269};
    public int miningAnimation = 627;

    RSTile[] mineToBank = {new RSTile (3285,3371), new RSTile(3292,3383), new RSTile(3290,3400), new RSTile(3289,3416), new RSTile(3280,3428), new     RSTile(3266,3430), new RSTile(3254,3420) };

    RSTile[] bankToMine = {new RSTile(3255,3428), new RSTile(3270,3426), new RSTile(3284,3424), new RSTile(3288,3414), new RSTile(3290,3399), new      RSTile(3291,3383), new RSTile(3283,3367) };

    public boolean onStart(final Map<String, String> args) { 
        return true; 
    } 

    public int loop() { 
    if(isInventoryFull()) { 
    dropAllExcept(pickId);   
    return 600; 
    } 

    RSObject rock = getNearestObjectByID(tinId); 
    if(rock == null) { 
    return 500; 
    atObject(tinId, "Mine");  
    return 1100; 
    }

    public void onFinish()  { 
    log("Script completed. Thank you for using my script.");
    log("Please report any bugs to me at ********@hotmail.com.");
            } 

       }
}

ok. i havent gone thru the entire of ur code but heres something that caught my eye. ur onFinish() method is inside ur loop() method.
so u …

kekkaishi 18 Junior Poster

I am busy with a project for fun and I am finding it tricky to set balues for mysql queries.

If I do the following:

function CalcPostByTime(){
  include 'DB_connection.php';  
  $result = mysql_query("SELECT ztime FROM blogpost;");

What is the simplest way to set an array, which will be a return value of the function, for the ztime value. Basically it is a unix time value, and in this query it is the only thing that I want to get out.

I want to then iterate through it in date/time order and set a value numbers as keys to the array in another function. Or should I do that in the query itself? Basically I don't want to worry about keys in the database, so that I always have the option of deleting or changing. I what to iterate through the values each time to order the posts, and set my selecting from there.

i dont really understand ur requirement, but c if the following code helps to get you started

<?php
// PHP 5
function returnArray(){
$colors = array('red', 'blue', 'green', 'yellow');
return $colors;
}
$ra = returnArray();
    for($i=0; $i<4; $i++){
        print $ra[$i]."<br />";
    }
?>
kekkaishi 18 Junior Poster

this is my new code and its works a lot better now thanks, theres still a few changes ive gotta make but the basics is there

$out = "Out of stock";
$in = "In Stock";
$limit = "Limited Stock Available"; 

$qresult = mysql_query("SELECT * FROM crossref WHERE stock >= $qty AND part = \"$pt\"");
    $row = mysql_fetch_array($qresult);
{
do 
{
    echo "<table style='font-size:10px; font-family: arial;' width=1000px>";
    echo "<tr>";
    echo "<td width='20%'>".$row[part]."</td>";
    echo "<td width='40%'>".$row[desc]."</td>";
    echo "<td width='15%'>".$row[xref]."</td>";
    echo "<td width='15%'>".$row[zref_model]."</td>";
    echo "<td width='10%'>"; 
        if ($row['stock'] == $qty){
            echo $limit;
            }
        elseif ($row['stock'] >= $qty){
            echo $in;
            }
        elseif ($row['stock'] <= $qty){
            echo $out;
            }
    echo "</td>";
    echo "</tr>";
    echo "<tr><td colspan='5'><hr></td></tr>";
    echo "</table>";

}
while($row = mysql_fetch_array($qresult));
} 

end quote.

kewl, but u also might wanna keep the table head outside the loop. sorry i couldnt tell u this earlier. slipped ma mind. anyways, if u r gonna keep ur code this way, u r creating a new table each time the loop is run n ur pages MIGHT run slower as ur database gets bigger. so anyways, the best way is to play around with no fear :D it's always hard in the beginning. n now ive gotta go. so good luck.

kekkaishi 18 Junior Poster

ur an absolute genius thanks for this its a massive help and now works great, sorry i wasnt much of a help its just im still getting used to php

thanks again

good luck mate but while u r at it, i think the following blocks of codes are not necessary.

$qresult = mysql_query("SELECT part,stock FROM table WHERE stock >= $qty AND part = \"$pt\"");
//AND
$row = mysql_fetch_array($qresult);

//since u r doing the same with the following code. 

$string = ("SELECT * FROM table WHERE stock >= $qty AND part = \"$pt\"")
or die("Please enter a part number");
//and while at it change $string to the following. u dont need or die() coz u r doin so under $query = mysql_query..... get what i mean?
//$string = "SELECT * FROM table WHERE stock >= $qty AND part = \"$pt\"";
$query = mysql_query($string) or die (mysql_error());

//AND of course all those if's at the very bottom aint necessary.

and i find this site, http://www.tizag.com/phpT/, very helpful for learnin n for references.

kekkaishi 18 Junior Poster

i dont think im getting anywhere with this, im just not knowledgable enough about php at the moment, i literally only have about 4 weeks of php knowledge.

aany help would be much appreciated

c if this works.

//echo "<td width='20%'>".$result[stock]."</td>";
//instead of this, try the following
echo "<td width='20%'>"; 
if ($result['stock'] == $qty){
   echo $exact; 
}
echo "</td>";
dandixon commented: really took the time to help me out +1
kekkaishi 18 Junior Poster

that is exactly what i want, ill have a mess around with the code now

kewl,:) lemme know what happens, i'll be around for a while if you need any help.