Handling mysql errors
http://www.planetmysql.org/entries/4067
Web related issues such as design, programming, search engine optimisation, database, revenue generation, streaming. This is also my area to give back to the internet community that has given me so much.
Thursday, September 21, 2006
Wednesday, September 20, 2006
mysql_db_query deprecated
When you are not programming/scripting alot lots of things pass you by.
PHP since 4.06 has deprecated this function mysql_db_query, that actually I used a lot. Now I like this function as in one function, I pass the database name, the SQL query and the connection resource link which is optional
resource mysql_db_query ( string database, string query [, resource link_identifier] )
Instead they are now asking that we do the following. Two things that could be done in one
mysql_select_db()
bool mysql_select_db ( string database_name [, resource link_identifier] )
mysql_query()
resource mysql_query ( string query [, resource link_identifier] )
The advantage I see is that you can actually check to see if the database is present before doing the query.
if ( ! mysql_select_db (database )){
echo "database not found";
}
All three functions have been available since PHP 3.
snippet of how things change.
instead of
References
mysql-db-query.php
mysql-select-db.php
mysql-query.php
PHP since 4.06 has deprecated this function mysql_db_query, that actually I used a lot. Now I like this function as in one function, I pass the database name, the SQL query and the connection resource link which is optional
resource mysql_db_query ( string database, string query [, resource link_identifier] )
Instead they are now asking that we do the following. Two things that could be done in one
mysql_select_db()
bool mysql_select_db ( string database_name [, resource link_identifier] )
mysql_query()
resource mysql_query ( string query [, resource link_identifier] )
The advantage I see is that you can actually check to see if the database is present before doing the query.
if ( ! mysql_select_db (database )){
echo "database not found";
}
All three functions have been available since PHP 3.
snippet of how things change.
Config File
------------------
$dbuser="aaaa";
$dbpass="bbbb";
$dbhost="cccc:3308";
$db="dddd";
$dblink=mysql_connect($dbhost,$dbuser,$dbpass)or die("you have an error connecting your database");
mysql_select_db($db,$dblink);
/*
mysql_select_db($db);; // is ok as the resource link is optional. Function will look for last open resource
*/
Query
----------
$query ="SELECT * FROM TABLENAME";
mysql_query($query,$dblink);
/*
mysql_query($query); // is ok as the resource link is optional
*/
instead of
Config FileFew extra lines and it is worth it. I will start doing things this way now
------------------
$dbuser="aaaa";
$dbpass="bbbb";
$dbhost="cccc:3308";
$db="dddd";
$dblink=mysql_connect($dbhost,$dbuser,$dbpass)or die("you have an error connecting your database");
/* or
mysql_connect($dbhost,$dbuser,$dbpass)or die("you have an error connecting your database");
*/
Query
----------
$query ="SELECT * FROM TABLENAME";
mysql_db_query($db,$query,$dblink);
/*
or
mysql_db_query($db,$query);
*/
References
mysql-db-query.php
mysql-select-db.php
mysql-query.php
Monday, September 11, 2006
Wednesday, September 06, 2006
Centering a Div [Browsers and Quirks]
use tips on DIV model...
http://tutorials.alsacreations.com/modeles/
http://tutorials.alsacreations.com/centrer/
http://www.andybudd.com/archives/2004/02/css_crib_sheet_3_centering_a_div/index.php
http://tutorials.alsacreations.com/modeles/
http://tutorials.alsacreations.com/centrer/
http://www.andybudd.com/archives/2004/02/css_crib_sheet_3_centering_a_div/index.php
Subscribe to:
Posts (Atom)
Generate PFX file using OPENSSL on Windows
Had a situation where a client needed a PFX with password for a particular setup. This is something I have not done before, so here are the ...