chipmunken Posted May 17, 2009 Share Posted May 17, 2009 Ok here is the deal. I have built an product catalog and everything works fine untill I decided to implement an iframe where the product specifications are. First I hade all code on same page and it all worked fine. Then I migrated the print code to the iframe and I get errors. Here is my main catalog page that works. print nl2br (mysql_result($result_info, "info")); This line works here but not in the iframe ??? I have put the iframe and just below this line. <?php if (!defined('SECURITY')) { exit; } function katalog($items, $dir='') { $sub=$_GET['sub']; $info=$_GET['info']; // Fetches the catagories from the menu table $sqlmeny = "SELECT * FROM `meny` LIMIT 0 , 30"; $meny=mysql_query($sqlmeny); $countmeny=mysql_num_rows($meny); if ($info > 0){ // Fetches the product that is shown on the right side $sql_bild = "SELECT photo FROM `sbjbs_product_info` WHERE `id_contact` LIKE '$info' LIMIT 0 , 30"; $result_bild=mysql_query($sql_bild); $sql_product = "SELECT product FROM `sbjbs_product_info` WHERE `id_contact` LIKE '$info' LIMIT 0 , 30"; $result_product=mysql_query($sql_product); $sql_info = "SELECT info FROM `sbjbs_product_info` WHERE `id_contact` LIKE '$info' LIMIT 0 , 30"; $result_info=mysql_query($sql_info); } // Gets all product's that is going to be listed in the submenu $sql = "SELECT * FROM `sbjbs_product_info` WHERE `katigori` LIKE '$sub' LIMIT 0 , 30"; $result=mysql_query($sql); $count=mysql_num_rows($result); $pil1 = 'box_3-03.png'; $bg1 = ''; $text1 = '000000'; $pil2 = 'box_3-03_2.png'; $bg2 = ''; $text2 = '000000'; $pil3 = 'box_3-03.png'; $bg3 = ''; $text3 = '000000'; ?> <table width="560" border="0" cellpadding="0" cellspacing="0" class="box_4"> <tr> <td colspan="2" height="7"><img src="images/box_4/box4_01.png" alt="" /> </td> </tr> <tr> <td colspan="2" align="left" valign="top" class="box_4_content"> </td> </tr> <tr> <td width="257" align="left" valign="top" class="box_4_content_k"> <? // ******************************** START OF MENU LOOP ******************************** while($menyrows=mysql_fetch_array($meny)){ ?> <table border="0" cellpadding="0" cellspacing="0"> <td height="2"> </td> <td height="2" width="210"> <? if ($sub == $menyrows['id']){ echo '<img src="/images/box_13/liten/box13_01_w210.png" alt="" border="0">'; } ?> </td> <tr> <td valign="top"> <? if ($sub == $menyrows['id']){ echo '<img src="/images/box_3/' . $pil2 . '" alt="" height="9" width="9" border="0"> '; } else {echo '<img src="/images/box_3/' . $pil1 . '" alt="" height="9" width="9" border="0"> ';} ?> </td> <td width="210" <? if ($sub == $menyrows['id']){ echo 'class="kat2"'; } ?> > <a href="?lang=en&sec=products&sub=<? echo $menyrows['id']; ?>"> <div style="color:#<? echo $text1; ?>"> <? echo $menyrows['kat']; ?></div> </a> <? if ($sub == $menyrows['id']){ while($rows=mysql_fetch_array($result)){ ?> <div style="font-size:9px"> <a href="?lang=en&sec=products&sub=<? echo $sub; ?>&info=<? echo $rows['id_contact']; ?>" target="" alt="<? echo $rows['product']; ?>"><? echo $rows['product']; ?></a></div> <? } } ?> </td> </tr> <tr> <td height="13"> </td> <td <? if ($sub == $menyrows['id']){ echo 'class="kat3"'; } ?> height="13"> </td> </tr> </table> <? } //******************************** END OF LOOP ******************************** ?> </td> <td width="257" align="center" valign="middle" class="box_4_content_k"><table width="254" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="139" align="left"><? if ($info > 0){ ?> <div align="center" style="font-size:12px; font-size:larger;"><? print(mysql_result($result_product, "product")); ?> </div> <div align="center"><img src="system/images/product/<? print(mysql_result($result_bild, "photo")); ?>" alt="" width="92" /></div> <? } ?> </td> </tr> <tr> <td> <? if ($info > 0){?> <div align="left" style="font-size:12px;"> <? //******************* PROBLEM AREA ********************* // Here I used to print out the product info like this. // And it works fine. When I move this line into the iframe I get error. print nl2br (mysql_result($result_info, "info")); ?></div> <iframe name="product_iframe" id="product_iframe" frameborder="0" height="120" width="257" scrolling="auto" src="/sections/components/product_iframe.php"> </iframe> <? //******************* END OF PROBLEM AREA ********************* } ?></td> </tr> </table></td> </tr> <tr> <td colspan="2" height="43"> <img src="images/box_4/box4_03.png" alt="" /></td> </tr> </table> <?php } ?> Here is my iframe file with exact same line that dosent work ??? <?php include_once "myconnect.php"; $info=$_GET['info']; $sql_info = "SELECT info FROM `sbjbs_product_info` WHERE `id_contact` LIKE '$info' LIMIT 0 , 30"; $result_info=mysql_query($sql_info); echo '<div align="left" style="font-size:12px;">'; print nl2br (mysql_result($result_info, "info")); //print $result_info['info']; //while($svar=mysql_fetch_array($result_info)){ //echo $svar['result_info']; //print(mysql_fetch_assoc($result_info, "info")); // mysql_fetch_assoc echo '</div>'; ?> Here is my error Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in product_iframe.php on line 24 Link to comment https://forums.phpfreaks.com/topic/158475-solved-problem-with-printing-in-iframe/ Share on other sites More sharing options...
chipmunken Posted May 17, 2009 Author Share Posted May 17, 2009 Since I have an iframe inside my working php page cant I just _POST the variabel and then print it? Ill do some testing on this matter.. Or is there something I dont know when working with iframes in php? Link to comment https://forums.phpfreaks.com/topic/158475-solved-problem-with-printing-in-iframe/#findComment-835810 Share on other sites More sharing options...
chipmunken Posted May 17, 2009 Author Share Posted May 17, 2009 Im stuck on this problem, a pointer in the right direction woulde be very thankful. Link to comment https://forums.phpfreaks.com/topic/158475-solved-problem-with-printing-in-iframe/#findComment-835844 Share on other sites More sharing options...
chipmunken Posted May 18, 2009 Author Share Posted May 18, 2009 Ok now I have found the problem. It was with the _GET function that dident fetch the &sub=3&info=54 from my address bar so my SQL query dident fetch anything. Now I just need to understnad why the $info=$_GET['info']; dont work in my iframe. Link to comment https://forums.phpfreaks.com/topic/158475-solved-problem-with-printing-in-iframe/#findComment-836283 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.