Page 1 of 1

Help inserting values in MySQL (provided code)

Posted: Fri Mar 27, 2009 6:55 pm
by CKEANEDesign

Code: Select all

$value = mysql_query("INSERT INTO Accounts (AccountName, FirstName, LastName, Age, City, State, Country) 
VALUES ('Ckeane17', 'Cory', 'Keane', '18', 'Chicago', 'IL', 'United States')");
if ($value)
 {
 echo('information inserted')
 }
 else
 {
 echo(mysql_error())
 }
Is there smething I'm doing wrong here? it wont post an error nor will it post "information inserted.."

Oh and how can I check my MySQL database to see what databases and tables are in my local host server?

Thanks a lot guys

Re: Help inserting values in MySQL (provided code)

Posted: Fri Mar 27, 2009 7:39 pm
by CKEANEDesign
Nevermind! Found my mistake. I should doublecheck next time. Sorry.

Code: Select all

 
// Insert values into table
mysql_select_db("Users", $con);
$value = "INSERT INTO Accounts (AccountName, FirstName, LastName, Age, City, State, Country) 
VALUES ('Ckeane17', 'Cory', 'Keane', '18', 'Chicago', 'IL', 'United States')";
if (mysql_query($value,$con))
 {
 echo("information inserted");
 }
 else
 {
 echo(mysql_error());
 }