473,321 Members | 1,667 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Insert statment problem

Good morning

I have a form with the controls in the insert statment below. table1 has an Auto increment primary key hence is omitted in the insert statment and form. Am getting the error It didnt work " .mysql_insert_id(); and not any other php or mysql error to tell me if anything is wrong the insert statment.

To top it up, I have an echo statment of the insert statment before it executes, when I copy and paste the insert statment from the browser and paste it in MySQL query analyser, the insert statment actually works. What could be wrong, please help

$Sql= "insert into table1(leader,SnrOp,Op1,Op2,Absent,OP3,ExtraOp,Dat e,Autho) values(".$_POST['sleader'].",".$_POST['SnrOp'].",".$_POST['Op1'].",".$_POST['Op2'].",".$_POST['otOp1'].",".$_POST['extOp'].",".$mydate.",".$_SESSION['absent_status'].")";

$result = mysql_query($Sql);
if (mysql_query($result)){
echo "<br /> Entered id " .mysql_insert_id();
}else{echo "It didnt work " .mysql_insert_id();
}
Apr 22 '07 #1
1 1563
code green
1,726 Expert 1GB
Am getting the error It didnt work " .mysql_insert_id(); and not any other php or mysql error
Well you won't do because you do not try to echo out any php or MySql errors
Apr 24 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Mark Davenport | last post by:
Hi, Here's my question: How do I pass a NULL value in a variable to a MySQL DB? Here's an overview of my problem: I have a PHP page that processes code, then inserts the code into a database....
0
by: Michael Schoen | last post by:
Hi there, i=B4m actually developing a performance criticial system where I need to index a huge amount of protocoll data. These data are already in a chronological order, so if I push the data...
1
by: Maria | last post by:
Hello I have not used db2 in a long time, and I have this very long insert script, which is giving me an error of duplicated inserts. My question is how can I put something in the statment so...
2
by: 73blazer | last post by:
Perhaps my thinking is wrong but this is what I have: 1 table (Tab1) with 1 attribute (Attr1) Attr1 char(16) for bit data ----------------------------------------------- create trigger...
8
by: 73blazer | last post by:
Hello, I'm looking for a way to make some of my insert templates more readable by placing comments in between the values. I cannot seem to find a way to do this with DB2, is there a way? I'm...
2
by: Nothing | last post by:
I have a form that a person enters some information on. They then clicka button that triggers VBA to perfom a SQL INSERT INTO query. One of the fields auto assignes the current date. Another...
10
by: Daniel P. | last post by:
How can I use ADO.NET to insert lots of records in a very fast way? Thanks!
2
by: Denis Correard | last post by:
I have an application that create an insert statment on the fly (it would be to complex to create stored procedures for all senarios) like: insert into Table (field1, field2,field3 ,field4 ) VALUES...
8
by: slb813 | last post by:
Hello, I am having a problem that I can't seem to work out. I am running Apache 2.2 on a Windows XP platform, using PHP5. I am attempting to insert a row into a MS Access data base with a PHP...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.