Comparing Data In Two Tables To Find Missing Data
I have a small web site where people can register and create an account, and then add links to our site.
I have two tables set up. One holds registration data -- user_id, username, password, date registered. The other holds link data -- link_id, user_id (to track which registrant added which link), and URL.
Some people have created an account, but have never posted a link. I'd like to figure out who those folks are but I'm not quite sure about how to do that.
If I did this manually I would get a list of user id's from the registration table and then look at the link table and check off user id's in that table. The unchecked user id's are my target group.
View Complete Forum Thread with Replies
Sponsored Links:
Related Messages:
Comparing Data In Two Tables
if anyone would be able to help me with a problem i'm having, I currently have two tables, in a database, one is Called products, and one is called groupproducts, their are multiple groups which can be added to or removed from. I want to creat a screen which lists all of the products and then places a tick in a tick box if that products in the specified group.[color=blue] >From this i'd submit it to another page which update the group[/color] products. I'm currently doing the same system but having to edit it on a product by product basis which is very time consuming.
View Replies !
View Related
Comparing Form Data To Mysql Data
Im interested in building a script that would take form data, a variable like an address, and compare it with a known address in a mysql table (called addresses), then if there is a match log the address information in a separate table called (addresslog), and return the visitor to a certain page. If there is no match between the address entered in the form and known addresses then the information is still logged into the addresslog database but the visitor will be sent to a different page. I'm still new to this, and am working through the logic and the syntax, but I believe I'm close. It's still not working, I have all of the proper tables, maybe I'm way off with the coding so I thought I would seek out some expert advice. Here's the entire script with as much explanation as I could give. PHP Code:
View Replies !
View Related
Comparing Database Data And New Data
I am trying to create a PHP script that reads in a file, parses it for the data I want and compares it to the data I have in a database. The data is points and ranking information for a Folding@Home Team. Every week someone creates a news item with points gained by each team member for that week and other info. This is done manually and takes a lot of time. I hope for my script to automate as much of it as possible. The script was to run as follows: Download and parse latest statistics into 2D array Compare usernames in array to usernames held in Database Any new usernames and their respective points/rank to be added to database Compare points in 2D array of each user to those held in database. Output username and points gained I thought I had a working script until I actually tested it on real data, and realised I missed something rather obvious - the order of usernames from the parsed file is not going to be the same order as in my database - due to people moving up and down the ranks. So i can't just get a recordset from the db and run a simple loop to compare it to the parsed data. I am not sure how to go about comparing the database information with the parsed data that works around the fact the data could be in any order. The only thing i can think of is: foreach item in $parsed_data_array query database for $parsed_data_array=>username if(number of results == 0) build new insert query for current username else continue I don't know if this works [haven't tested yet] but I can't help feel it is a little DB intensive. There could be up to 200 queries being sent to the database. This can be minimized by adding extra criteria, like ignoring inactive users of course. Is this a viable solution or is there a much better way of doing this?
View Replies !
View Related
Data Goes Missing
I am in the process of setting up a "data management area" for my website using Apache/PHP/MySQL. As the table expands to include information, some of the data previously entered disappears As an example I have 23 items within the table, some hold small amounts of Data (6 characters), others locations, owners, etc. Hold data up to 100 characters. Now it seems that if I put too much data in one record, some of the data previously entered disappears. Not every time only occasionally though My question is, can the amount of data entered into the record be limited? If so, how do I increase the amount of data allowed.
View Replies !
View Related
Fetch_array And Missing Data
I am using mysql_fetch_array and it is pulling the right data however, when I echo $location[0]; after $location = $row["locationID"]; it only shows the first number of the data that I am trying to get to. Anyone know why this is? Code: while ($row = mysql_fetch_array($locationQuery)){ $location = $row["locationID"];} echo $location[0]; results: 6
View Replies !
View Related
Form Data Missing
I have a texarea which gets dumped into a posgresql table via a POST from a form. The problem i have is that sometimes the form data is missing when the post is done. Should i be striiping certain characters fron the text area before inserting into the database.
View Replies !
View Related
Database Data Missing...
For one of my client,the data from a table is missing time and again. It is reported that client didn't changed anything but despite filling up data,we seeing this situation occuring. Can anyone say what may be issue and how to solve it parmanently,since filling the data again and again make no sense?
View Replies !
View Related
Missing POST Data
i am submiting post data to a php script and i would like my users to be able to submit all html tags. when i was testing my script i found that i wasnt able to recive any data enclosed in <style> tags.
View Replies !
View Related
Comparing Data From A .txt File To DB Info.
I have a txt file that stores separate lines of information. Here is an example of one of the lines. Western Pleasure || height:>= 15, discipline:== 'western' That is just telling me the qualifications of the "Western Pleasure" show type, which is that the height has to be greater than 15 and the discipline has to be western. Now I am trying to take these qualification statements and compare them to values in the database, if both qualifications match up, I would like to add the word "western pleasure" to an array. Here is my current code:
View Replies !
View Related
Missing Data In A Three Part Form
I have a three part registration form which uses sessions to pass the field values between each stage of the application form and then submits all the data to a mysql DB. The third page of the form takes a long time to fill out as there are a lot of questions on it. By the time someone has filled out page three there data from page and two seems to have been lost as all that gets written to the DB is data entered in the third page and nothing from page one and two of the form. Why does this happen and how can I prevent this from happening so that I am guaranteed that all data is written to the DB?
View Replies !
View Related
Find Data In File
I've looked on Google and through PHP.net but I can't seem to find what I'm looking for. What I'm trying to do is open a file through HTTP, then PHP searchs the file and where it finds lets say for example something * something else Where it knows what to start looking for, and what to end looking for and it takes it all the in between and puts in in a variable
View Replies !
View Related
Find Data Between 2 Characters In A String?
I want to find and display data found between two characters in a string. Example> Form sends the following to the .php page.... $data1 = "The Domain Name [somedomain.com] has been renewed"; I want to be able to pull out and display only "somedomain.com". Example, I want a variable called $domain to only hold the domain name itself, without the brackets or the text. somedomain.com I have investigated function strstr(). $data1 = "The Domain [somedomain.com] has been renewed"; $domain = strstr($data1, '['); OUTPUTS: [somedomain.com] has been renewed I can then use substr() to remove the first "[". $domain = substr("$domain", 1); OUTPUTS somedomain.com] has been renewed But, I am stuck, conceptually, with what to do to trim the end after .com . Note, somedomain.com will change. One run, it could be somedomain.com and the next, it could be "somethingelseentirely.com". Thus, the character length of that part of the string will change each time.
View Replies !
View Related
Getting Data From 3 Tables ?
SELECT r.name, COUNT(a.event)/COUNT(e.event) AS total FROM Attendance AS a, Ratio AS r, Event AS e WHERE r.name=a.name GROUP BY r.name I do this in mysql and the process hangs forever like an infinite loop. I dont know what im doing wrong. I event try adding LIMIT 5 and it still hangs so something is wrong. Code:
View Replies !
View Related
Getting Data From Two Tables
I have 2 tables which have the following structure: table 1 id | client name table 2 id | title | client_id | .....more cols I want to reference both tables, list the distinct client_ids from table 2 showing the client_name which appears in table 1. Code:
View Replies !
View Related
Data From Two Tables
I am attempting to work with my first normalized database (everything else I have made was simple little PHP projects that I never had the need for it). Basically I am trying to pull data from multiple tables that needs to match up. Right now I have 10 results per page and had no problem getting that to work. I have tried a few approaches to pull the second tables data and match it to the first query. Code:
View Replies !
View Related
Data From Two Different Tables
I am trying to take data from two different tables. They are not related to each other by any means. $result = mysql_query("SELECT display, IPA, time FROM users WHERE username= '$username' UNION SELECT * from translations where lang = '$lang'"); while ($array = mysql_fetch_array($result)) { .... Actually I am trying to get the real name (display) and IP address (IPA) from users table and the translations (*) from the translations table based on the brower language (lang). The lang variable is comming from the previous script. And I don't know how to take the data from two different table using one query.
View Replies !
View Related
Data From Two Tables
I am a relative novice with a simple website using PHP and MySQL. I need to create a query that involves data from two tables. I have given just the relevent tables and columns below. Table 1 called horse_name contains columns horse_id (int), horse_name and sire (both varchar). Table 2 called results contains columns horse_id and prize_money (both int fields). I've done a query which lists all the horses and total prize money each has won with a sum query and group by horse_id but now I want to do a query that will list each sire and the total prize money won by all of their individual offspring.
View Replies !
View Related
Inserting Data Into 2 Tables
I've got this products page form and what I have is two tables to insert the data into, about_products,about_urls. What I am trying to achieve is to insert info into about_products table and the URLs associated for that product. The thing is, is that I'm having trouble getting to insert the URLs for that product. Note that the product form is duplicated 8 times. PHP Code:
View Replies !
View Related
Pulling Data From Two Tables
Basically the end result for this is to manage rental properties. "properties" is the main table that handles most the information. It has about 50 rows so I am not sure you need all the rows, but if you do let me know. The second table has floor plans. I named this table "floorplans". It has several rows: PlanID PropID - this is the same one from the properties table that they both share PlanName Size Bedrooms Bathrooms Den Price PriceTo Deposit SqFt UnitImg I am attempting to build a cataloging system and display the results as a set on the page. I am listing 10 items per page with various sub info on that page as well. Most of this information is in the primary 'properties' table, but I would also like to be able to list items from the sub table that match the primary ID all on the same page. A detailed page containing all the information on the subject would be easier to do since I could just call the ID from the $_GET on two separate querrys but I am trying to make a page to give previews before clicking through.
View Replies !
View Related
Extracting Data From 2 Tables
i want to extract data from 2 tables. The first table, called club, has among others the colomnames: C_id and C_name. The second table, called match, consists of M_id, C_id_home and C_id_out. Now I want to show the matches from match where C_id_home and C_id_out correspond with club.C_id so that I can show the club by name instead of by (id)number. This is my code so far: SELECT * FROM match, club WHERE match.C_id_home = club.C_id AND match.C_id_out = club.C_id ORDER BY match.M_id DESC but this doesn't work properly. In the end I want to show a list that looks like this: C_name(C_id_home) - C_name(C_id_out) Any solutions?
View Replies !
View Related
Inserted Data Into 2 Tables
I have wrote the following queries but the values being entered into the table are not right (see tables below). The project_ID isn't the same in both tables: PHP Code: if (isset($_POST['submit']) && $_POST['submit'] == "Create Project") { if ($_POST['lecturer_role'] != " " && $_POST['SK_ID'] != " " && $_POST['project_name'] != " " && $_POST['project_description'] != " ") { mysql_query("INSERT INTO student_project (project_ID, lecturer_role, LK_ID, SK_ID, project_name, project_desc) VALUES('$projectid', '" . $_POST['role'] . "', '" . $_SESSION['user_logged'] . "', '" . $_POST['students'] . "', '" . $_POST['project_name'] . "', '" . $_POST['project_desc'] . "') ") ; mysql_query("INSERT INTO project_assess ......................
View Replies !
View Related
Insert Data Into Two Tables
I am working with a preexisting script which uses a form to submit data to a database. It works fine, but I want to submit some of the form data to one table, some to a second table and some to both tables. Code:
View Replies !
View Related
Loading Data From 2 Tables
I'm trying to load a list of individuals from one table, but grab extended data about each of those individuals that is stored in another table. As an example of what I'm trying to do: I want to load a list of individuals from TABLEA, which involves grabbing the field assign_ind_id WHERE assign_my_id = $_SESSION['id1']. I then need to grab more info about that individual from TABLEB (ie: f_name, l_name, address, city, etc) In the end I want it to display a list of all individuals from TABLEA where assign_my_id = $_SESSION['id1'], with the address, city, etc data displayed next to it: ID fname lname address city 1 John Doe 555 Fake City.
View Replies !
View Related
Combining Data From 2 Tables
I have the following code $results = mysql_query("SELECT * FROM `tblmembers` WHERE `member` = 'P'"); if (mysql_num_rows($results) < 1) { die('No members were approved last month'); } else { while ($qry = mysql_fetch_array($results)) { if (strtotime($qry['loginDateTime']) <= (time() + 86400*31)) { $login .= 'Name: '.$qry["FirstName"].' '.$qry["LastName"].' ('.date("d/m/Y", strtotime($qry["JoinDate"])).') '.$qry["Email"].''.$qry["r_id"].' ('.$qry["State"].') ' } } The 'r_id' is an ID from another table in my databse, so it outputs the ID number, but I want to pull the FirstName & LastName from that table so if the 'r_id' = 5 and 5 = Joe Bloggs I want to output that, just not sure how to do it, as it means another Query.
View Replies !
View Related
Insert Data In Tables
I have a form with many different fields from which data will go to many different tables. What I want to know is whether I can do it all at the same time. So I have $query="INSERT INTO tbl1 (fields) VALUES(values)"; "INSERT INTO tbl2 (fields) VALUES(values)" ; The above format is not correct and I want to know what is the correct format for doing all this in the same $query.
View Replies !
View Related
Data Schema Over Three Tables
I am working on a career fair managment script and ran into a inquiry i guess while desiging my database I have three tables: Fair, Company, Sponsorship Fair contains information about the fair like registration dates Company contains company information Sponsorship contains pricing and various sponsorship levels aval The sponsorship levels and options can vary from fair to fair but don't always, so I stored them in their own table. Company Sponsorship levels also vary from fair to fair. Would it be better to reference all these in a simple fair_company_sponsorship table or would it be better in the long run to go fair_company fair_sponsorship and company_sponsorship (all those tables are references to the int pk).
View Replies !
View Related
How Do I Find The Missing Rows?
I have a table in the DB called 'Products' and each row has an auto increment column that has a value of 4 digits, like each line is 1001 - Sony Plasma 1145 - Sony Hifi 2321 - Kenwood Car Stereo There are gaps because some products have been deleted in the past. How do I get a list of index id's that are missing, so I can re-add them to the database and re-use them as we are now at 9032 and I am going to run out of product id's soon as they have to be 4 digits.
View Replies !
View Related
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.
View Replies !
View Related
Pulling Data Out Of 2 Tables MYSQL
I am having a problem grabbing info from 2 different tables in MYSQL. I am setting up an online quoting system and I would like to be able to Display the discription of the part (in 1 table) and the cost (in the 2nd table) I can only get the cost to appear and not the description. PHP Code:
View Replies !
View Related
Pulling Data From Multi Tables.
how i can pull back the info i have entered into the database. I have 4 tables: Auto Dimensions Ratios Specs I have a specifications for a car called Honda Civic in the database that's accross those 4 tables. Im now wanting to pull all the info for the Honda Civic and im a little stuck They all have an ID called autoid but i dunno if i need that. Code:
View Replies !
View Related
Form Is Not Inputing Data To Tables
i have a few registration pages so it is not to much on a page and the user says screw it so the 1st page is basic email and password 2x they hit submit they are logged in and i tell them they should update there account they click update they are asked a few questions and hit update it works the 2nd page that comes up RESUMES is the one giving me a grey hair-- Code:
View Replies !
View Related
Selecting Data From Mutiple Tables
what i have is two tables, one with tours and one with courses, why i didnt use one table to begin with is a mystery to me and might eventually happen, but until then i need to select data from both tables to show in a combo box in a form. im going to be using php to show them in the form, hopefully a while statement to show the selections available. what im wondering is how do i do this? what sort of query would it be? would i need to use two queries? im pretty confident at using while loops and selecting data from databases but not two tables at the same time.
View Replies !
View Related
Insert Data From A Form Into 2 Tables
I'm trying to insert data from a form into 2 tables, and I just can't find out whats the matter with this. The following is the insert function, which works fine inserting into the product table, just no information goes into the track table from the form. Code:
View Replies !
View Related
Inserting Data From A Form Into Two Tables
I am trying to get the logic in inserting data from a registration form into two tables in mysql database. One table (name) has a primary key (name_id) and the other (address) has a primary (addr_id) and foreign key (name_id). Inserting into the tables is not a problem but I want to make sure that if I reference to the name and address table, it will retrieve the probably address with the name. Do I have to first insert into the name table and then get what the name_id is? Next, insert that name_id into the address table along with the rest of the info? I hope this is clear enough.
View Replies !
View Related
Insert Form Data To 2 Tables
I'm trying to INSERT data into 2 tables with one form submit, but only one table will insert. I've read all the postings on how to do it but I can't get my code to work. The data for the second table, 'quess', inserts okay, but the problem is NO data for the first table, 'users', is inserted. I'm not getting any errors. In the table 'users' an auto-increment number is supposed to be generated for ID which is then used as the ID for the 'quess' table using '$LAST_INSERT_ID'. Here's my code. <?php include ('connect.php'); if ($Submit == "Submit") {$sql = "INSERT INTO users SET date=current_timestamp(), firstname='$firstname', middlename='$middlename', lastname='$lastname', company='$company', email='$email' ..............
View Replies !
View Related
Echoing Data From Two Tables Joined
i didnt know what section to put this in but im haveing trouble echoing information in my SQL part i have joined two table: where DVD.DVD_ID = REVIEW.DVD_ID I want to do this on my site so i can recall the title of a dvd stored in the DVD table no the review one but i can not get it to echo ill paste you a bit of code it works without joing so my varibles are ok. Code:
View Replies !
View Related
Place Data Into Html Tables
I am tryin to place data into a html table. It has to be 3 columes long and show the top 10 players. The headings will be: Player | Kills | Deaths with the information placed under the heading. This is what I have so far: Code:
View Replies !
View Related
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?
View Replies !
View Related
SQL Statement To Sync Data Between 2 Distinct Tables
I am currently developing a PHP-based intranet system for my company... and using PEAR:DB as well. However, I am having troubles trying to create a generic SQL statement to sync all my records between 2 different tables in separate databases. Here is what I need to synchronize: MCINFO_table in Database1 --> Main table ==================== Date * SN * MchNum * MchType * Location * Active --------------------------------------------------- 02/26/01 * 12345 * SA23 * ASMAB339 * SC70 * D 04/08/02 * 12345 * SA19 * ASMAB339 * SC70 * D 02/17/03 * 12345 * SA08 * ASMAB339 * SC70 * A 02/26/01 * 67890 * SA50 * ASMAB339 * SC50 * D 02/17/03 * 67890 * SA34 * ASMAB339 * SC50 * A ENTITY_table in Database2 --> Backup table =================== Entity * EntityType * SerialNumber * Location -------------------------------------------- SA08 * ASMAB339 * 12345 * SC70 SA34 * ASMAB339 * 67890 * SC50 To sum it up, I have a 'SYNC' button in my php page... whereby, once the user clicks on it, the system will synchronize any UPDATED or NEW data within MCINFO_table with ENTITY_table. In other words, any updated or new records within MCINFO_table (the main table) must be in-sync with ENTITY_table (the backup table). I will designate MCINFO_table as "M" and ENTITY_table as "E"..... And since both tables have varying fieldnames, these are the field mappings: M.MchNum = E.Entity M.MchType = E.EntityType M.SN = E.SerialNumber M.Location = E.Location When the SYNC button is pressed, I want the system to check EVERY ROW for any updated or new data in MCINFO_table where M.MchNum = E.Entity & M.Active = A & M.Date = between today's date & 2 days ago timeframe If these conditions are met, then perform the synchronization process with ENTITY_table. I've been unable to come up with the correct SQL statements for this sync process...
View Replies !
View Related
Insertion Of Data Into MySQL Tables By Date?
My assumption is that when you insert data into a MySQL table, the latest data is put on the bottom, and is thus the farthest from the beginning of any search you'd initiate. I assume the search starts at the top-most row (oldest) and works it's way down. Since I'd like to search the latest data, and pull only about 10 rows of data, the most efficient manner would be to have the tables structured such that the newest content was always on top (a date-wise descendent structure). There must be a way to create a table such that any insertion would be put on top. I know I can ORDER BY date when doing a SELECT command, but that would entail searching the entire data set; isn't there a way to define the table ahead of time such that a date/time column is always ranked in descending order?
View Replies !
View Related
|