PHP mysql insert sentence

I have a referans table named RT_REFERANS
I have columns in that table named rt_name, rt_id, rt_value

I try to use a couple of row insert sentence but it gives an error code like
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in ... in the line of  mysql_query($sql,$con);

$sql="INSERT INTO RT_REFERANS(rt_name,rt_id,rt_value) VALUES ('rt_sehir',1,'Adana');
INSERT INTO RT_REFERANS(rt_name,rt_id,rt_value) VALUES ('rt_sehir',2,'Adiyaman');
";

mysql_query($sql,$con);
LVL 1
BraveheartliMarketingAsked:
Who is Participating?
 
collins23Connect With a Mentor Commented:
Your settings for connecting to the database are not correct.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
that error means that $con is not a connection object identifier (as returned by mysql_connect())

0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
note that with MySQL, you can insert several rows "at once":
$sql="INSERT INTO RT_REFERANS(rt_name,rt_id,rt_value) VALUES ('rt_sehir',1,'Adana'), ('rt_sehir',2,'Adiyaman')
";

Open in new window

0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
shobinsunCommented:
HI,

Look at this:

http://www.petefreitag.com/item/379.cfm

The error is because of the error in your sql.
0
 
shobinsunCommented:
0
 
BraveheartliMarketingAuthor Commented:
thank you all
0
 
BraveheartliMarketingAuthor Commented:
Dear angelll,
you are also right,
I should have given you some of the points..
next time..
0
All Courses

From novice to tech pro — start learning today.