| | |
php limitations
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2008
Posts: 7
Reputation:
Solved Threads: 0
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!!
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:
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...
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...
You can use the limit option that is available in SQL queries to limit the amount of data returned from the website....
For eg:
sql Syntax (Toggle Plain Text)
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 Syntax (Toggle Plain Text)
<?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...
![]() |
Similar Threads
- IE6/IE7 unexpectedly drops the PHP Session ID cookie (PHPSESSID) (PHP)
- Need way to use php without a server. (PHP)
- Opinions? javascript/php/etc and programming standards (JavaScript / DHTML / AJAX)
- echo not working (PHP)
- Memory Limitations?? with PHP affecting pdf generation (PHP)
- Limitations of Moveable Type for newbies (PHP)
- I had a experience of a website coded in PHP (PHP)
- How many clients can access a PHP script at a time? (PHP)
- Zend PHP Certification (PHP)
Other Threads in the PHP Forum
- Previous Thread: preg match
- Next Thread: Loading XSL in xmlObject ?
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array basics beginner binary broken cakephp checkbox class cms code cron curl database date datepart directory display download dynamic echo email error file files folder form forms function functions google head href htaccess html image include insert integration ip java javascript joomla limit link list login loop mail menu mlm mod_rewrite multiple mysql number oop parse password paypal pdf php phpmyadmin problem query radio random recourse recursion regex remote script search seo server sessions sms soap source space sql structure syntax system table tutorial update upload url validation validator variable video web webdesign xml youtube






