How to connect to a certain table in MySQL database?
I have tried :
mysql_select_db("baybeestore",$connection);
but it gives me an error :-
"Error : Table 'baybeestore.form' doesn't exist"
But I've created a table named as order. Are there any PHP codes to connect to my table order in the same database that have multiple databases?
Is it wise enough to create multiple database & one table for one website or multiple table with one database?
FULL CODE :
$connection = mysql_connect("localhost","user","1234");
if(!$connection)
{
die('Failed to connect to MySQL :' . mysql_error());
}
mysql_select_db("baybeestore",$connection)
$sql = "INSERT INTO
form(name, address, email, handphone, item, payment)
VALUES
('$strname', '$straddress', '$stremail', '$strhandphone', '$stritem', '$strpayment')";
if(!mysql_query($sql, $connection))
{
die('Error : ' . mysql_error());
}
echo "Data have been saved.";
mysql_close($connection);
SELECT * FROM orderandINSERT INTO form2 different animals altogether. If anything, that should beINSERT INTO orderorSELECT * FROM formyet...ORDERis a reserved word and should be enclosed with backticks. dev.mysql.com/doc/refman/5.5/en/reserved-words.htmlINSERTalong with everything else listed on that website, and/or find tutorials onmysqli_and PDO. Stop usingmysql_functions also. I myself studied Database syntax for 6 months, and spent 3 months testing and building from tutorials before I felt I was good and ready. If you have the time to do so, you will have much better success with your code, believe me ;-)