How can I go about creating/inserting a new row in a table in MySQL? What is the SQL query? Is it something as easy as creating a table (like CREATE ROW) or something? Please assist. Thanks.<33
<?php // Make a MySQL Connection mysql_connect("localhost", "admin", "1admin") or die(mysql_error()); mysql_select_db("test") or die(mysql_error()); // Insert a row of information into the table "example" mysql_query("INSERT INTO example (name, age) VALUES('Timmy Mellowman', '23' ) ") or die(mysql_error()); mysql_query("INSERT INTO example (name, age) VALUES('Sandy Smith', '21' ) ") or die(mysql_error()); mysql_query("INSERT INTO example (name, age) VALUES('Bobby Wallace', '15' ) ") or die(mysql_error()); echo "Data Inserted!"; ?> Code (markup): source: I hope this helps
That just looks like data is being inserted into a pre-existing row inside a table... Will it create the row if it doesn't exist?
Insert is to input data into a new row, notice there is no where clause. If you were putting data into an existing row it would be an Update query, not an Insert.
Eh nevermind, appararently I meant I wanted to insert a field, not a row, and I was easily able to do it in phpMyAdmin.