Display From Mutliple Tables
I'm sure this is an easy one. I have links to a page which grabs a name from table and inserts the data to the page.....Ex: domain.com/pagename.php?view=NAME which works fine.
I am trying to insert data also from another table and can't seem to get it to work. Here is what I am doing.....
I am getting the data using $rs=mysql_query("select * from tblxxxxWHERE name='$view'"); which works fine but then I am also trying to get the data based on the same $view as below..
$rs=mysql_query("select * from tblyyyyy WHERE team='$view'");
Any advice as the second one will not display any results. I am learning bit by bit and it looked to me as though this would work but obviously does not.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Retrieving,Sorting & Displaying Multiple Results From Mutliple Tables
I need to know how to run a php / mysql query to do the following. I have 1 database (lets call it "database" for now) within this database there are multiple tables ("News","Feature","Header_feature") For NEWS I need only the 6 latest results pulled from that table and displayed in a table. The "News" table has the following columns "ID","Title","Date","Body","Image" For Feature I need only 1 result retrieved from the database and displayed under the variable $ticker as it will display as a scrolling marquee within a table. The "Feature" table has the following columns "ID","Ticker". For Header_feature I need only 1 result retrieved from the database and displayed in the following manner <a href="$link"><img src"$header_feature">[/url] The "Header_feature table has the following columns "ID","image","link" How would I code this all into 1 page? I cant seem to get the query to do everything I want it to and display the results properly. You can see what I have so far at www.getlivemedia.com The $ticker is the scrolling text near the top of the page and the news is obviously the bulk of the page and $feature_image is the broken image.
Linking Tables To Display Data?
I want to link two tables together to create a list. The unique value loppnum appears in both tables. I need to look up its corresponding value for each entry. table1 has 2 cols A Jag D Cht E Lio P Mkn Q Res table2 has 2 cols MN A PL D RT E PO P LM D NB D In the first table both values are unique In the second table the first value is Unique Now I need to display a list of data in this form MN Jag (Displays second table data and looks up value of A in first table) PL Cht (Displays second table data and looks up value of D in first table) RT Lio (Displays second table data and looks up value of E in first table) PO Mkn (Displays second table data and looks up value of P in first table) LM Cht (Displays second table data and looks up value of D in first table) NB Cht (Displays second table data and looks up value of D in first table) I have made a start $upgcollect='SELECT * FROM table1 ORDER BY scfmfor' $upg1=mysql_query($upgcollect); $ml_collect='SELECT * FROM table2 ORDER BY loppnmn' $upg2=mysql_query($ml_collect); That gives me two variables with complete table data. The rest of this is beyond me at the moment.
Display Results From Multiple Tables
I have two tables, one table (article_cat) has four fields ("id", "title", "feature1", and "feature2") and the other table has six fields (articles) has ("id", "cat_id", "title", "content", "feature1", and "feature2"). I am looking to display the "title" from the "article_cat" table that has "feature1" with a value of 1. And I want to display beneath that all the "title" results from the "articles" table where "feature1" has a value of 1. I have tried this a thousand ways with no luck. Code:
Passing Mutliple Variables
I'm building a website using just the index.php and includes for the different pages. When someone clicks the link, it will send itself index.php?content=gallery.php so it changes the content. My problem comes when the gallery comes into play. Here is the code: <?php if(isset($picture) && $content=='gallery.php'){ echo "<img src='gallery/".$pic."'/>"; }else{ echo "Please select a picture to view on the far right"; } ?> </div> <div id="galleryNavTable" class="bodytype"> <table align="center" width="80%" border="0" cellspacing="0" cellpadding="0" > <tr> <th scope="col"><span class="style1">Select an Image</span></th> </tr> <?php //The source Directory of the images $d = dir("gallery/"); while($pic=$d->read()) { //the numbering beside the row of links $i=$i+1; if(($pic <> '.') AND ($pic <> '..')){ ?> <tr> This is where my trouble comes. How do I send the variable to the proper part in the a href tag?
Query Array, Sort Results And Display In Seperate Tables
The problem I have it breaking out the results and displaying them (broken out) alphabetically in seperate tables. For instance, I have generated (bookmarked) tables, one for each letter (A-Z) and want to display all recordsets with say, last name beginning with "A" in one 2 column table, "B" in another 2 column table, and so on... each table would have two columns (with 2 background colors alternating), each cell containing values of one recordset. Even more tricky is if I have an odd number of cells, still generating the last cell with empty values (for asthetics). And can anyone say "sort" (yes, I am nuts)? The ability to sort the whole mess by any column value. I have looked at freeware and other third part apps, but they can only do what I already can do (mine is actually cleaner) but not as complicated.
Generating Multiple Alternating Columns And/or Tables Within Tables
I am having a little bit of trouble generating the code for a table with 2 columns. The columns contain tables within themselves. Not sure why as that part was an existing design. Here is the output so far and it is correct but not how i want it to be (i'll explain) Code:
Tables
I was able to get MySQL to output to an HTML Table with the following code. I was even able to add color to the columns. The following code causes the color to run vertical. Anyone have suggestions on making the color run horizontal? Sorry for the length, but you some might find this useful. Code:
Tables &
I would like to display some php output using the table in the first code. I copied the table I'd like to have it display, with the appropriate "$whatever" in each cell. Code:
SQL Tables
I am using php to create a form. I would like that forms information to go into a database. When creating tables where the information that i entered into the form will be stored, where exactly do i place the code for creating the tables. Do I have to create a new php file? and how do i link the information from the form to the tables. <html> <title>Service Station</title> </head> <!--checks to see if all field are entered--> <SCRIPT language="JavaScript"> <!-- function validateSelect(){ var errors=""; var form = document.customer; var first = form.first; if(first.value==""){ errors+=" You must enter a first name."; } var last = form.last; if(last.value==""){ errors+=" You must enter a last name."; } var add=form.add; if(add.value==""){ errors+=" You must enter an address."; } var city=form.city; if(city.value==""){ errors+=" You must enter a city name."; } var province=form.province; if(province.value==""){ errors+=" You must enter a province name."; } var phone=form.phone; if(phone.value==""){ errors+=" You must enter the phone number's area code."; } var phone2=form.phone2; if(phone2.value==""){ errors+=" You must enter the phone number's next three digits."; } var phone3=form.phone3; if(phone3.value==""){ errors+=" You must enter the phone number's last four digits."; } var make=form.make; if(make.value==""){ errors+=" You must enter the make of the vehicle."; }
Tables
i want to select categorys from the table forumtutorial_cats and then it will select forums from forumtutorial_subforums where catid=the catid from the previous query. in a table it would list the category name then all the forums underneith it then it would list the 2nd categorys name and the forums underneith it. it would keep doing thin until it didn't find any more categorys. i am not sure how i would get it to do this.
Tables Next To Each Other
I use this code to make a table with two rows, and four columns, all together. <tr> <td>top</td> <td>top</td> <td>top</td> <td>top</td> </tr> <tr> <td>bottom</td> <td>bottom</td> <td>bottom</td> <td>bottom</td> </tr> How would I make it so that for each column, it displays one of the 4 most recent rows in my database? The most recent rows in my database can be determined because the row with the highest id (AUTO_INCREMENT) is the newest one. I need to select the most recent 4, and display the most recent four on those tables. For "top", I need it to display " . $row['upload_preview'] . " and for the "bottom" I need it to display " . $row['upload_name'] . " Any ideas how to accomplish this?
Question About Tables
I have what may be a simple question, but here goes anyway. I need to split my data up into two columns, i.e.: [data] [data] [data] [data] I need to do this while I'm looping through the database. I can't seem to figure out how to switch to the second cell while in the midst of the loop.
Two Tables To Sort
I have two tables. Table 1 has the following columns: id, number and headline. Table 2: id, number, description. What I need to do is sort the rows from both tables to one page sorted by the field "number". I had two solutions: 1. Two queries from which I create one array. The array can then be sorted with PHP's function. The problem with this is that a "number" can have the same value in both tables. 2. Creating a temporary mysql table, inserting the data there and then selecting it ordered by the number. The problem with this one is concurrent users. If the table exists already and another user starts shoving "his data" to the table it all gets messed up.
Dynamic Php Tables
As you'll notice, each new result appears in a new table, which is very annoying. I am trying to make it so that all ther results appear in 1 table. This is what I have so far; <? //error message (not found message) $XX = "No Record Found"; $query = mysql_query("SELECT * FROM $usertable WHERE $metode LIKE '%$search%' LIMIT 0, 30 "); while ($row = mysql_fetch_array($query)) { $variable1=$row["Model"]; $variable2=$row["Creator"]; $variable3=$row["Title"]; print ("$variable1, $variable2 ,$variable3"); } //below this is the function for no record!! if (!$variable1) { print ("$XX"); } //end ?> Can anyone help please?
Delete From Many Tables
I am trying to delete rows from a mySQL DB that consists of multiple tables. I am trying to use a function PHP Code:
Tables, Images, Php, SQL
I am setting up a page which displays thumbnails. I am a little bit confused on how to do this, so I'm going to ask you guys. I want my thumbnails to be in a table, say about 6 thumbnails across because it creates a table row. For example <tr><td>img1</td><td>img2</td><td>img3></td><td>img4></td><td>img5></td><td>img6</tr></td> <tr><td>img7</td><td>img8</td><td>img9></td><td>img10></td><td>img11></td><td>img12</tr></td> Each image in their own cell, 6 across before creating a new row. First a couple questions. How would I set up MySQL tables to do this? Add a <img src> in each row? How would I get only 6 to span before creating a new row?
How Can I Upload DB Tables
Anyone help me, I am new to this PHP and MySQL. My Problem is In local server we will conect the database things using mysqli_connect($host,$user,$pass) or die(mysqli_error($link)); mysqli_select_db($link, $db) or die(mysqli_error($link)); But in live server How can I upload or configure the database tables and all?
Getting A Query From Different Tables
I have different tables with product. Every tables is a different category, and has prod_id, name, description, price and already sold(int, how many already sold). I want to make a top 10 most sold products. For this is have to make a query from different tables, sort by 'already sold' and limit to 10, but how to do this? This all in mySQL/PHP3.
Tables (PHP > JavaScript > SQL )
I have encountered this problem, which my lack of knowledge doesn't allow me to solve. The idea is to have table of one row and three columns, like this: ¦ "image" ¦ [url box to image (http://.../.gif)] ¦ "submit image" ¦ where: 1. In the second column url address to image is input manually by user. 2. By pressing "submit image" (.gif button), data from the second column is altered in SQL table and simultaneously "image" in the first column is reloaded to new value, that was just input in SQL table. The idea is to reload only "image" in the first column and not the whole page. I believe that the "image" should be located in iFrame, but not sure. Can anyone give an example of such a magic "submit image" button, that will do all procedure required without reloading the whole page?
HTML Tables
I'm new to php and i need ur help. I have HTML table that is made form 4 columns and x rows. I am wondering if there is any function that could get data from specific cell into variable? Example: I have some variable $var and i would like to put data from some cell x,y into that variable. Can someone help me?
Matching Up Tables
I have two separate tables in my database - one with information and one with photos. I would like to link the two of these tables together. So when you go to an information page there is a small link that has a link to a photo for that fish. And vise versa when you go to the photos page. The way I am going to have to link the tables together is by their scientific name. Because that is the only thing that they have in common. I tired something like this: Code:
Join 5 Tables
i need to join together 5 tables in a psql database i have made. the problem is that i cant seem to find the correct sql to perform the join. the tables i have are group, person, contacts, movements and treatments. group and person are connected by a group_id, established in group, each entry in the person table also has a group_id. the other tables are connected by person_number, established in person and a foreign key in all the other tables.
Changing Tables
I have my main index.php page and I've been looking around for the simplest way to do this but haven't been able to find anything that suits the purpose. Perhaps you guys can help, since you're the best.. All I want to do is switch the table that is in the middle of the page that displays the content of the page. So if someone clicks on, for example, index.php?files it'll change the table to the files table that I have in an html file or something.
Dynamic Tables
I am creating a dymanic website generator in php/mysql and I have a particular question. I have the following sql statement: $sql = "CREATE TABLE one ( Email CHAR(50) NOT NULL, First_Name CHAR(25) )"; and it works just fine. I need it to act dynamically and vary with different contents that are being submitted by a form. In short, I need the name of the table that is being created to be a variable and not a static name. Here is an example: $sql = "CREATE TABLE $wstitle ( Email CHAR(50) NOT NULL, First_Name CHAR(25) )"; Can this be done in any other way that the above example because it does not work.
Arrays And Tables
What I am trying to do is get the XML data from a newsfeed and place the itemid,time,heading,date,contents into database table. I'm nearly there with this but I am unable to get the itemid into the database. Code:
Generating Tables
I have a section of a web site that is for downloads of photography. There are seven different subject to view and I have these subjects and the corresponding URL's where their photos are stored in a mySQL database. I have no problems using the database to tell me how many photos are in the database, how many by subject, and even there names. I have been able to call them up and display them with no problems. The problem I do have is I want to generate a table, 6 columns wide (736 pixel width as well) and have php add the photos to it - generating new rows of the table on the fly with the found set of photos it pulls from the database. I just do not know how to format the code to put in my while statements that when it fetchs all the rows in the found set to insert them into the cool table that I need. My database name is Tphotos and the table is photos. I have defined the following fields as well - subject, photoname, alttext, lowressource, highressource. I pull the low res in first with alt tect and the link to the highres and open it in a different window.
Can't Post To Two Tables.
I have an input form which should post information to two tables. The first table is receiving the information, but the second one isn't. I have been looking at this for ages and just can't see the problem. Code:
How To Relate Tables
I know there is a "easy" way to do this but Im stumped and I hope you can help. I have 2 tables in mySQL. Table one is pages, table two is bb. Pages has a field in it call bb_id. I want to be able to show the corresponding row from bb with the appropriate page_id. For some reason it will dispaly the data from the last row from the bb table. I've looked into joining them but Im new to PHP and had no success. Could someone explain how I'm supposed to these relate two tables?
Two Tables, Same Value, Same Select?
I have a two lists of people, (name) in two tables, and I want to give a bit long list of all these people. Below I have my current code, but its useless because its one list split in two, half way down you hit the As and Bs again! Code:
MAINTANCE OF TABLES
Anybody know a application write in php that across a database generate a web application for maintance of tables?.
Tables, Frames, CSS Or?
I have been working with PHP now for a few months and would like some knowledgeable advice on laying out PHP based web pages. I have noticed that some web pages that use PHP also use frames...like phpMyAdmin for instance. This gives the page easier readability when refreshing (do to PHP code) as the entries page does not update. But I was told many years ago by an elder that frames were not to be used...so what is the preferred layout for PHP pages?
Query Different Tables
I've got a DB with let's say 3 tables (each registered user has one)... and in each table there is let's say id, username, totalmoney, amountA, amountB... I also have one fix external paramter let's say "5"... I need to query the different tables, in such way that I multiply 5*amountA, 5*amountB, add them both to totalmoney into a new variable let's say $totalwealth... then query the other tables and make an array with the $totalwealth values... Can this be done, in a relatively short script or do I need to write one for each table, insert into a database and then compare?
Higlighting Tables In Php ?
can someone help me change the below table in php so that when a user puts their mouse over the table changes to a different colour?
Inserting Into Tables
I have a form that gets filled out and the data is stored in a DB. I have a question regarding the insert part. Here is the structure of some of my tables: Code:
PHP And Html Tables
i have come across a problem that probably has an easy fix....I have a database for a product review form now everything works except that when i make an html table that i specify to be 500px in width and place the review data from the database into that table the words do not wordwrap instead it widens the table so that it is at 2000px or whatever size the text needs it to be.....i have been looking everywhere for a fix and have found nothing..
Repeating Tables
I am trying to create a image gallery based on a tutorial found on http://www.php-mysql-tutorial.com/image-gallery/ and I need to put image, title and desc in seperate rows so they are aligned and not wonky if one has more text than the other but can not seem to get it. Code:
2 Tables In 1 Table
Im creating a login page, I want a table to hold 2 tables side by side. However the 2 tables inside the table have a different number of rows so the heading do not align correctly which will make the page look funny. Is there anyway to align the 2 inner tables? I have tried adding another row but it still makes the table look odd.
Tables From HTML
im not sure how to change this line of code in html so that i can use it for my tables to change color when a user puts their mouse curser on. This code below works in html but when iv tried to use it in php but doesnt work...? Code:
Mysql And Tables.
I got a php file that imports it's info fram a database. And from that info it creates a table. This is for a game. And if it's more than one game running it creates another table below the first one. Like this: Code:
Resizing Tables
I was wondering if anyone can show me a PHP script (My php scripting skills are pretty basic) that would calculate the height of a table (the height of the table isn't defined, it resizes with content), divide the height by 142, round the answer up to the nearest whole number and then multiply that answer by 142 before finally setting the height of the table in question to that final answer. e.g. Table Height is 390 Dividing 390 by 142 gives 2.75 (roughly) Round 2.75 up to 3. Multiply 3 by 142 gives 426. Set the table height to 426.
Inserting In To Two Tables
I'm creating the createteam.php file and want to create a record (the team) in the teams table and then create a record linking the team and the user who is creating the team (i.e. showing the user is in the team). Code:
Pagination Of 2 Tables
I have 2 tables - one of these tables contains an index type structure of reference numbers. From this list of reference numbers, I pull those which match certain WHERE criterea. Then I run a query on the 2nd table and pull data from it where the reference number matches, but again this has WHERE criterea relevant to values in the 2nd table. The only problem is this...pagination works fine until it jumps into pulling data from the second table. It is set to pull out 6 results in total for a page, so I pull out 6 results from the first table. This is where the problem comes because then the search in the second table is only within these 6 results, and so can return anywhere from 0 to 6 results (it returns only results which pass the 1st query for table 1, then narrows them based on the type using data in the second table. To better illustrate - you have a tube of smarties, you pull out 6 blue ones as you only want 6. Then you get rid of any that are chipped and give the ones left to your mate (pft, as if. e-numbers are for me!!!) Obviously my pagination method is completely wrong! So yeah, my pages don't always return 6 results if the search criterea is to specific, as it only searches within 6 results at a time because I want it paginated. Anyone got any ideas on how I can solve this problem so that I always have 6 results being output on the page? (Btw, if this is too confusing let me know and I'll try to explain better. Makes sense to me, but then I'm the one who's asking the question!) Here's my code:
Counting In Tables
Well basically what i want to do is this: I want to find an ammount of the same thing and echo it once but next to it have how many of that thing there are in a table. So say i have 10 wooden swords i want it to echo the image of the sword once and show x10 next to it to show that it is in the database 10 times.
Sorting Tables
I have the following script which first gets a list of users out of one table, it then uses this list to get the stats for each user out of another table I would like to know how I can sort the table by $cmb DESC (or even let the user decide how to sort it via a dropdown menu but this would affect $rank?). I dont think i can use sql as there is 26 entries per user in the stats table. also is there an easier way of doing this? I always seem to do everything the long way. Code:
Connecting Tables
I have one table in a database that is essentially stuff from a commenting script. Things that are posted in it are name, timestamp, id, etc... After this I have another table in the same database that is like a comment system for the first database with id, name, time. How can I set it up so that comments from the second database are only shown if it matches the id from the first database that the person commented on.
Insert Into 3 Tables
I am try to insert data from a register page into 3 tables in an access database, but i am unsure on how to do this. I have managed to insert into 1 but dont know what to change to get it to send the other data frpm the form into the other 2 tables at the same time.
AVG() Through Multiple Tables?
I'm trying to get the average of several columns [all with the name of SIR] in several different tables, and display the result. My code is giving me a "please check the manual depending on your MySQL version.." error. Here's my code:
Comparing 2 Tables
SELECT userid from userstable Then check a table named Hospital... for userid Then what i need to do is a while loop which will "only" while loop through users that are not in the hospital table but are in the user table..... meaning only people out of hospital will be queried but "all" out of hospital users must be ran through the while loop.. is this possible in one query?
Count Row From Two Tables...
I'm making a forum software for my website and I want to put the number of replies for the listed forum. How would I count the number of rows of the replies table that are in the certain forum?
|