Look at the INSERT... SELECT syntax in the MySQL manual
Basically you can do this but only between 2 different tables (which is
what you specified) :
Generate and *test* the SELECT statement you want to use to recover your
data set.
Then in PHP try a query like this :
$query=INSERT INTO table2
Hello,
I am using a form to Insert data into 2 tables in the same database.
$TimesheetID needs to be in each table. However, it is not being inserted
into the second table, tblTimesheetDetails . Any advise?
$result_timesheet=mysql_query(INSERT INTO tblTimesheet (TimesheetID,
WorkerID, ClientID,
In that case you can do something like this:
$s_where = '';
foreach (array('name', 'lastname', 'nickname') as $e)
{
$s_where .= (!empty($s_where) ? ' AND ' : '' ) . (!empty($_REQUEST[$e]) ?
$e='$_REQUEST[$e]' : '' );
}
$result = mysql_query(SELECT id, name , lastname , m_date from users .
Good point. Since it's form data, what about $_POST['TimesheetID'] ?
Don't see anything obviously wrong with your query string. Are the inserts
happening in the same block of code, i.e., are you sure that
_$TimesheetID_ has a value in it when you're performing the second insert?
-dave
I
How do I enable more connections for mysql. the default is 100 but i want to
set more. does anyone know?
--
**
Free Nokia Ringtones US
http://www.ring-tones.us
**
--
PHP Database Mailing List (http://www.php.net/)
To
A simple way to debug your scripts would be like this :
FROM :
$result_timesheet=mysql_query(INSERT INTO tblTimesheet (TimesheetID,
WorkerID, ClientID, TimesheetDate, ProspectiveOrRetrospective) VALUES
('$TimeSheetID','$WorkerID','$ClientID','$TimesheetDate','$ProspectiveOrRetr
ospective'))or
why doesn't this work:
$pic=mysql_query('SELECT Rune, username FROM RuneRunner
RuneRunner_1 WHERE (User_ID = 3)',$connection);
$pic=mysql_fetch_array($pic);
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Just from looking at it, it seems to be because you are redefining a
variable, which destroys it, then calling for a mysql resource that has
been destroyed. What is the error?
I can't gaurantee that that is what is happening.
Cole
why doesn't this work:
$pic=mysql_query('SELECT Rune,
What error are you getting?
why doesn't this work:
$pic=mysql_query('SELECT Rune, username FROM RuneRunner
RuneRunner_1 WHERE (User_ID = 3)',$connection);
$pic=mysql_fetch_array($pic);
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit:
I tried that it didn't work
Cole S. Ashcraft [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Just from looking at it, it seems to be because you are redefining a
variable, which destroys it, then calling for a mysql resource that has
been destroyed. What is the error?
I can't
I checked em all they were right
Daniel Clark [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Sounds like it doesn't like your SQL statement. Perhaps a field or table
name is incorrect?
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
result
resource in
i fixed those things and it didn't fix it :( :( :( :( :( :( :( :( :( is
there a icq chatroom for php?)
Shahmat Bin Dahlan [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Your SQL statement:
'SELECT Rune, username FROM RuneRunner
RuneRunner_1 WHERE (User_ID = 3)'
The error he is getting means that his MySQL resource (in this case the
results of the query) does not exist. Try
$pic1=mysql_fetch_array($pic);
Also, can you give the exact text of the error (line number and all) and line numbers for the entire passage?
Cole
Shahmat Bin Dahlan wrote:
Your SQL
I need the exact error message. Copy Paste it from the browser. I also
need line numbers.
Cole
water_foul wrote:
i fixed those things and it didn't fix it :( :( :( :( :( :( :( :( :( is
there a icq chatroom for php?)
Shahmat Bin Dahlan [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi,
Refer to
http://dev.mysql.com/doc/mysql/en/Too_many_connections.html
Concretely, the description below is added to the [mysqld] section
of my.cnf (my.ini for Windows), and mysqld is rebooted.
[mysqld]
set-variable=max_connections=500
--
Sumito_Oda mailto:[EMAIL PROTECTED]
--
PHP
15 matches
Mail list logo