daviskrex Posted July 17, 2009 Report Share Posted July 17, 2009 (edited) Sveiki, izdomāju likt visus lapas paneļus mysql datubāzēs. Viss, itkā strādā, bet saskāros ar problēmu izvelkot php variabļus no mysql datubāzes t.i. php kods: $q = mysql_query("SELECT * FROM panels WHERE panel_id=1 Order by position ASC"); while($row = mysql_fetch_array($q)){ print "<table class='panel' width='100%' cellspacing='0' cellpadding='0'>"; print "<tr><td class='head'>".$row['name']."</td></tr>"; print "<tr><td class='panel_content'>"; print $row['content']; print "</td></tr>"; print "</table>"; } un mysql ievietots kods: <table cellspacing=''0'' cellpadding=''0''> <tr><td>Sveiks, <?=$_SESSION[''login'']?></td></tr> <tr><td align=''center''><img src=''./images/users/avatar.jpg'' align=''center'' /></td></tr> <tr><td><a href=''#''>Profils</a></td></tr> <tr><td><a href=''#''>Vēstules</a></td></tr> <tr><td><a href=''#''>Banka</a></td></tr> <tr><td><a href=''index.php?do=logout''>Iziet</a> </td></tr></table> Viss jau itkā iet, bet šobrīd $_SESSION['login'] vietā rādās tukšums, bet savukārt lapas sourcē <tr><td>Sveiks, <?=$_SESSION['login']?></td></tr> Izmēģināju visvisādākos veidus, piemēram, ".$_SESSION['login']." utt, bet negāja... Varbūt kāds var palīdzēt, būtu neprātīgi pateicīgs. :) Edited July 17, 2009 by daviskrex Quote Link to comment Share on other sites More sharing options...
waplet Posted July 17, 2009 Report Share Posted July 17, 2009 (edited) Pamēģīni to SESSION['login'] vienpēdiņās aka <tr><td>Sveiks, <?php=$_SESSION['login']?></td></tr> Edited July 17, 2009 by waplet Quote Link to comment Share on other sites More sharing options...
daviskrex Posted July 17, 2009 Author Report Share Posted July 17, 2009 (edited) Pamēģīni to SESSION['login'] vienpēdiņās aka <tr><td>Sveiks, <?php=$_SESSION['login']?></td></tr> Ā, jā, piedod, bet tas sql kods bija kopēts no kaut kādiem sql action logiem, te ir īstais: <table cellspacing='0' cellpadding='0'> <tr><td>Sveiks, <?=$_SESSION['login']?></td></tr> <tr><td class='avatar'> <img src='./images/users/avatar.jpg' style='border: 1px solid gray' align='center' /></td></tr> <tr><td><a href='index.php?do=profile'>Profils</a></td></tr> <tr><td><a href='index.php?do=mail'>Vēstules</a></td></tr> <tr><td><a href='index.php?do=logout'>Iziet</a></td></tr> </table> Edited July 17, 2009 by daviskrex Quote Link to comment Share on other sites More sharing options...
mefisto Posted July 17, 2009 Report Share Posted July 17, 2009 Aklais ved aklo. Izmantot <?= ir ļoti ļoti ĻOTI slikts stils. Quote Link to comment Share on other sites More sharing options...
daviskrex Posted July 17, 2009 Author Report Share Posted July 17, 2009 Aklais ved aklo. Izmantot <?= ir ļoti ļoti ĻOTI slikts stils. nomainīju pret <? - still not working. Quote Link to comment Share on other sites More sharing options...
waplet Posted July 17, 2009 Report Share Posted July 17, 2009 varbūt tad raksti <?php print $_SESSION[login]; ?> tā nebūs pareizak iekš koda? Quote Link to comment Share on other sites More sharing options...
daviskrex Posted July 17, 2009 Author Report Share Posted July 17, 2009 varbūt tad raksti <?php print $_SESSION[login]; ?> tā nebūs pareizak iekš koda? Pareizāk būs, bet nope - not working Quote Link to comment Share on other sites More sharing options...
mefisto Posted July 17, 2009 Report Share Posted July 17, 2009 A tu vispār sesiju esi atvēris ? http://lv.php.net/manual/en/function.session-start.php Quote Link to comment Share on other sites More sharing options...
daviskrex Posted July 17, 2009 Author Report Share Posted July 17, 2009 Jā un tad, kad ieraksta vienkārši print $_SESSION['login'] izmet daviskrex. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.