?
Solved

PHP mysql insert sentence

Posted on 2010-09-21
7
Medium Priority
?
518 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 2000 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

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

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

762 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