Ask a Question related to PHP Notes, Design and Development.
-
didou@php.net #1
note 33925 deleted from function.mysql-select-db by didou
Note Submitter: [email]sonetti@hotmail.com[/email]
----
As an reply to jorik at scriptsnet dot nl with;
A better way to do this is;<?PHP
mysql_connect("your host", "username", "password") or die(mysql_error());
mysql_select_db("your database") or die(mysql_error());
?>
<?php
if(!$db_conn = mysql_connect("your host", "username", "password"))
exit(mysql_error($db_conn));
else {
if(!mysql_select_db("your database", $db_conn))
exit(mysql_error($db_conn));
}
?>
You should always use the link identifier, and die() is just an alias for exit()
didou@php.net Guest
-
note 26082 deleted from function.mysql-result by didou
Note Submitter: sedesignlinksnet ---- If you wish to select a field value in a SQL statement like: $sql = "SELECT uid FROM global_lookup... -
note 33846 deleted from function.mysql-connect by didou
Note Submitter: execlusuve@coolgoose.com ---- hello, i wpould like to pertronise ur biz. -
note 11074 deleted from function.mysql-result by didou
Note Submitter: squeezeboobies@digitalsorcery.net ---- If you have just performed an insert into a database with an auto incrementing field you... -
note 33639 deleted from function.mysql-connect by didou
Note Submitter: carp_a_dieum@yahoo.com ---- To extend amn -at- frognet.net comment. Here is a cool example of reusing mssql connections and... -
note 31845 deleted from function.mysql-select-db by didou
Note Submitter: alphalund@infinito.it ---- It seems that mySQL doesn't like the backtick (`) operator when changing DB. So if you call...



Reply With Quote

