Posted by Praveen Dhyani on December 5, 2011 at 6:43am
I have made a Code is this right
Where and In Which file I use this code
<?php
$con = mysql_connect("localhost", "user", "user123!");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db("drupalweb", $con);
if (!$db_selected)
{
die ("Can\'t use test_db : " . mysql_error());
}
$query = db_select('test1_drupal');
$query->fields('test1_drupal', array('rollno', 'name','result'));
$query->condition('regno', $regno);
$result1 = $query->execute()->fetch();
drupal_set_message($result1->rollno);
drupal_set_message($result1->name);
drupal_set_message($result1->result);
mysql_close($con);
?>
Comments
You can't use this php code
You can't use this php code in Drupal.
Drupal communicate with DB in it's own manner.
If you can define what you want to achieve for your application then may be I can help you.
Feel free to write - Rajeevkr.hcas@gmail.com
Thanks.