how to query database from index.php - Joomla! Forum - community, help and support


hi...iam new joomla .i know html css iam struck in template.iam designing front page of template same shine.yahoo.com need query database directly front end..

question 1: secure query database directly frontend(using simple php functions like
mysql_select_db("my_db",$con);

$sql_query="select * student_database roll_no=".$_get['searchbox'];

if(mysql_query($sql_query,$con))
$result=mysql_query($sql_query,$con);
echo "roll-no : ".$row->roll_no."<br/>";)

if not should do..

question 2 :i want show picture associated article on left side of article,its easy can retrieve picture databse,but see picture in database stored in content column other lines of articles cannot retrieve image alone.i see there columnn in jos_content named "image" empty.
how can put image associated article in image column of jos_content
admin area of joomla.

question 3 : u see iam directly fetching data how can put readmore link work like(what function read more , how can call it) ...

please take time give @ shine.yahoo.com , please try me , deadline approaching godzilla , have wasted time googling it....even little highly appreciated..

hello!

i know deadlines difficult if find little time learn joomla better job job easier, better , faster.

1. can use joomla functions database:

code: select all

//if using other database joomla use this, if not delete next row
$db2= new jdatabasemysql( array('host'=>'localhost', 'user'=>'root', 'password'=>'1234', 'database'=>'my_db_name') );

//if using same database joomla use this, if not delete next row
$db2 =& jfactory::getdbo();

$sql="select * student_database roll_no=".$db2->quote($_get['searchbox']);
$db2->setquery($sql);
$result=$db2->loadobject();

echo "roll-no : ".$row->roll_no."<br/>";



2. joomla developers sentimentally attached old database structure left field backward compatibility. images inside article html belong.
you don't have create new layout, little css enough. images in articles on shine.yahoo.com aligned left.

3. why want create same function allready integrated in joomla? can split intro text rest of text with:

code: select all

$pattern = '#<hr\s+id=("|\')system-readmore("|\')\s*\/*>#i';
list($introtext, $othertext) = preg_split($pattern, $fulltext, 2);





Comments

Popular posts from this blog

CS5 Adobe Media Encoder: Encode failed because the source duration is nil.

cf_sql_integer vs cf_sql_bigint vs cf_sql_int??

localhost/joomla15/administrator doesnt work - Joomla! Forum - community, help and support