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


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





Inserting Master-detail Records In Mysql


how I can insert a master-detail record in mysql? I use an auto-increment key, but I don't know how I can find that key for inserting the detail records, I tried to make a 'highest-key' function with 'select MAX(field)...' but in php it gives the wrong key (in mysql it gives the right one).




View Complete Forum Thread with Replies

Related Forum Messages:
Master - Detail
I'm new on this list and have been working for quite a while on a PHP app that will make an HTML frontend for a PostgreSQL dbms. Works fine so far but I'm having a little trouble with master - detail screens. My db (roughly) has a hierarchical structure, something like BAND -> RECORD -> SONG. When I display the record, band should be displayed on top of the screen. When song is displayed, band and record should be displayed.

At the moment I use something like storing current band, current record in a serialized _SESSION variable. It works, but not very smoothly because PHP has no idea of history, descent (the current screen doesn't know what the previous screen was). So I'm struggling a bit with this. Are there any "standard" solutions for this master. detail setup? I found a lot on macromedia, but I don't use that, it's just Vim on Linux.

View Replies !
Creating Master-Detail Page
I have an array that holds all of the information I want displayed. Dreamweaver, on the other hand, uses a MySQL statement stored in a variable...

As such, I'm wondering if any of you out there know how to create a master-detail page that has a first page, previous page, next page, and last page link that allows me to display 10 records at one time.

Also, when I go to the detail page, I especially need to know how to get the specific row's information transferred. If anyone has any ideas, that would be great.

View Replies !
Showing Database Records As Links To A Page To Show Relevant Detail
What I currently have is list of players what I want to do is make each player a hyperlink to a page with their details on. The hyperlink would be like this www.mydomain.com/playerDetails.php?playerID=1 and it would display the player with playerID 1. I have seen this on lots of sites and would like to know how this is done, can anybody recommend me any tutorials or write me a short script to do this.

View Replies !
Sensible Method Of Inserting Records In To MySQL
I have users using a third party windows application. They can export data
from this application directly to a text file (CSV). So far as I know,
there is no way to make this application talk directly to the MySQL server.

We're talking thousands of records here - it's not practical to have an HTML
form handled by PHP which inserts the data to MySQL... or is it??

What I thought about doing was to have them export the data to the CSV file
& then upload it to the web server using FTP.

Once uploaded, I would have
them go to a page with a PHP script which would run the command to import
the data to MySQL. PHP can run shell commands, as I understand it from the
manual. Perhaps this would be a bitch on Windows, though. Code:

View Replies !
Check For Errors Before Inserting Records In Mysql
I'm creating an auction script from scratch and I'm busy with the registration page. I was wondering if there is a better way to check that there are no errors when inserting the users profile into the database. ....

View Replies !
MySQL Inserting Into Multiple Tables Linked Records
Using MySQL can anyone tell me how to most efficiently insert a collumn
in 'table1' retrieve the id from this record and insert mutliple
records into 'table2' with a collumn for the id in 'table1' which links
the two recordsets

View Replies !
Inserting Records
I'm trying to insert as many as records as possible but less than 100 into a table. First, i get the count inorder how many to add and then depending on the count, i get so many blank form fields to enter. Now, I noticed something really strange.

1.Only the last entered record is inserted into the table.
2.For example, when I type a name, Let us assume "WORLD", only w is inserted into the table and the rest is not.It is the same with all the form fields.whether, i'm trying to enter text or a number,only the first character is inserted.This sounds weird. Could somebody pls tell me why is this peculiar behaviour Here is the code:

View Replies !
Inserting New Records- But Want To Know Fields From Other Tables Too?
I am doing a very simple website for a running club,and am rather new to mysql and php. The database just has 3 tables, member , race, and results.

member has stuff about the member, primary key is member_no.

race holds race details, e.g. race_no (primary key), the race name, etc.

results holds results for each race, primary key is member_no and race_no, the only other data recorded is the time.

basically i want a page where you can enter the results for a particular race. but im not sure how to do this, since it is pretty unreasonable to expect someone to remember a race's id no and a members id no, how can you allow them to enter (on a simple html form on the site) for example the members first name, the race's name AND its date (as some races are called the same on different days) along with the result time and then just update the results table?

View Replies !
Checking To See If 2 Records Exists Before Inserting
I have a webpage with multiple form fields on it, one for name, address, email and comment.

I use php to connect to a mysql db that has all those fields in it and the script the checks if name and email exists, if they dont it inserts the form fields to a new entry, if they do exist it redirects to another page.

My problem is I seem to mess up the checking of the two fields part. I thought I'd been clever and set it up so that it checks if both fields exits in a given row but users can not add just a name without and email adress. Code:

View Replies !
Having Trouble Inserting Records To A Table.
currently i am using the code:

$query ="INSERT INTO table_name (Field_name) VALUES ($name)";
$result = mysql_query($query);

and it doesnt seem to be inserting.

am i doing it wrong?

View Replies !
Inserting Multiple Records From 1 Form. How?
i have a page that lets you input a number which is passed to a php script that generates rows of textboxes / records (first name, last name). how do i pass these rows / records into the database? Code:

View Replies !
Inserting Records Into A Microsoft Access Database...
I'm still new at using PHP although thanks to these forums I'm learning quite a lot. Currently, I am trying to insert a new record into my access database.

I can display records from it but not add new ones. I know that I am to use the 'INSERT' SQL function but how would an Access Database be different from mySQL?

So far I've seen only mysql examples and havent been able to find anything on access...

View Replies !
Form Processing - Create The Page And Have The Records Inserting
I can create the page and have the records inserting, without any issue, but the problem I'm having is trying to understand the process involved. I can find lots of tutorials on how to insert records but none on the logic behind it. Can anyone point me in the direction of a tutorial.  What I'm trying to understand is the how the form submits the page (to where I'm not sure) and then executes the form handling. I'm using Dreamweaver to create the insert form, if that is of any consequence.

View Replies !
Search Detail
i'm creating a site with a search engine but i want to be able to get to a detailed page for any record selected at the end of the search.

View Replies !
Improving Detail In Error Reporting
I'm logging PHP errors to a file on one of my sites (using a directive in an .htaccess file). Unfortunately the error messages aren't specific enough for me to track down where the user was when they occurred. Code:

17-Oct-2005 09:13:39] PHP Fatal error: SQL in /usr/www/users/earthcor/includes/classes/table_default.class.php on line 166

Which in this case just means a bad sql query, but I don't know where. Is there a way to write more info - the exact URL for instance?

The relevant .htaccess lines are:
php_flag display_errors off
php_flag log_errors on
php_value error_log /usr/home/earthcor/php_error_logs/phperrors.txt.

View Replies !
Script To Catch Any Detail Of The Bot Activity / Hacker ID?
Someone did hijack my mailer using script file attached. They put it in a cache directory.
Every five minutes or so a bot visits my site, even though I have taken site down for the time being. I am inexperienced, so I don't know exactly what this is doing. It seems to be sending mail and trying to collect information. But I'm not sure exactly what.

Do any of you guys know what is going on?
Is there some other code I can put in place of the script to catch any detail of the bot activity / hacker ID?

View Replies !
Master Value
I have a dedicated server running fedora and have a problem with open_basedir.

Master value = no value;
defined in /etc/php.ini

Local value = /var/www/vhosts/domain.com/httpdocs:/tmp where is this defined? I need to change it to "no value".

View Replies !
Display The Detail In A Multi Dimension Array One Level At A Time
I am trying to display the detail in a multi dimension array one level at a time. My array looks something like this:

$first[0]=1
$first[0]second[0]=1A
$first[0]second[0]tihird[0]=1AB
$first[0]second[0]tihird[1]=1AC
$first[0]second[0]tihird[2]=1AD
$first[0]second[0]tihird[3]=1AE
$first[0]second[0]tihird[4]=1AF

$first[0]=1
$first[0]second[1]=2A
$first[0]second[1]tihird[0]=2AB
$first[0]second[1]tihird[1]=2AC
$first[0]second[1]tihird[2]=2AD
$first[0]second[1]tihird[3]=2AE
$first[0]second[1]tihird[4]=2AF

I want to start with $first[0]second[0] and print all items in third[] then move to the next $first[0]second[1].

View Replies !
& Master Pages
ASP.NET 2.0 is said to implement a great feature called Master Pages, does
PHP support htis feature or is it something that may be implemented soon ?

View Replies !
Security - Ssh To Master Without A Password
I'm working on a PHP application that adds user accounts to my system. However, the PHP script runs on the webserver, while the accounts need to be created on a different box, which I'll refer to as "master". Right now, on "master" I have a script which can create and destroy directories in /home, and set permissions, etc.

The script is run by a shell_exec(ssh master sudo homeDirManage.sh create $USER). I have setup the web server user to be able to ssh to master without a password, and use sudo to run homeDirManage.sh without a password. What I'm worried about is that any other user able to put up their web page can do the exact same thing, and delete home dirs. Is there a more secure way to do this?

View Replies !
Local/Master Variables
Im trying to get my apache server to run php in none-safe-mode (safe_mode == "0"). It is set like this in php.ini, however, when i look at a phpinfo(); it shows that locally this is still set on, despite the master being off. I cant find config files specific to each domain on the server - nor can i see anywhere in php.ini where other configs are included. I've tried an ini_set("safe_mode", "0"); but that didnt help. Does anyone have any ideas as to how i might be able to sort this?

View Replies !
Local And Master Safe_mode And Security At Host
I have the following question:

a hosting provider has turned local safe_mode off and the master
safe_mode is on. This prevents an application/php script to work.

The provider refuses to turn safe_mode off due to security reasons. They
work with some kind of virtual hosting I had a quick look at the system
and saw a /etc /bin etcetera, in the /etc there was a php.ini where
safe_mode was Off.

a few questions:
a) is turning (local) safe_mode off a real big security risk as the
provider tells us?
b) if so why is the master safe_mode turned on?

On my own system both local and master safe_mode are turned off, and I
did not modify anything when php was installed.

another question arises: where are the local and master values set?

Is there a good page on safe_mode? Google only points me a hosting
provider that allows safe_mode to be on.

View Replies !
Master FORM Which Selects Between Slave FORMS...
I wish to have a simple multi-dropdown donate option, the user selects a pre-defined amount from dropdown1 then they choose the payment gateway (paypal, stormpay, e-gold, intgold etc) from dropdown2, then click Go!

However, each of these gateways code is embeded on the page as a form (as buttons, no input required).

Is there a way to use a "master" form in php, which selects between multiple other "slave" forms via a dropdown select and submits that value?

I also need a dynamic "payment amount" as dropdown menu (or text input) menu which inserts its value (amount to donate) anywhere on the page as a dynamic php include... (including form value fields) so when the master form is submitted, the "payment amount" include will refresh the value within any of the sub forms vaules upon submitting the MASTER form.

View Replies !
Upload Incremental Csv Files To A Master Table
I have a question about an admin webpage to upload incremental csv files to a master table.

Here is what I do currently:
- I get an excel file (turn it into a csv)
- go to phpMyAdmin and upload the csv from the SQL tab
simple, it works.

What I would like to do is this:
have the client upload the same .csv file via a webpage, a form upload field, which in turn, adds the few more records to the existing table.

When I upload via phpMyAdmin, i see the SQL that it spits out, but not sure how to implement.

View Replies !
Using A Master DB File That Has One Giant Array Stored In It.
Can you readers please post why my friend SHOULDN'T use the database method he wants to. He is using a master DB file that has one giant array stored in it. Here is an example of basically how he is using it through his class: Code:

View Replies !
Inserting To Mysql
my data are in an array and there's a problem when im inserting it in mysql. the values are null.

View Replies !
When Inserting Into MySQL
I use this format in PHP to get a date. date("Y-m-d"); And I use the proper field in MySql and get the proper date most of the time in my file upload form. But I am currently getting a user then when she uploads a new file, it puts and old date in MySql, in this case 2005-12-05, instead of todays date, 2005-12-21. When I upload a file I get the proper date inserted into mysql. I have turned off Caching options with headers:

header("Cache-Control: no-store, no-cache, must-revalidate");
header("Expires: Mon, 26 July 1997 05:00:00 GMT");
header("Pragma: no-cache")

But the auto date is still posting the date of 2005-12-05.

View Replies !
Inserting Into MySQL
For some reason im having trouble inserting into a database. Here is the code:

View Replies !
MySQL Inserting
I've just started playing with ENUM/SET field types and so far I love em'. only thing ihavent been able to find via google is examples of insert and update query statements.

View Replies !
Updating Database - Selects All The Data From The Master Table
We have pages that allow the user to enter information. The data is stored in or comes from an oracle table that is not denormalized. This information is gathered on 3 pages and on the 4th page we show a summary and then update the database. My job is to add a new page before the summary page. However, the data I am gathering is in a normalized table that is linked to the other table with a foreign key.

The developer who wrote this selects all the data from the master table on page 1. The columns are all prefaced with 'AP_' and he uses the following code:

View Replies !
Selecting Alternate Master Dictionary With Pspell Functions
Is it possible to select an alternate master dictionary when using the
pspell interface? There is a way to select a personal dictionary
(pspell_config_personal()), but that is used IN ADDITION to the default
master dictionary, which is not what I want.

I have a different English dictionary I wish to use, and I do not want
to use the default dictionary at all. However, I do not wish to mess
with the existing installation of aspell on the machine by removing the
dictionaries in place.

From the command line I can just do:

aspell --master mydict.rws

but there seems to be no way to simulate the "--master" argument using
the PHP interface. Likewise there seems to be no way to provide the
"--size" argument.

On a related note, are there any examples anywhere of how the 'jargon'
parameter might actually be used? In every example I can find it is
blank, and all references to it in documentation are elliptical at best.

I know I can do all this by piping to the aspell binary but with the
volume of text I'm looking at that's going to be really really slow.

View Replies !
Multiple Navigation Tables On One Page (master - Slave)
I just wanted to refresh only part of the page, i.e., table2 on my php page. here is my javascript code which performs the refresh it works fine and my php file display all the records. the only problem is: I have got two tables on the same page and i only want to refresh the second table when i click the a row of my first table rows. Code:

View Replies !
Variable And Inserting Into MySQL
I have a PHP script that pulls data from an external URL. I can fetch and print the data without using a MySQL database, but I can't figure out how to add a separate entry for each "idnumber". Here is a snip from my code that relates to what I'm referring to:

How can I insert them into the MySQL database. Here's what I've tried, but it isn't adding the info to the database.

$sql = "INSERT INTO clients SET IDNumber = '". $client[$i]['idnumber']. "',

View Replies !
Inserting Data Into Mysql
I have a simple loop
include '../php_library/connect.php'
include '../php_library/opendb.php'

$conn=mysql_connect($host,$dbuser,$dbpass) or die ('Error');
mysql_select_db($dbname);
//Open the file
$fp = fopen($src,"r");
//for each line in the file
while ($row=fgetcsv($fp,10000,'')) { //Get line
$sql_insert="INSERT INTO ...";
if (!mysql_query($sql_insert,$conn)){
OutputError($sql_insert,$mysql_error());
$FailedCount++;
}
else {$InsertCount++;}
}

It works fine for the first couple of hundred or so rows but the stops -
no errors, it just stops mid-loop.

I'm guessing some sort of buffer problem (needs flushing?) but it is a
guess.

I'm running this all locally - XP, Apache2, PHP5, mySQL 4.1

View Replies !
Inserting HTML Into Mysql, Is It Possible?
i want my users to be able to insert html into my mysql database, is this possible?
and how would i go about doing it, or could you point me in a direction that would tell me?

View Replies !
Parsing Xml And Using Php Inserting In Mysql
How to parse this xml and generate php code  to insert to mysql. In this example xml there are 3 articles, one with 2 photos and the others with just one. A Php5 solution requiered. Code:

View Replies !
Inserting Php Arrays Into Mysql
I am working on a project where I am dealing with over 10,000,000 records and I was wondering if it is possible to slice these records into multidimensional arrays of say 1,000,000 records each and then insert them into mysql with 10 inserts statements rather than the 10,000,000 insert statements I am currently using...

I know there is a way to extract data to an array, but is there a way to then take an array and plug it into mysql without doing millions of iterations?

View Replies !
Inserting Data Into Mysql Db
i was trying to insert a data into mysql db but my system inserts a given data twice. i tried to sort out the problem but i faild. Code:

View Replies !
MySQL Not Inserting All Data
I'm using php to dynamically create a query from an array. When the query is run, it doesn't always insert all of the data. Some of the last columns are ignored. It happens on very long inserts... with over 50 columns in the table. Code:

View Replies !
Inserting Record Into Mysql
If someone goes to mypage1.php and their ip address is already in my mysql database, how can I find that record and update the "status" field so it says "Yes"?

View Replies !
MySQL Inserting Data
I have a form with two fields, firstname and lastname. I am trying to insert data into my mysql database, but unable to do so. Following is the script on my action1.php file

<?php $username="***";
$password="***";
$database="***";
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
mysql_connect(***,$username,$password);
@mysql_select_db($database) or die("Unable to select database");
$query = "INSERT INTO pko_userinfo (firstname, lastname) VALUES ('$firstname', '$lastname')";
mysql_query($query);
mysql_close();
?>

View Replies !
Inserting A CSV Into MySQL Via Page.
I'm building an e-commerce site, where the owner needs to be able to
upload a CSV file of product that gets inserted into mySQL.

Unfortunately, I think my Web host may have some functions turned off.
Is there some other ways I can try to do the following? Code:

View Replies !
Validation Before Inserting Into Mysql
I setup a field that captures ip, host, etc. on the database when a new record is added.  I noticed that my "ip catching" field has a NULL value when those spam messages get inserted. 

The other records (the real ones) all get populated with the IP address and other info.  So, I figured I'd validate the user's ip as they are about to insert a record... I figured I could stop the insert if the user doesn't show an IP address.  So I use the following if statement to check for user info. Code:

View Replies !
Inserting Timedate Into Mysql
i heard that in order to insert time or date correcly in your mysql database you must have unix_timestamp or something.

View Replies !
Problem Inserting Into Mysql Via Php Form
Well let me get right to it, I have the following form:

View Replies !
Inserting Speacial Chars Into Mysql DB
I'm working on a shopping cart and want to store user info in the DB (credit cards). I have used php's mcrypt to encrypt cc numbers which all works fine, but when I try to store an encrypted number in the DB I get problems. For example, here is an encrypted CC:

View Replies !
Inserting Values Into MySQL Using A For Loop In PHP
I have an html array I am trying to insert the values from into my database.I have no idea how to do this using a for loop.These are not seperate rows that I want to insert, but rather one row with these values in the columns they are meant for. PHP Code:

View Replies !
Problems Inserting Data Into Mysql
I am trying to load data into the mysql database from a tab delimited text file. The Text file has 15455 rows, so I should expect that many records to be created when I load the data into the table. However it only gets to 12692 records, and I get 15455 warnings (the expected amount of records). Code:

View Replies !
Inserting Array Into Mysql Table
Anyone know the best way to insert an array from a form into a mysql table. My array is validated from the form and then inserted into the db, only when I SELECT it, it merely saya 'array' in the field.

View Replies !
Inserting Php Code Into Mysql Field
Im trying to display a variable '$downloadimage' which is in my head.php file. I am trying to display this on my page by inserting this code into one of my mysql database fields: -Code: <? echo $downloadimage; ?>

When the page loads there is nothing there (i only have text in the variable at the moment), my html code shows the PHP echo code as text.

View Replies !
Removing Linebreaks When Inserting To MySQL?
I'm using a textarea to insert some notes into a database.
It's inserting the complete result into the mySQL table including the
linebreaks...and not as a visible symbol but an actual linebreak. If I
select the fireld in mySQL at a command prompt, the results take an
inordinate amount of space from all the linebreaks.

I tried nl2br() before it goes into the INSERT, but all that does is ADD <br
/> to the data but it still have linebreaks in the field.

Is there some way to replace linebreaks with something else than the break
itself so I can save database space?

View Replies !
Inserting Formatted Text Into Mysql ?
is there a way to format the text from a multi-line textfield (html), including line breaks, tabs etc. and to properly insert it into a mysql-table ?

View Replies !

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