Solved

PHP mysql insert sentence

Posted on 2010-09-21
7
514 Views
Last Modified: 2013-12-12
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);
0
Comment
Question by:Braveheartli
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 33725057
that error means that $con is not a connection object identifier (as returned by mysql_connect())

0
 
LVL 6

Accepted Solution

by:
collins23 earned 500 total points
ID: 33725083
Your settings for connecting to the database are not correct.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 33725087
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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 14

Expert Comment

by:shobinsun
ID: 33725107
HI,

Look at this:

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

The error is because of the error in your sql.
0
 
LVL 14

Expert Comment

by:shobinsun
ID: 33725114
0
 
LVL 1

Author Closing Comment

by:Braveheartli
ID: 33725189
thank you all
0
 
LVL 1

Author Comment

by:Braveheartli
ID: 33725591
Dear angelll,
you are also right,
I should have given you some of the points..
next time..
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question