Populate A Pull Down Menu From Db
how do I populate a pull down menu from a MySQL table?
Using PHP/MySQL 4.0
Have table1 with names and ID and tableb with ID and statistical info.wnt to be able to scroll names and have users able to click on the name to follow a link to a page created using tableb data for each name listed.
Table examples:
tablea
ID l Name
---------------------
1 Person, Joe
2 Smith, Joe
tableb
ID l units l margin
--------------------------------
1 5023 123
2 2536 72
View Complete Forum Thread with Replies
Related Forum Messages:
Menu And Links
i have a page called menu.php, where it displays data from a db which has fields like id, title and url. It is placed on the root folder i.e mysite.com/menu.php, now i have the mainpage index.php where i use include line to include my menu.php page. Everything is fine but it didn't work when i include the menu.php in another folder i.e bands/index.php. because the link would appear like bands/bands/index.php. I don't know if that is the correct method of doing it, but is there an alternate way of doing the menu.php so that it works on all folders. If i dont use the field url in my db, how to do the linking successfully ?
View Replies !
Dynamic Menu Using PHP & MySQL
I am trying to edit a site that I didn't build. I am a designer with 11 years interactive exprience. So I can edit code and understand quite a bit, but I'm not a programmer. I think the site is dynamically generating a menu. I found this code in the "header.inc" file: Code:
View Replies !
ORDER BY With A Value 'menu=true'
I need an order by clause on a roles table that has the role and also if it should be ordered first. So what I gotta do is order by the field menu = true then by the field id. The menu field tells the UI if we should show the role in the role menu, so if it's set to true then it shows at the role menu if it's false then we don't show it. For example I have the IDs 24 34 56 17 22 And the IDs 56 and 22 have menu = true and the other have menu equal to false. I need to figure out how to first order by the menu = true and then by the Id so it would produce this result: 22 56 24 34 17
View Replies !
'Save' Menu Option Inactive
This had me losing lots of work and wondering what's up with the File->Save menu option. I have been creating sql files and (thinking I was) saving regularly with Alt+F, then S... To my dismay, when I reopened the files they only contained code from the first time I saved (save as). Then I noticed that the Save menu option is always greyed out. Is this how it was intended to be or is there a problem with my install? Any help on this would be appreciated as I instinctively use Alt+F and S, rather than Alt+F, then A (or Ctrl+S) then selecting the correct filename and then clicking 'ok'.
View Replies !
Page Management In Hierarchical Menu Structure
Something like: animals/cat.html vegetables/carrot.html vegetables/broccoli.html home.html contact_us.html (this would go into a nice set of nested <ul>s and then styled with CSS for a 'pop out effect') My question though is how to implement it all on a database level. Right now I'm thinking of: table categories: id, parent_id, name table pages: id, category_id, title, content And to create the menu I'd need two queries, one to fetch the categories and one to fetch the pages, and then I'd use a server-side data structure to build the nested list, going through each category and adding the appropriate pages to it. (an array of arrays, probably) Is this the best way to do it? Has anyone else implemented a similar structure differently? One other thing - if the end-user wanted to change the order that the menu appeared in, how would we implement that? Right now in each category, I can either put in sub-categories first or pages first (because of the server-side processing), but what if I wanted something like: animals/cat.html home.html vegetables/carrot.html vegetables/broccoli.html contact_us.html Where there would be a more 'complex' ordering? Obviously I'd need to store the ordering info somewhere, but I'm not sure where. I guess I'd use a third table which'd store the identifier of each page and category and the order they should appear their given sub-category, and once all pages and sub-categories were loaded into the server-side data structure, I'd sort them by their ordering info to get the right order. How would I structure this ordering table? Something like: name (pk), type, order Where the 'name' attribute would be the name of the page or category, and the 'type' whether it was a page or category. (or instead of name, I could use ID)
View Replies !
PHPMyAdmin :: Database Not Showing On The Left Side Menu
I have mysql and php loaded on my apache server. (In house server, Linux). I created a new database by typing in the name in create a new database box in PHPMyAdmin. Well the first time I did that it created the database and went to the page where I add tables, which I did. Now, when I load phpmyAdmin again the database does not show up on the left hand side where all the other databases are listed. What gives? But when I go back again to recreate the Database I get an error saying database already exists.
View Replies !
Mysql User Profile Update Problem With Country Dropdown Menu Updates
I have trying to resolve this myself for a few days, but despite referencing two books and falling short on finding sample code on the web for this, I would wellcome your assistance to help me resolve this. All I'm trying to do is to have an edit account form where the user is able to change their country_id field in the user table, through a dropdown of country names that is stored in a country table with an (id, name, iso) fields. So far I have been able to do this: 1) register a new user and store their country_id field, 2) display the user's country name with all other user info on the "summary info" page, 3) and I have managed to display on the edit page in a single dropdown the users country 'selected' and all other countries. The only thing that is not working now is when I try to change the country from the dropdown menu on the edit profile page and click update, nothing happens, the users old country selection remains. I have the value="country_id" for both options as you can see in the dropdown, but its not working. I suspect the variables are getting mixed up somehwere, or I'm not calling them in the right way, but I feel like my head is going to explode soon I have included below the code. I look forward to hearing your advice. T Miro <?php if (isset($_POST['submit']) && $_POST['submit'] == "Update") { $query_update = "UPDATE user SET " . "first_name = '" . $_POST['first_name'] . "', " . "last_name = '" . $_POST['last_name'] . "', " . "nick_name = '" . $_POST['nick_name'] . "', " . "alt_email = '" . $_POST['alt_email'] . "', " . "mobile = '" . $_POST['mobile'] . "', " . "country_id = '" . $_POST['country_id'] . "' " . "WHERE username = '" . $_SESSION['user_logged'] . "' " . "AND password = (PASSWORD('" . $_SESSION['user_password'] . "'))"; $result_update = mysql_query($query_update) or die(mysql_error()); $query = "SELECT * FROM user " . "WHERE ............................
View Replies !
Pull All Records
if it were possible to write a statement in SQL where one could select several fields from a table and then limit the records returned by only displaying those where, say, FieldA (a varchar) contains a given short string which could be only a part of the field's contents. As long as a record has this short string in Field A, it should be included in the resulting set of records.Something like this: SELECT FieldA, FieldB, FieldC FROM TABLE Table1 WHERE FieldA *contains string* Is there anything in SQL that could examine the contents of a field for a partial string, and then return the records that have that partial string in that field?
View Replies !
Multiple DB Pull
Lets say there is a database of special users and a database of favorite movies SPECIAL USERS (username) bob jim FAVORITES (username - movie_title) bob - movie 1 kim - movie 3 jim - movie 1 larry - movie 2 jane - movie 2 How would I write a query that lists the most popular movies of special users without explicitly doing: SELECT * FROM FAVORITES WHERE username = 'bob' or username = 'jim' GROUP BY movie_title I want something like this: SELECT * FROM FAVORITES WHERE username = [all the usernames from the SPECIAL USERS DB] GROUP BY movie_title
View Replies !
Mysql Pull
I got this in my mysql databe table. a:1:{i:0;O:19:"test_Enclosure":4:{s:4:"link";s:36:"http://grabber/v/CAcpLiw4qt4.swf";s:4:"type";s:29:"application/x-shockwave-flash";s:6:"length";N;s:10:"javascript";s:2:"js";}} I want to pull out only the http://grabber/v/CAcpLiw4qt4.swf part?
View Replies !
Can Input Japanese, Can't Pull It Out
I figured out how to store Japanese characters by setting the collation of a particular field to utf8_bin. I can input Japanese characters, and I can see them just fine under PHPMyAdmin. The problem is that when I execute a query and print them to a web page, all I get is question marks instead of Japanese characters. This is while using the same browser that allows PHPmyAdmin to display the characters correctly. I added the following metadata to the <head> portion of the document but it didn't help: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
View Replies !
Code To Pull Amount
I'm certain there is a function to do this but I forget what it is... Say I am pulling values from the database, but I only want to pull like the first 10 chars of the value.. how do I do that?
View Replies !
Pull Hosting Plans
I am currently creating a web hosting website for a client of mine, for the packages and the order process we are using a script called "Auto-Host (http://www.idevspot.com/AutoHost.php)", which stores all the hosting plans into a mysql database. This is a great script and it does exactly what we want it too, the only thing missing is it doesnt create a page where people can view the hosting plans and click a sign-up button. Can someone please give me guidance on how i can get a page with all the hosting plans on please?, alternatively i am willing to pay somebody for doing this on my behalf
View Replies !
Populate Data
create table populate ( id int not null auto_increment, fullvalue int, netvalue decimal(10,2), primary key(id) ); I want to populate this table with 5 million records for testing purpose using only MySQL. (No PHP) How?
View Replies !
How To Populate Tables ?
I ve got a PHP form with 10 fields sending data to mySQL db. I need to send 5 of these fields to one table and 5 to the other. My question is : do i need to make 2 query to send (one after an other) to there respective tables ? or is there a way to send all the 10 fields in one time and then somehow dispach the field results to there differrent tables ?
View Replies !
How To Populate 2 Database?
I have 2 database (from 2 different server) which each has a table called student. The 2 tables have exactly the same structure. Now, say db_A always gets updated during the daytime and db_B always get updated at night time. How do I synchronize both of them? Say is there any statement I can used to populate db_B that whatever data that's in db_A but not in db_B will get insert into db_B at night. And vice versa?
View Replies !
Populate Database
I have a database on a host site that needs to be "populated". the file i am going to use, for mysql database, is large and "g-zipped". it was ftp uploaded and at root directory now. here are my questions: 1) the file to be used is approx. 340mb gzipped. will this file actually (physically) be at the root? or will all of it be contained w/in mysql database? the reason i ask is mysql database(s) is limited to 100mb/each, so i was wondering if the file i'm going to use will count as part of the database size? 2) if yes, to question 1)-can i unzip file at root? and how? *(i was actually told to upload gzipped file and ask hosting company to "populate" database for me.) 3) if no to question 1)- trying to bypass having hosting company take care of it for me, BUT am here to take suggestions.
View Replies !
Add One New Column And Populate
I have a mySQL table with about 12 million rows. Suppose I now compute one extra piece of data (a small integer) for each row, thus creating a file containing 12 million additional values that I wish to incorporate into my table. I know how to add an extra column to the table (ALTER) but I just cannot figure out how to populate the new column with the additional data WITHOUT deleting the old data? I guess that I can write 12 million UPDATE statements, but this seems pretty horrible.
View Replies !
Populate DB From A PHP Script
I have a MySQL dump generated by phpMyAdmin. Let's say > mydb.sql I would like to populate my database from within a php script using this file. Is there a command to do that or should a special function be written?
View Replies !
Populate A Db Into Wordpress
I have a database containing about 89758 record . Here is the example of the record . Structure Code: CREATE TABLE IF NOT EXISTS `plants` ( `id` int(10) NOT NULL default '0', `symbol` varchar(255) NOT NULL default '', `scientific` varchar(255) NOT NULL default '', `common` varchar(255) NOT NULL default '', `family` varchar(255) NOT NULL default '', PRIMARY KEY (`id`) Code: INSERT INTO `plants` VALUES (1, 'ABELI', 'Abelia R. Br.', 'abelia', 'Caprifoliaceae'); 1) I want to arrange the symbol in alphabetical order . 2) I want to populate / insert into wordpress database so that i can make a website
View Replies !
Pull The Last 10 Records From A Transactions From A Table
I'm trying to pull the last 10 records from a transactions from a table using this query: SELECT * FROM transactions ORDER BY timestamp DESC LIMIT 10 But I want to display the rows in ascending order by timestamp. I can't get the subquery below to work and not sure why: SELECT * FROM (SELECT * FROM transactions ORDER BY timestamp DESC LIMIT 10) ORDER BY timestamp ASC;
View Replies !
Pull Related Info Using Subqueries
I'm creating a tool to browse a database of movie listings. The browser pulls up 25 results at a time, and you can page through them using 'Next' and 'Prev' tools. Pretty basic stuff. Here are my tables: movies directors comments movies_directors movies_comments etc... (primary key is movies.id) But here's where I'm stuck: for each film, I need to pull the movie info in 'movies', plus any related data from other tables, like this: The Lord of the Rings | Peter Jackson | 3 comments Episode II | George Lucas | 0 comments Indiana Jones | Steven Spielberg | 15 comments I seem to run into problems when I try to join info from all of these related tables. If there's a match, great. But, if not (like a movie with no comments), the movie is excluded from the result set. I've tried all sorts of SQL queries to make this work, but nothing seems to do the trick. SO, HERE'S MY QUESTION, IS THERE ANY WAY TO DO THIS QUERY WITHOUT SUBQUERIES/MYSQL 4.0? Or would the best approach be to use PHP to do all the subquery lookups?
View Replies !
Pull Similar Data From Two Tables
I need a query to search two seperate tables for similar data and return them in one result. I know you can do multiple select statements in one query but I dont know how to exactly organize them into one result. Does anyone know how to accomplish this.
View Replies !
Result Pull And Rating Sort
I have two databases. What I would like to happen is when I have a summary of products, I would like the query to pull the info from the product table and based on the id from that table cross reference with the reviews for that particular product and calculates all the reviews for that product into a single percentage. So when I access the assoc array from PHP I would like to see : Array(Array(['id'] => '2', ['prod_name'] => 'gummy bears', ['rating'] => '72'), Array(['id'] => '57', ['prod_name'] => 'socks', ['rating'] => '52')).
View Replies !
How To Pull Data From Multiple Tables
I have a db, with several tables in it, I have now reached to the point where I need to pull data from several tables. What is the best way to do this? Should I put a column in each table, and then insert a unique key in all of them at the time the record(row) is being created? If this is the way to do it, when I am putting the unique key in each table would I just do an insert in each of the tables?
View Replies !
Pull Data From Multiple Tables
Can you pull data from 2 tables in the same database onto the same page? What about more than 2 tables? Here is my dilema: I currently have a database with 1 table, and a ton of rows. The information is property information, and each property has multiple empty suites. As of now, I have columns for Building Name, Address, and then columns for Unit Type A (for the first unit), Rent A, Type B, Rent B, etc.... I was wondering if I would be able to put the listings we have into thier own property table, and then one bigger table of all the properties individual information. Keep in mind I need to call all tables together on my portfolio pages, so I would be connecting to quite a few tables at once. Or my other option I was thinking about was to just have 2 tables: 1 Buildings info, and 1 units info. Which of these would you do, or how would you organize this data.
View Replies !
Populate A Table From A List
I am trying to populate a mysql table from the contents of a <SELECT> list using PHP. The list is populated from another list and from there all the items need to be saved to a table.
View Replies !
Populate Linked Tables
I have a single web form which creates a record in TABLE A. Within the same form I wish to link this new record to an existing record in TABLE B. Because this relationship is likely to be MANY TO MANY, I have created a linking TABLE C to hold the keys from TABLE and TABLE B. My question is, how do I insert the new rows to TABLE A and TABLE C at with a single form submit when TABLE C requires the primary key from TABLE A?
View Replies !
Auto Populate Table
I would like to auto fill a table eg add 10,000 rows to test for speed id | text ---------- 1 | r1 test fill 2 | r2 test fill 3 | r3 test fill , | ,,,,,,,,,,, 9999 | r9999 test fill.
View Replies !
Using Php And MySQL To Populate A Form
I am trying to use php to pull information from a table in mySQL and place it into a form. i have tried everything i can think of to do this. There are two files being used a .inc.php and a tpl. inside the .inc.php file is all of the php codeing and the .tpl file should call the information from the .inc.php. I placed the a from inside the .inc.php file using an echo tag to make it appear and it did but it wont show up in the correct place.
View Replies !
Regular Expression :: Pull 3 Or 4 Digit Numbers
I would like to pull all the model number from my products table that are strictly only a 3 or 4 digit number ie: 034 or 3542 or 0243 or 934 etc Can someone advise me on how to construct a regular expression to give me the data I need?I have tried the following but it wasnt 100% accurate: Code: products_model REGEXP "[[:<:]][0-9][0-9][0-9][0-9][[:>:]]" or products_model REGEXP "[[:<:]][0-9][0-9][0-9][[:>:]]"
View Replies !
Pull Info From One Database To Save In A Session To Push To A Different DB
I'm building a dynamic site that has 3 data bases. One DB contains all of my store info ID#, Name, Address, Phone. Another DB contains member info ID, Name, address, email,phone,etc... The 3rd DB Tracks when a user logs in and logs out at a store. This DB has the following columns Store ID, Member ID, log in time,log out time, time in store. The stores log in in the morning that starts a session-I need the session to pull the store's info ID#, Name,etc... so when a user logs in, in the store. The login page inserts the store ID, Store name, and user ID into the 3rd DB. There are a lot of stores how do I get the store variables to be inserted into the DB?
View Replies !
Pull Data From 2 Database Tables Into 1 Table On My Site.
I got 2 tables: a dev_tasks and a task_history table. The task table has to record information about the task I am working on AND the history table is for the task history logs. I am trying to display info from both tables into 1 table on my site. Most of the info will come from the dev_tasks table BUT i want to dedicate on column of the displayed info for the latest log made to the task_history table. The common column to both tables is the 'taskid' column. What would the query look like to pull the info from both tables, knowing that the taskid is common to both and that I want to display the last log per tasks from the task_history table?
View Replies !
Creating An Insert Trigger To Populate Another Table
I'd like to create an insert trigger such that whenever a new record in the table arrived, the trigger will fire and insert it into another table. Here's the syntax: create trigger table1_ai after insert on table1 for each row begin insert into table2 (select c1,c2 from table1); end; then run: insert into table1 values (1,"test"); insert into table1 values (2,"test2"); insert into table1 values (3,"test3"); master>select * from table1; +------+-------+ | c1 | c2 | +------+-------+ | 1 | test | | 2 | test2 | | 3 | test3 | +------+-------+ 3 rows in set (0.00 sec) master>select * from table2; +------+-------+ | c1 | c2 | +------+-------+ | 1 | test | | 1 | test | | 2 | test2 | | 1 | test | | 2 | test2 | | 3 | test3 | +------+-------+ 6 rows in set (0.00 sec)
View Replies !
Adding A Date Field, Need To Populate The Fields
I have a table and until now there is was date entry for the fields. I have added a timestamp (column "time") and from now on, every time I insert a new entry, the date/time will be recorded. The thing is, I want a date/time to exist for the old fields. I have about 250 fields and I want each field to be assigned a timestamp based on the fields alphabetical order (ordered by "title"). So, field with title "aaaaa title" will have a timestamp of today. A field with a title "zzzz title" will have a timestamp of 250 days ago. It doesn't have to be exactly like this. My main goal is to assign dates to my old fields. Anyone know how to do this?
View Replies !
|