Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Difficult Limit Querie


I have two tables:

Table 1: Courses
CourseID
Other irrelevant details....

Table 2: Lectures
LectureID
DateOfLecture
CourseID

The relationship:
The course can have MANY lectures on different Dates.

What I am trying to create is a MySQL querie that can list all of the courses along with the first lecture date for each course. I have considered many angles of attack on this one, it must be simple and must be done a lot can anyone give me any hints as how to do it?




View Complete Forum Thread with Replies

Related Forum Messages:
Get A Drop Down Box That Is Populated By The Results Of A Mysql Querie
i've got a drop down box that is populated by the results of a mysql querie but for some reason it only shows the first word. so if i have the results;

test 1
test 2
test 3

it will just display test, Code:

View Replies !
Delete Multiple Records In The Same Database Querie?
I have some code that deletes records from the database, in a loop. However its prety inificient as it makes a seperate database call in every loop whcih is slow. PHP Code:

for ($i=0; $i<count($idarray); $i++)
          db_query("delete from clicks where id='$idarray[$i]'");

Is their a more efficient way of doing that? It is posible to delete multiple records in the same database querie?

View Replies !
Very Difficult Or Impossible
Hi, this morning I have seen that the script at pagina:
http://www.teachingonline.it/script/statistiche2.php wasn't working
properly

With this code I estract the day of the week in numeric format

$data=$record['Data_Visita']; // year-month-day date format
$anno=substr($data,1,4);
$mese=substr($data,6,2);
$giorno=substr($data,8,2);
$utime = mktime (0,0,0, $mese,$giorno,$anno,-1);
$weekday=date('w',$utime);
if ($weekday==0)
$weekday=7; // days from 1 to 7 (in Italian) echo $weekday;

This code has worked correctly before sept 30, after this day, I should
have had weekday=6, then 7, then 1 again, but after 5 I get 3, and so on

View Replies !
Difficult Curl
The sub pages also share the same URL. Pages 2 and 3 are accessed via Javascript links on the page that load new data without refreshing the entire page. curl into gallery.php and take whatever I want. curl into gallery.php, redirect to Javascript links to Pages 2 and 3 and get data off those pages. Anyone know how to "follow" the Javascript links with curl and get the data off Pages 2 and 3?

View Replies !
Simple Quest But Difficult Enough
Just wonder how to validate one specific input field
in a form processing script against a written variable in a form processing
script. Just as a security measure against spam.

View Replies !
How Difficult Is PHP/MYSQL To Learn?
I have an intermediate knowledge of JavaScript & ASP and was wondering if anyone could answer me a few questions.

1. How similar to them languages isPHP/MYSQL ?
2. How difficult is PHP/MYSQL to learn?
3. I use windows xp pro can i use PHP/MYSQL on this OS?
4. Is PHP/MYSQL free?? Is it easy to install??
5. Does anyone know any good tutorials online either free or at a small cost?

View Replies !
A Difficult Regex Pattern
I need a regular expression that matches this criteria, for validating a user-suggested password: "must contain an upper case letter, a lower case letter, a numeric digit and a punctuation, in any order" is it possible to do that all in one pattern?

View Replies !
How Can Formatting A Date Field In PHP Be So Difficult?
I have a column in a MySQL database called "rlsdate". Info is stored in the normal DATE format (YYYY-MM-DD). How can I extract a row, order the results of the query by 'rlsdate' but then when I display the field, have it formated like "September 14, 2005". I have actually been searching for an answer to this for months. There has to be a way.

View Replies !
Is It Very Difficult To Setup A Simple Mailing List?
I've seen and been on mailing lists where there are a bunch of people on it, but, when you reply to "the list" you are actually replying to something like, "mailinglist@widgets.com". So I want to setup something like this for a special project. I'm imagining that when the server gets an email to "mailinglist" that it would basically just re-send the message to everyone on the list.

Is this very difficult or even advisable using PHP's mail function?

View Replies !
Limit Db Query Limit Output
I'm using php 5  - recent mysql  -  This code was designed to display 2 colums of user input.  10 in each column.

Both cols display just fine-  my problem is after the colums display the rest of the db is displayed underneath of them.

Why is this happening and how can i fix it so that only the 20 items chosen are returned?

This db is expected to grow quite large so even querying the entire db will eventually be costly to server performance. Code:

View Replies !
Memory Limit Or Time Limit?
I have a script which takes user parameters and creates PDF catalogs that can't always finish. I think the bottleneck is a PHP or Apache configuration setting and ran some tests, but I don't know what to make of the results.

I started with the following settings and ran the same parameters each time:

Apache Timeout: 30
PHP max_execution_time: 30
PHP memory_limit: 8M

In each of 5 runs the script was cut short between 30 and 32s of execution time and used between .5MB and 6.5MB of memory. Code:

View Replies !
MySQL Limit Without Limit
This may sound confusing and unnecessary to some, but it is pretty much required for me to be able to make limit more flexible.

SELECT * FROM myTable LIMIT 0, 10 (gets first 10 records)

What I need is:
SELECT * FROM myTable LIMIT 0, ROWCOUNT (gets all records)

The problem is I'm trying to find what to put for ROWCOUNT without needing a second query to determine ROWCOUNT. I know I can just do SELECT * FROM myTable, but this will cause me to duplicate alot of data. Therefore, I really just want to know how to get ROWCOUNT.

View Replies !
LIMIT Or Not?
I want a list of the three next events as a kind of a summary of the events on my events page displayed on my home page. I know i could use LIMIT to just get 3 event titles, but i want to know if there are more than 3 so that i can have a link to " more events".
PHP Code:

View Replies !
Limit
i wanna limit the result for 10 records per page. if anyone have a script doing this.
if i said for example limit 0,10 how in next page i'll get next ten?

View Replies !
LIMIT Tag
I have a little question. Were would I enter the LIMIT 0 , 5 tag on the coding below?
<?php
mysql_select_db("database", $con);
$result = mysql_query("SELECT * FROM news ORDER BY id DESC");

while($row = mysql_fetch_array($result)){
?>
I've tried the following:
SELECT * FROM news LIMIT 0 , 5 ORDER BY id DESC
SELECT * FROM news ORDER BY id LIMIT 0 , 5 DESC
SELECT * FROM news ORDER BY id DESC LIMIT 0 , 5

I need it so it will only show the last 5 that were inserted, but I tested each one and they'll eather show all or none.

View Replies !
Php Limit
Is there a way to limit the amount of text outputted from a tables field. Let's say I have a news post that has a title, date, and content.

I have php grab the title and date and content but I don't want ALL the content if I'm doing a "recent news" section that just shows a snippet...so how do I limit just the content field when the php queries it ?....instead of the usual query limit that limits how many news posts I grab.

View Replies !
Trying To Get LIMIT 0, 3
I am attempting to get LIMIT 0, 3 from two MySQL tables and I don't think I have it set up the right way. Both tables have the column comic_id in which they are relational. When I run this I get the effect I want, but only 1 record: Code:

<?php
//REVIEW Genrator
$sqlz = "SELECT * FROM reviews";
if ($resultz = mysql_query($sqlz)) {
if (mysql_num_rows($resultz)) {
$rowz = mysql_fetch_assoc($resultz);
}
}
//Comic Information Query
$sqls = "SELECT * FROM comics WHERE comic_id = '" . $rowz['comic_id'] . "'";
if ($results = mysql_query($sqls)) {
if (mysql_num_rows($results)) {
$rows = mysql_fetch_assoc($results);
.................

View Replies !
Using LIMIT
I'm querying a table where I know it's going to be a unique answer should I put LIMIT 0,1 . My thinking being that if the record I'm looking for is the 3rd of 250,000 then using LIMIT will stop the query after it's found the record instead of going through the other 249,997 records. PHP Code:

$sql = "SELECT * FROM db_sector WHERE sector_x = '" . $x . "' AND sector_y = '" . $y . "' LIMIT 0,1";
$result = mysql_query($sql);
$sector_id = mysql_result($result, "0", "db_sector.sector_id");

View Replies !
Limit Available RAM
Is there a way to tell mySQL not to go above a certain amount of RAM? Our host doesn't set a hard limit and will charge if we go over. I'd like to prevent that from happening if possible. We have external applications connecting to our database which creates persistant connections (they need to stay connected for constant data transfer). At any given time we can have over 100.

View Replies !
SQL Limit 5-10?
I am developing some software that is backed my MySQL/PHP. I need it so that one of my sql statements will extract only rows 5 through 10. Code:

View Replies !
Limit Or Last
I'm using php with mysql I have a field that contains six entries, how would I create a select statement that would only give me the last entry that was inserted into a field?

I know if I use limit 0, 5 this would give me the first five entries only. How would I only get the very last entry?

View Replies !
Limit The Entries
How can I limit the number of entries into the database, so after the limit is reached a text like "sorry limit is reached" is displayed, if the limit is not reached a form is displayed.

View Replies !
2Mb Limit - Help Wanted
Is there a way to overcome the 2 Mb upload limit in PHP? I cannot change my PHP configuration files, and my hosting provider doens't want to do it for me.

View Replies !
Limit Access
I have a admin page (password protected) and many other auxialary files the admin center needs all in the same directory. Is there a way to make the auxilary files accesible to the php script but not to other users?

View Replies !
Str_replace Has Limit?
I read in php's documentation, one of the user's comment says that str_replace will only go through the subject string up to certain length depending the size limit set in the php.ini. where in php.ini can I find this to determine what's the size limit my shared server has? Is there any way I can work around it?

I created a guestbook form in my site, and store the comments in mysql. now, what I want to do is go through all the comments and replace all "

" or "
" to "<br>, all special chars to something viewable.

does ereg_replace has the same limitation? and is it true that ereg_replace is really slower than str_replace?

View Replies !
Limit Preg_replace()
I'm wanting to use a regex to replace keywords in some text with hyperlinks. I've got the regex's down pat, but is there some way to limit the number of replacements?

What I'm attempting to do is terminology highlighting + linking for key acroymns and words, but only want the first mention of the word to be highlighted, not the rest.

View Replies !
8 Meg Memory Limit In PHP 4
I'm getting frustrated with the 8 meg memory limit in PHP 4 and PHP's
inability to handle files of even moderate size. Below you'll see the
error message I'm getting, and below you'll see the function that is
generating it. Is there anyway to keep a log file without running into
PHP's memory limits?

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
allocate 476934 bytes) in
/home/www/krubner/ppUtilityCode/incrementSiteHistory.php on line 77

<?php
function incrementSiteHistory() {
// 03-22-04 - we want to keep a site history in a flat file that
belongs to this software, and which
// therefore, is not effected by the vagaries of web hosting
companies and their policies. Most
// web hosting companies delete the Apache site log each week, so we
can rely on that as a
// long term source of site history.
$controllerForAll = & getController();
$sessionObject = & $controllerForAll->getObject("McSessionInfo", " in
incrementSiteHistory().");
$pageInfoObject = & $controllerForAll->getObject("McPageInfo", " in
incrementSiteHistory().");
$resultsObject = & $controllerForAll->getObject("McResults", " in
incrementSiteHistory().");

$username = $sessionObject->getUserName();
$pageId = $pageInfoObject->getPageId();
$page = $GLOBALS["page"];
$category = $GLOBALS["category"];

// 04-22-04 - we need to get the config so we can use
$pathToNeededFiles as a prefix on the file name.
$config = getConfig();
$pathToNeededFiles = $config["pathToNeededFiles"];

$fileName = $pathToNeededFiles;
$fileName .= "mcLogs/siteLog.php";
if (file_exists($fileName)) {
$fp = fopen($fileName, "r+");
} else {
$fp = fopen($fileName, "w+");.......

View Replies !
Mysql LIMIT For All *but*...
I have a news script that displays the last five entries:

ORDER BY date
DESC LIMIT 0,5

No problems so far - but now I want to have a page that lets people view the archived news (essentially, all entries that aren't from the five most recent. I can say "LIMIT 5, 20" to get the next 20 entries - but what if I want *all* of the entries *but* those first five (or last five if I'm ordering by DESC)? The mysql manual doesn't seem to be much help on this one. I really want to say "LIMIT 5, ALL" but that isn't valid syntax, of course.

View Replies !
Limit To A Form
I've got a dynamic form with loads of controls, there's x controls per record and there's a load of records. When I've got all records displayed, the submit button doesn't work, it presses in but it never tries to load anything.

If I filter the records it generally works. There is no client side script, only PHP and HTML. Any ideas? is it a form limit in IE6?

View Replies !
Limit Per Page
I have a while loop that returns data from a join table. The page download size is getting too large and I want to break up the results into pages limited by a time span. For example, only show results for 15 days per page. So therefore the starting page will show results starting from June 3, 2001 to May 18, 2001, then the next page will show May 17, 2001 to May 2, 2001 and so on... How do I do this?

I'm assuming the URL will look something like <results.php?startdate=20010603> or <results.php?enddate=20010518>

View Replies !
PHP 2GB Filesize Limit
Anyone know if the 2GB filesize limitation has been addressed with v5.2.0? According to this bug ticket one guy says yes, another says no... http://bugs.php.net/bug.php?id=27792

View Replies !
Is There A Limit To Post_max_size?
1.) Is there a limit on post_max_size?
2.) How about upload_max_filesize?
3.) The manual mentioned something about memory_limit has to be bigger then post_max_size. I can't seem to find "memory_limit" in my phpinfo.php page. Am I blind?

View Replies !
PHP Output Limit 2M?
I'm using fpassthru() to send files to the browser, but only the first
2000000 bytes are sent. The apache log shows 2000000 bytes too.

Where does this limit come from and how do I change it?

My system:

PHP5.04
Apache/2.0.49 (Linux/SuSE)

I am using no output handler, and I have tried turning output buffering on
and off. I have set memory limit to 32Mb

View Replies !
Max. Limit To Ocifetchstatement
Am trying to navigate the result set from an Oracle function and it all works well using ocifetchstatement by reading the data into an array then traversing that.

However, the data size is going to increase to about 500,000 records - has anyone got any experience of using ocifetchstatement with a result set that size?

Can't seem to find any documented limit to the size of an array - and was wondering if anyone had 'broken' one yet?

View Replies !
LIMIT Display
I have an sql query that is supposed to bring back only 10 results from the database and display it. It works ok when the LIMIT is 0,10. But when the LIMIT is 10, 20 it brings back the first 20 results instead of results 10-20. Here is the code so you can see where its going wrong. PHP Code:

View Replies !
PHP Upload Limit
I'm trying to find a PHP upload script that allows me to upload large files (up to 1 gig) to my site, cant seem to find anything that is freeware out there.

View Replies !
Limit Echo
Basically i want to limit the ammount of data echoed. So say someone types a 1500 word description about themself, i want to just echo 250 characters of that. is there a way to do this?

View Replies !
Audio Limit
how to limit the playing of audio file in php?

View Replies !
How To Limit Chars?
how can i limit the echo chars from database, example, i have in table a row where is many text written, but i need only to echo first 150 chars.

$sql = mysql_query("SELECT * FROM $tab where (val=$vid and $subisa and $subisb and $subisc and $subisd) order by title asc limit $limitvalue,

$user_view_limit");
   while($r=mysql_fetch_array($sql))
   { 
$title=$r["title"] ;
$text=$r["content"] ;
echo "<h2>$title</h2>";
echo "<br/><h3>$text</h3>";

View Replies !
Limit Sql Results
I am working on a site to display thousands of results....I have all of that working but I want to limit the results to 50 at a time...any suggestions on how to browse the results with a limit of 50....I am thinking about checking the value of a number and while it is less than the total count of rows in the query increment it by 50..

View Replies !
SELECT LIMIT 100-200
is there any way to list from 100-200? Like
mysql_query("SELECT * FROM tablename WHERE id='id' LIMIT 100-200");?

View Replies !
Array Limit
Here i am putting my question in front to all of you that may be common one for you. My question is that: What is the array limit in PHP ?  means How many elements can be stored in an array at a time while using PHP ?

View Replies !
Limit To Varchar?
Is there a limit to the amount of characters you can have in the varchar field in a mysql db?

View Replies !
Limit Characters?
I'm working on my news posting script and was wondering how I could possibly limit the characters of the $body value to a certain number and after that number have a "...[more]" link where the user could click to be taken to a page with the full result. My problem is I can' t seem to get the limit function to work at all. If someone could please help me out and look at my code to see what I could put in there that'd be great! Here's a snipplet...

View Replies !
Upload Limit
i know that the php default upload limit is 2mb and that this can be changed by either editing the core php.ini file or by creating a htaccess file. I cant access the php in file(shared hosting). If i upload an htaccess file to the server then all my php scripts stop working. It is free hosting provided by free.fr(linux). Can i set the upload limit through the php script?

View Replies !
Desc Limit
DESC LIMIT 0,8

I'm trying to have 2 rows of four pictures show that's evenly spaced. Can someone explain to me what the zero does? I can't seem to do something like

4444
4444

I just keep getting
444
44444

View Replies !
DESC LIMIT 5
I have a problem with the next query, it supposed to give 5 row's back but i gives just 2 row's back.The temptable with id=5 should give 15 row's back if there were no conditions. could somebody tell me what to do about this.

$query6 =" SELECT * FROM temptableWHERE id=5 ORDER BY timestamp DESC LIMIT
0,5"; .

View Replies !
Problem With LIMIT
i have a table with userids, and trying to display them page by page by using LIMIT while yje admin clicks on the 'Next' and 'Previous' links above the page. let me explain. i want to show userids in alphabetical order. for eg: userids starting with z should be in last pages. i have 100 users and 10 userid/page but when i try with LIMIT 40,10 . the LIMIT clause filter the 40 to 50 records in order they are inserted into the table.and sort that 10 records in alphabetical order.

View Replies !
PHP Upload Limit?
I'm using a php script to upload a particular page, this script usually works fine and uploads all my files great, however this one page i have is quite long in length and whenever i upload it and try to view it the bottom of the page is cropped off.

It's really odd, I go to look at the uploaded page and view it's source code and the code just suddenly stops mid-sentence. I guess something must be limiting it. Code:

View Replies !
Limit Pages From Nav Out Put
I have put something in mysql, but i believe i have found that this is the right area now. I am trying to limit the number of pages that origionally appear when you click to view one of the catagories on the site.

View Replies !
LIMIT Problems
I have this query straight from the sql manual and I cannot get it to work.

$query = "Select * From Results Limit $f,$l;";

$f = 645

the number of the auto incremented id key I want it to return:

$l =5

the next five entries

when I try to run it it kills my while loop and outputs nothing. I hardcode numbers in it nothing. It really has me stumped. Code:

View Replies !
Pagination And LIMIT
i am starting coding a new db and need to understand how pagination works from scratch. at the simplest level, i have php file that uses this command

$query = "select title, description, date from reslink where category_id=1 LIMIT 10";

bearing in mind that this entry would produce 1000 results, i need a way to break the entries down into 10 at a time. a friend of mine suggested i should look at pagination. i would be grateful if someone could give me a kickstart so i can start getting this to work.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved