- Impact
- 19
Hey
i am reading an ebook on php and mysql..and here is how they teach to connect to a db:
from reading other tutorials and looking at scripts..i learned that you dont need to define the mysql conection to a variable and echo it later on..u can just do:
but which one is better? does it matter?
this is how they tell to run a query:
i am reading an ebook on php and mysql..and here is how they teach to connect to a db:
PHP:
$conn = mysql_connect("localhost", "joeuser", "somepass");
echo $conn;
PHP:
mysql_connect("localhost", "joeuser", "somepass");
this is how they tell to run a query:
PHP:
$sql = "CREATE TABLE testTable (id int not null primary key auto_increment,
testField varchar (75))";
// execute the SQL statement
$result = mysql_query($sql, $conn);
// echo the result identifier
echo $result;








