Selection Of Records In List
I was wondering how to query MySQL to display only a selection (1-20,
21-40) of a query in an HTML list. Can that be done in an SQL
statement, or do you have to use PHP to dissect the returned array
with for n elements to n+20 elements. How does Google achieve the
returning of results in its search engine. I imagine that the same
query may not necessarily be executed each page listing. I am
wondering whether the results from the query would return an array of
say 36000 elements.
View Complete Forum Thread with Replies
Related Forum Messages:
Selection From A List Box.
php and have to implement this functionality to select a user from a list box. I have written the code for this, but the problem is after selecting a name and doing the required task, it again selects the first entry in the list box. So if there are 100 users, the 100th one has to scroll down again and again. I need to modify this code so that until the session expires, if a person has selected his name once, that name will be selected in the listbox until he changes it. <select name="name" style="width: 120px;"> <?php $query = sprintf("select * from person order by person_name"); $result = mysql_query($query); $i = 0; while($row = mysql_fetch_array($result)) { $i++; printf("<option value="$row[person_num]">$row[person_name]</option>"); } ?> </select>
View Replies !
Multiple List Selection
I am still learning PHP, which is the best language for database driven sites. I am using Dreamweaver CS3 with the devleopers toolbox which is "ok" to help take the guess work out of things. I am using a simple registration form that i made with the toolbox, but when I come to a multiple list to choose from (populated from the database) it doesn't work correctly. Of course, out of the multiple items selected only the last one gets inserted. From what I have read, the selection must be turned into an array then looped for this to work. Is this correct? Next how would I code this to work right.
View Replies !
Getting The Selection Box To List The Results Alphabetically?
Below is a snippet of my code. How do I go about getting the selection box to list the results alphabetically? I'm a newbie, so the more specific - the better. <select name="city"> <? $sql="select * from city"; $rez=mysql_query($sql,$dblnk); while($row=mysql_fetch_array($rez)) { ?> <option value="<? echo $row['id'];?>"><? echo $row['city'];?></option> <? } ?> </select>
View Replies !
Identifying User's Pick From Selection List
I have an application that uses PHP to access a MySQL table and extract rows which match the user's search entry. Data from the matching rows are loaded into an HTML selection list, and the user can scan the list and highlight a selected item. My question: In PHP, what is the syntax for identifying which row is highlighted? My goal is to pass the unique row ID of the selected item to a subsequent form where all the fields will be displayed for the user to edit. I already have the code that loads the selection list and the code that displays the fields. I just need to know how to determine the highlighted item. I have two PHP books, and both discuss loading the selection list, but there is no mention of what to do next.
View Replies !
Calling A Php Function From A Form Selection List
I have a function that will read records from the database and populate an area of my webpage based on a value selected from a list box. I have got it to work fine if the user hits a submit button but I was wondering if it possible to perform the function dynamically each time the user changes the value in the list box.
View Replies !
List Box Selection To Display Record In Form
I have developed a database in mysql and php for contact management. I have programed in several older languages but am new to both mysql and php. I need to display information in a form but want to select the record from a drop down list either by typing or selecting from scroll. Problem 1 first and last name in seperate fields so search in list box a problem because I can only select one field. Second... after selection of name in dropdown list how to tell the form to refresh to the record selected. Third I would like to display contact information in a form on the top of the page (from the selection from listbox) and at bottom a list of touchpoints that pertain to that contact from the touchpoints table.
View Replies !
Populate A Drop Down List In A Form On The Basis Of A First Selection
I have developed a form to register a property in a db. The form needs the selection of a country and then based on that selection the selection of regions from the selected country. I have a program which allows selection of a country and then a region but it uses java script which I would like to avoid. I also just wanted one submit button if possible. Code:
View Replies !
List Records In Random Order
I got 10 records from mysql database, i know that it can list with ORDER BY name , time whatever. does anyone know how to list them in random order, so that anyone can have a chance to list at the top (first item) etc.
View Replies !
Multiple Delete From A List Of Records
If I have a list of records from a database on the screen, each with a check box beside them, how would I delete all the records that have been ticked? I assume I would use a variable similar to checked[], but not sure what syntax I would use to remove them from the database? Would I loop round each record comparing the checked[] value and it it's set, delete the record?
View Replies !
Displaying Priorty Records And Normal Records In The One Dataset.
I have a page which displays the records from the database and uses paging to display the records in groupes of 10 per page. I now want to be able to show results depending on the database field (display) in the database (can be set to either "full" or "limited"). If the record and the field display is equal to "full" i want to then display this record at the top of the record set and display all the fields. If the record is equal to "limited" i want to display different results and they must show after all the records which are equal to "full". I can't output two different recordsets as i use paging and only want to show 10 records per page. Code:
View Replies !
DELETE RECORDS - Database Adding New Records
iv got the database adding new records, and now I want it to display all of the records that are there buy name and id number, then i want u to be able to type in the id number of the customer u wish to delete and it shoudl delete it, sounds good buts its not actually deleting the record. it says it does, but its not doing it. Code:
View Replies !
Problems With The Listing Of Records, Editing Of Records
I'm having problems with the listing of records, editing of records, and deleting of records. I'm not sure what I'm doing wrong. The listing script is calling the add entry script. So I add the record, the database is updated, and nothing else happens. I don't get a list of records from that table. When I did SQL programming off the mainframe, you did a simple select statement. I'm not sure why the PHP list script is calling the add entry script. Code:
View Replies !
List Contents Of A Folder, Make List Of Links
Does anyone know how I can write a script that: - reads in all the files in a particular directory - displays the file names in a html list and makes a link of them: <ul> <li><a href="filelocation1">filename 1</li> <li><a href="filelocation2">filename 1</li> <li><a href="filelocation3">filename 1</li> </ul> etc.? So basically it creates a list of links with the contents in that directory, so you can download them from there.
View Replies !
Get List Of Messages From One Table, Message List Indicator From
I have two tables. One has a list of messages left by users using fields named mbxno for the mailbox and msgno for the message number. I have another table that has mailbox settings for each user that contains a field named "messagelist" to indicate if they want to be included on the message list or not. What I'm trying to create is a list of the most-recent messages with a lookup on the users table to indicate whether a message in the list should be included in the message list based on the user's mailbox settings. SELECT messages.msgno, messages.mbxno, users.messagelist FROM messages, users WHERE (users.messagelist = Ƈ') ORDER BY msgno DESC LIMIT 100 What I'm getting, though is a list that looks like this: mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 I think what's happening is that I'm using the wrong type of join and more rows are being created than necessary. If I add "DISTINCT" to the query, I get a list of the most-recent messages as I expect, but the "messsagelist" value is sometimes wrong (again, probably because the data is getting jumbled). For example, the messagelist value for the second row (2214) should be 0, not 1. mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 2214 msgno: 0412141622 msglist: 1 mbxno: 2189 msgno: 0412141408 msglist: 1 mbxno: 0000 msgno: 0412141213 msglist: 1 mbxno: 0003 msgno: 0412141213 msglist: 1 mbxno: 2265 msgno: 0412132029 msglist: 1 mbxno: 0000 msgno: 0412131950 msglist: 1 How should I be doing this? If nothing else, what kind of join will work with a long list compared to a value from a short list?
View Replies !
Mailing List Manager, Send To List
I'm looking for a mailing list script (php) that has a function to let users to reach out to all recipient on the list by simple send the email to a specific maillist- address. Mailman has this functionn but as a just got a webserver account I can't use mailman nor install it.
View Replies !
Selection Box Via Selection
Basically I have a selection box which gets it's values from a database once this is selected the selection box's below will get the correct value from the above selection box which again comes from the database. The first selection box works by refreshing the current page and adding a variable to the file for example instead of useraddnew.php it would be useraddnew.php?maintcat=5 but the number 5 only gets set the second time you choose from the top selection I hope some one can help sorry if I explained it poorly. Code:
View Replies !
Selection Tag With Php
I have a list of countries and i want to use (selection) tag by automatically. explain: the code of list is following: HTML Code: <option value="40" >Belize</option> <option value="41" >Benin</option> <option value="42" >Bermuda</option> <option value="43" >Bhutan</option> <option value="44" >Bolivia</option> <option value="45" >Bosnia and Herzegovina</option> <option value="46" >Botswana</option> etc... If user want to change his information and showing the list of countries, i want to use (selection) tag by automatically of his country (in database).
View Replies !
Row Selection I Think
See the line "echo 'poo below? It's not echowing the $row['username'] and I'm not sure why. PHP Code: $selection= addslashes(htmlentities($_POST['username'])); Â Â Â Â $sql = " SELECT * FROM webfriends WHERE username = '". mysql_real_escape_string($selection) ."' "; Â Â Â Â if ($result = @mysql_query($sql)) { Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â //echo md5($_POST['password']); Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â //setcookie ("wfcookie", "you are logged in", time()+3600); Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â session_start(); Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $_SESSION['$selection']; Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â echo 'poo' . $row['username']; Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â echo $selection; This bit, the 'poo' echoes (thats just there for testing reasons) but the $row['username'] doesn't. This is part of a larger script, if you feel the problems lays there, tell me and I'll post the lot.
View Replies !
Date Selection
I have some records in my table that I need to extract if they are equal or greated than the current date. The date fields are in format YYYY-MM-DD. Could someone please provide some details on how to do this in php, I think I have a rough idea. Set date variable to current date, select all records from database where database date is >= current date.
View Replies !
Selection Of Ajax Lib ?
I m working on an PHP based site where in UI I need to use ajax funtionalities ... I just want some opinion from experts that which LIB is best for usage. I was wondering that using XMLHTTP is sometimes a bottleneck for cross browsers application. Different libraries are here but not sure which one to select.
View Replies !
Database Selection
I created two web database applications - first one is the company news system (as part of the company pages), second one is the company data presentation system (part of the company pages, too). All (unfortunately) the M$ environment - NT or 2003 server. The first app is managed from the web interface, the second app is managed by database client win32 app (created by PowerBuilder, std client-server approach, ODBC). For the second app I need to create the web presentation interface now (no data modifications, heavy sql queries :-( ). The first app contains only small amount of data (10 database tables, max 100 rows in the largest table) but the second app contains large number of tables, more than 100000 rows in major part of tables, very sensitive company data, requires sophisticated and intelligent db engine strategies for queries, ... For the first app I wanted to use MySQL, for the second one I wanted the Sybase SQL Anywhere. But now I am in doubt. I'm playing with the idea to substitute the Sybase SQL Anywhere by the PostgreSQL or MySQL. I need all the SQL decorations (stored procedures, stored functions, triggers, declarative referential integrity (foreign keys), ...) I'm playing with the idea to unify the database environment (use only one db engine and two databases, not two different db engines for two databases), too. Is the MySQL or (preferably-IMHO) PostgreSQL database engine stable, robust, safe, ..... in order to use it for these company very sensitive data, for heavy data mining app, ... ? Is it safe to unify the database engine types and use only one engine for these two apps/dbs? Can I rely on the MySQL and/or PostgreSQL engines? Do you suggest me to use (one of/both) these two db engines for the main company data presentation database?
View Replies !
Multiple Selection
I have a form that grabs reords from a mySQL database and presents the information in a nice pulldown menu. The client now wants that little menu to be a list that you can select multiple resords from (this is a brochure request for - the list has a max of 12 pieces). I know how to get the form to look the way I want, but when I parse the form with the little app I wrote in PHP that varifies the data entered, checks feilds, and then enters it in a mySQL database for tracking purposes - there is only one record in the database - even though there were more that one records selected. Now I am simply entering $properties (the variable of the menu feild) in the the INSERT statement of my database query - do I need to parse the records selected first - what am I doing wrong...?
View Replies !
Seperate Selection
I am trying to select data stored in a database as u can see and it gets dispalyed. But my problem is I need to beable to select each item individually instead of all at once or 1 item only. I need to beable to select say bread as an item and milk as an item but at the moment I can only select 1 or all items. PHP Code:
View Replies !
Form Selection
I am working on a form right now that when you click a radio button at the top it will select a few of the other radio buttons. Here is the code that i have. I just dont know how to do this. I have never done this type of form before. Code:
View Replies !
Listbox And Its Selection
im trying to create a webpage using mysql and php. im using the below code to populate a listbox with playernames held in my database. once i select a name; im trying to make the page gather the relevant information from that users details to be displayed on the same page. for example if i select "MoFish" from the listbox, i want it to echo all MoFish's details in the page such as his: "age" "height" "weight" if i select "Berty" i want it to echo bertys details. how can i acheive this? Code:
View Replies !
Option Selection
I am making a Option Box (Drop down bar) for Gender, (Male,Female) and I want when they Select there Gener, and then hit submit, it Writes to to a Database. i have it set it up so far that it goes to another page to INSERT it into the Databse.
View Replies !
Products Selection
I have some registers in my DB and I have a form for show them with a checkbox for select a product, an image, a name, a field to input the amount of a product, a price and a description. My question is how to correspond the product that I selected and the quantity that I input?
View Replies !
SQL Random Selection
is that possible to select random rows with SQL !? let say if i want to select name of three people from NY, how can i do that with SQL, ie.
View Replies !
Random Selection With Where
In my database I have a hundred or so items layed out like this, Code: id name shown 1 Pez yes 2 Giles no 3 Bob yes etc... I am trying to randomly select one of the entries where shown is yes. What is an easy way to do this? I have to be able to expand the database and it still work. So someone clicks give me a name and the php randomly choses a name from the database but only out of ones that shown is == to yes. However users will be able to add their name to the database, then a admin will alow the name to be shown (to prevent abuse) . And the new name will be added to the list of randomly choosable names.
View Replies !
Dynamic Selection
I know this is not purely related to php script but if there is someone guru who already solved this kind of problem. How do I have the list of OPTIONs in a SELECT listbox change depending on the selection in another listbox? example for this is: you have one listbox which selects the country then you have a second which should only display the valid states/province for that country, or one listbox which shows categories and another which lists the subcategories for that category, etc.
View Replies !
Edit Selection
I have a form that includes a dropdown menu that allows a user to pick and then is sent to mysql db table. I would like to be able to let the user go back and edit the info. I can echo back the choice the user made but how do you let the user choose again from the dropdown menu.
View Replies !
Random Selection
I have run a sql query that for example gives 100 results, but I only want to print 5 of these results randomly so that each page view will give a different set of results based on the 100 from the sql query.
View Replies !
Limiting Selection
I have checkboxes on a form that should only allow up to four selections. What would I need to add to this code to limit the selection to 4. Now it lets you select more than 4. <td class="resultsColumnName" id="vciColumnTitle" valign="bottom" align="center"><strong>VCI</strong><br>Cushion</td> <td class="resultsColumnName" id="checkboxColumnTitle" valign="bottom" align="center"><strong><h2>Choose up<br> to 4 Shoes to<br> Compare</h2></strong></td> </tr> <? do { ?> <tr> <td class="shoeNameResults"><?=$myrow[product_name];?></td> <td class="shoeTciResults" align="center" width="30"><?=$myrow[tci];?></td> <td class="shoeVciResults" align="center" width="30"><?=$myrow[vci];?></td> <td class="shoeCheckboxResults" align="center" valign="top" height="20"><input type=checkbox name=shoes[] value="<?=$myrow[product_image]?>"></td> </tr> <? } while ($myrow = mysql_fetch_array($result)); ?> </table> <? } else { echo "Sorry, no records were found"; } ?></td> </tr> <tr> <td width="5%"> </td>
View Replies !
A More Efficient Selection
I'm using the following code by which users pick up a name from a field in a table. It worked well for a fair bit but now my table has about 2500 odd names and its getting tedious scrolling thru the list. Can anyone suggest a more efficient way to go about it ? maybe a user typing the first 3 letters of a name or some such ? PHP Code: Customer</td><td><select name="customer"><option value="">[Select One] <?php mysql_connect("localhost", $dbname, $dbpasswd ) or die ("Unable to connect to server."); mysql_select_db($database) or die ("Unable to select database."); $result = mysql_query("SELECT DISTINCT `Company` FROM `Customers` ORDER BY `Company` asc "); .........................................
View Replies !
Selection Options
I have a script where a user can go and update their details, the problem I am having is with a drop down box and retrieving the value: PHP Code: <p>How many years working once fully qualified?:</td><td><select size="1" name="yearsasqualified" <option value=Ƈ' <?php if ($_POST['yearsasqualified'] == 1) echo "selected"?>>1</option> //<option>1</option> <option value=ƈ' <?php if ($_POST['yearsasqualified'] == 2) echo "selected"?>>2</option> The problem I have is an undefined index on option 2 if say option 1 is selected.
View Replies !
Limiting A Selection
I have a table in my database that contains fields relating to addresses. What I want to do is to give the user a choice to view all the locations from a certain county. As there can be multiple instances of a county in the table how do I ensure the county only gets displayed once. For example in the table I may have 5 entries which are: Devon Cornwall Devon Devon Sommerset When I retrieve all the information from the table I want to display only Devon Cornwall Sommerset.
View Replies !
Selection Query Help
Let me give you an example: id | name | house 1 test house_test 2 test2 house_test 3 test3 house_test2 4 test4 house_3test 5 test5 house_test 6 test6 house 7 test7 house_again 8 testi7 house_again 9 testii7 house_again 10 testETC house_again I need a MySQL SELECT sentence which returns all unique house names. "SELECT house FROM my_table *WHERE IT IS UNIQUE* ORDER BY ID DESC"; So it should return in the above example: house_again house house_test house_3test house_test2 house_test
View Replies !
While() Loop And Selection
I have something like this: PHP Code: $var = ""; while($row = mysql_fetch_array($res)) { echo "id: ".$res['id']." var: ".$var ; } I'd like to know if it's possible to specify a value for $var ONLY on some rows, let's say row 1 and 3, to have an output like: Quote: id: 1 var: foo id: 2 var: id: 3 var: foo id: 4 var: id: 10 var: ... I thought about something like if ($res[1]) {$var = "foo";} but no luck.
View Replies !
Limit Selection
PHP Code: $sql="SELECT * FROM $tbl_name ORDER BY id DESC"; $result=mysql_query($sql); How can i make it so only the 5 newest entery's are selected?
View Replies !
Selection Sort?
I need to implement some sorting algorithm. I have a webpage that has n number of questions. The user can reorder the questions as desired with drop down menus. Code:
View Replies !
Selection Box Popup
I cannot find the "New Post" button on the forum itself. I'm needing help in creating a selection box that on submission opens a popup that gets image thumbnails matching the selection, then on selecting one of the thumbnails updates or reloads the previous window with information that matches that thumbnail. Can this be done? I so far have the selection box opening the popup with the thumbnails, but I don't know how to make the thumbnails update the previous window.
View Replies !
Copy Selection? From .chm
Using: php_manual_en.chm on Windows XP I'm trying to keep a few notes from the manual in text files. And would love to select blurbs from the .chm Encouraged by the right-click menu option, "Copy Selection to Clipboard" Unfortunately, it does not work. or Maybe just works when it wants to. ps: I do see the links that copy pre-assigned sections: "Copy to Clipboard"
View Replies !
Textarea Selection
I'm trying to create a php tool for local use where I put a list of words (one on each line) in to a textbox and it takes each word and creates an entry in an sql table. So I'd put hey ho whats up yes no maybe and it'd go through each word and create a seperate entry so 1 for hey, 1 for ho, and so on. Is there a way to a) get how many rows there are in to php? b) select each row and grab it's contents?
View Replies !
Dynamic Variable Selection...
Is it possible to create a bunch of variables in a loop with different #'s at the end of their name... like: while ($counter <= 10) { $myvar$counter; } to create 10 variables.... mayvar1, mayvar2, mayvar3, etc..... is there a way to do that?
View Replies !
Getting Multiple Selection Into One String
I have a listbox with 5 options. I have set it up to be able to choise more than one option. What I need to know is how to get all the selection into the one string that is stored in the DB It is easy to get the first selected option to post into the DB.
View Replies !
|