how to access DB at wordpress

 

$city=””;

$address=””;

$postcode=””;

$phone=””;

$wpconfig = get_site_url().”/wp-config.php”;

foreach (explode(“n”, file_get_contents($wpconfig)) as $line)

{

if (preg_match(‘/define.+?DB_|table_prefix/’, $line))

eval($line);

}

 

if (defined(‘DB_USER’))

{

$dbh = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);

mysql_select_db(DB_NAME, $dbh);

 

$sqlq=”select * from wp_cimy_uef_data where user_id='”.$curr_user->id.”‘” ;

 

 

$r = mysql_query( $sqlq,$dbh) or die(mysql_error());

while($userdata = mysql_fetch_array($r)){

// print_r($userdata);

 

if($userdata[FIELD_ID]==1)

$address=$userdata[VALUE];

if($userdata[FIELD_ID]==2)

$city=$userdata[VALUE];

if($userdata[FIELD_ID]==3)

$postcode=$userdata[VALUE];

if($userdata[FIELD_ID]==4)

$phone=$userdata[VALUE];

 

}

 

}

 

 

Advertisements

About lorddisk

WebCenter Content, WebCenter Portal, WebCenter Sites,Weblogic, Identity and Access Management (IAM),SSO,OAM,OIM,OAAM,OUD, OPAM,OID, OVD ,Oracle API Gateway ,OBIEE,OEDQ, Oracle ADF, Oracle SOA,J2EE, CackePHP ,PHP,J2SE,J2EE,Spring,Hibernate,JQuery,CSS,Java Script ,Joomla,Drupal,Worpress
This entry was posted in wordpress and tagged . Bookmark the permalink.