Jump to content
php.lv forumi

help.


daviskrex

Recommended Posts

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 by daviskrex
Link to comment
Share on other sites

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 by daviskrex
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...