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
BRMarketingAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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
 
BRMarketingAuthor Commented:
thank you all
0
 
BRMarketingAuthor Commented:
Dear angelll,
you are also right,
I should have given you some of the points..
next time..
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.