473,408 Members | 2,405 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,408 software developers and data experts.

Does PHP offer a way to insert into MySQL in this format?

Claus Mygind
571 512MB
MySQL has two formats for the insert syntax.

I see the first format is accepted in PHP
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO Persons (FirstName, LastName, Age)
  2. VALUES ('Peter', 'Griffin', '35')
  3.  
But I have grown accustom to the other form of name/value pairs as it is easier to see the connection between column and value.
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO Persons 
  2. SET FirstName='Peter', LastName='Griffin', Age=35)
  3.  
Can this be done in PHP?

I am new and I am using PHP v5.3.3 with MySQL v5.0
Dec 6 '10 #1

✓ answered by Mayur2007

Yes you can use any of the above to insert data in mysql.

Regards,
Mayur Bhayani

1 1479
Yes you can use any of the above to insert data in mysql.

Regards,
Mayur Bhayani
Dec 7 '10 #2

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

Similar topics

2
by: Martin Foster | last post by:
Hi. I want to do something really simple. I want to be able to write a custom SQL query in a textbox on a webpage, submit it and then output to the webpage in the format of MySQL output i.e....
3
by: toedipper | last post by:
Hello, PHP and MYSql I have the code below which logs a visitor to my site via logging the session id and other details in a table. I only want to count a visit once so I have a check to see...
3
by: 4partee | last post by:
I'm trying to import a csv file with a PHP procedure. However, some of the lines in the csv file have missing values. When this command is given to mysql: insert tablex values...
1
by: libsfan01 | last post by:
HI all! ive need to format the date (variable "tomorrow") in this form to mysql format yyyy-mm-dd can anyone please show me how to amend my script? regards Marc
8
by: libsfan01 | last post by:
how can i use regular expressions to ensure a mysql format date entry in a text field? thanks marc
1
by: rjames.clarke | last post by:
I am inserting a record in to a mysql database. I'd like to know the record number of that record. I use a index field which is auto-incremented. Is there any way to get a field value returned...
1
by: simon.elbaz | last post by:
Hi, i use the following map: std::map<Key, std::vector< std::string >, KeyCmp mSQLElem; The following code does not insert the newly created pair: std::vector<std::stringvcTemp;...
2
by: servo | last post by:
I am using the following code. Why it does not insert record in the MySQL Table through php script: <?php $dbhost='localhost'; $dbuser='root'; $dbpass='newpass'; $mysqldb='mysql'; ...
2
code green
by: code green | last post by:
I know this is simple but I have been using mssql for so long I have forgotten how to do it in MySql. I am reading a date from a CSV file of the format How do I convert this to ISO 8601 standard...
2
by: AlRojo | last post by:
First, apologies for all the code; I'm not sure what is most relevant to my problem. I am trying to use the code below to select Records from an Access table called and insert them into another...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.