如何通过包含在php [关闭]中获取并传递数据库值

如何通过包含在php [关闭]中获取并传递数据库值

问题描述:

I'm having a problem. here is my code.

$_GET['id']=2;
include 'operation/visual_console/render_view.php';

this code is ok. it gives the correct page with having the id=2. but i want is , to get that id value from the database. not by the hard-code it.

thank you.

EDIT

sorry for the poor coding.my data base connection is ok.i'll did it correctly.but the thing is this is my 1st post and i made some mistakes.so sorry for that again.and my question is solved by my self here is the new code and the above missing parts.

    <?php
    function map()
    {
    $con=mysql_connect("localhost","root","abc123@#");
    mysql_select_db("pandora", $con);

    // Check connection
    if (mysqli_connect_errno($con))
    {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }

    $idAgent = (int)get_parameter('id_agente', 0);
    $lidAgent = db_get_value('id_layout', 'tlayout_data', 'id_agent', $idAgent);
    $_GET['id']=$lidAgent;

    include 'operation/visual_console/render_view.php';

    }
    mysqli_close($con);
    ?>

so now it's ok.thank you for bothering about me.

mysql_connect(host,username,password,dbname);

$result=mysql_query($con,"select * from pages where ...");

$result contain your ID value......