title: Retrieving sql data in iframes
body: <p>I have a php script (ini.php), that open in an iframe inside of "main.php":
   <code>&lt;iframe src='ini.php' style='width:650px;' frameborder='0' id="IDMain" allowtransparency="YES" scrolling="NO"&gt;&lt;/iframe&gt;</code>
  The SQL does not retrieve the data in "ini.php".
  But if I incorporate the code of "ini.php" in "main.php", without using an iframe, the query retrieves all the information.
  I must have an iframe in order to change all the different scripts in the same iframe.
  Any help here?
  Thanks</p>
  
  <p>In addition more information:</p>
  
  <p>The main.php is in session after logged. Previously I had the whole frame repeated in each script, and everything was ok.main.php, ini.php, and so on. Each script with header, left, right, main and footer. To make it faster and easier I decide to make the main script called main.php, that with an included script called config.inc.php that has several functions, also  connects to data base, to retrieve some data to the header,  left , right and footer sides of the main area (iframe) where the others different scripts, just to  opens inside of a iframe, maintaining the information around. Each script, (like ini.php), that runs in the iframe also include the config.inc.php file, to connect as well to database. But does not retrieve any information
  The connection to database in config script is:</p>
  
  <p><code>&lt;$connect=mysql_connect ("localhost","database","password") or die ('I cannot connect to the database because: ' . mysql_error());
  mysql_select_db ("database", $connect) or die ("'I cannot connect to the database ");  &gt;</code></p>
  
  <p>The query in ini,php (and others) is:</p>
  
  <p>`</p>
  
  <pre><code> if ($id) { 
  $id_session=$_SESSION['id_session'];
  $namesession=$_SESSION['name_session'];
  $sql="select * from data where id='$id_sessino' limit 1 ";
  $result=mysql_db_query("database",$sql);
  $regist=mysql_fetch_array($result);
  $id=$regist["id"];
  $id_session=$regist["id"];
  $namesession=$regist["name_session"]; 
  $country=$regist["country"];
  And soo on…
  } 
  </code></pre>
  
  <p>`</p>
  
  <p>I hope with is information it makes it clear what do I mean. Thank you</p>