Hey guys thank you for the help you have been giving me it is much appreciated!!! Now can someone help with some code, im developing a website using php and mysql and id like to know how do you limit the amount of data that the php script takes from the database??? And another problem i have is that it repeates the data that is contained in the table!! How do i stop that??? Im really a novice when it comes to this!!:(

can you post the code so we can see what you did wrong?

if you are wanting to limit the number of results returned from a mysql query you can use the LIMIT parameter.

to remove duplilcates you can use the DISTINCT param in the query as well.

Hiiii.....
You can use the limit option that is available in SQL queries to limit the amount of data returned from the website....
For eg:

Select * from mytable where category='computers' order by name asc limit 0,20

The above SQL query will show 20 records beginning from 1st record...

You can search more from google on the limit option... It will give u more examples...

As far as repeating of data is concerned... What i understand from your post is that... Your table is populated with exactly same data.. or in other words, the similar records can be entered more than once...
Correct me if im wrong..

For this, preferably write a small function that will check from the table whether the data already exists..
For eg. an employee details.. no two employees with same employee id can exists..

So you can use the similar function...

<?php
function check_employee_exists($emp_no)
{
    $sql="Select * from employee where empid=".$emp_no;
    $result=mysql_query($sql);
    if(mysql_num_rows($result) > 0)
    {
         //means employee exists
         return true;
    }
    {
         //means employee details does not exists
         return false;
    }
}
?>

This is done from PHP...

you can also set primary keys in the database table if you want to prevent duplicate data in the table...

If im on right path.. then post here... so that more options can be explored for this...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.