Categories:
.NET (961)
C (387)
C++ (185)
CSS (84)
DBA (8)
General (31)
HTML (48)
Java (641)
JavaScript (220)
JSP (109)
JUnit (31)
MySQL (297)
Networking (10)
Oracle (562)
Perl (48)
Perl (9)
PHP (259)
PL/SQL (140)
RSS (51)
Software QA (28)
SQL Server (5)
Struts (20)
Unix (2)
Windows (3)
XHTML (199)
XML (59)
Other Resources:
How To Insert Data into an Existing Table
How To Insert Data into an Existing Table? - MySQL FAQs - Managing Tables and Running Queries with PHP Scripts
✍: FYIcenter.com
If you want to insert a row of data into an existing table, you can use the INSERT INTO statement as shown in the following sample script:
<?php include "mysql_connection.php"; $sql = "INSERT INTO fyi_links (id, url) VALUES (" . " 101, 'dev.fyicenter.com')"; if (mysql_query($sql, $con)) { print(mysql_affected_rows() . " rows inserted.\n"); } else { print("SQL statement failed with error:\n"); print(mysql_errno($con).": ".mysql_error($con)."\n"); } mysql_close($con); ?>
Remember that mysql_query() returns integer/FALSE on INSERT statements. If you run this script, you could get something like this:
SQL statement failed with error: 1142: INSERT command denied to user 'dev'@'localhost' for table 'fyi_links'
2007-05-10, 4624👍, 0💬
Popular Posts:
How To Enter Binary Numbers in SQL Statements? - MySQL FAQs - Introduction to SQL Basics If you want...
What Happens If One Row Has Missing Columns? - XHTML 1.0 Tutorials - Understanding Tables and Table ...
Can you explain duplex contracts in WCF? In duplex contracts when client initiates an operation the ...
What is the output of printf("%d")? 1. When we write printf("%d",x); this means compiler will print ...
What is thread? A thread is an independent path of execution in a system.