/    Sign up×
Community /Pin to ProfileBookmark

That i have when i try my page :
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:xampphtdocsconsulter.php on line 9

My code :

<?php
mysql_pconnect(“localhost”,”root”,””) or die(“Impossible de se connecter”);
mysql_select_db(“retraite”) or die(“pas possible de trouver la base”);

[B]$result = mysql_query(“SELECT * FROM utilisateur where login= $_SESSION[‘login’]'”);[/B] //This is line 9
$nblignes = mysql_num_rows($result);

for ($i=0;$i<$nblignes;$i=$i+1)
{
$nom = mysql_result($result,$i,”nom”);

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@zenagMar 24.2008 — quote is not allowed inside $_session['login'].......

try this

$result = mysql_query("SELECT * FROM utilisateur where login='$_SESSION[login]'");
Copy linkTweet thisAlerts:
@HumadesauthorMar 24.2008 — mysql_pconnect("localhost","root","") or die("Impossible de se connecter");


mysql_select_db("retraite") or die("pas possible de trouver la base");


$result = mysql_query("SELECT * FROM utilisateur where login='$_SESSION[login]'");

$nblignes = mysql_num_rows($result) or exit(mysql_error() . "<br/>$requete");

Now i've this

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:xampphtdocsconsulter.php on line 13

Unknown column 'login' in 'where clause'


One idea ? :eek:
Copy linkTweet thisAlerts:
@zenagMar 24.2008 — do u have field name "login" in database?
Copy linkTweet thisAlerts:
@zenagMar 24.2008 — check for query in format..

$result = mysql_query("SELECT * FROM tablename where fieldname='$_SESSION[login]'");
Copy linkTweet thisAlerts:
@HumadesauthorMar 24.2008 — There is no "longin" in my database.

But i add when the user logged is account "

$_SESSION[login]=$login
Copy linkTweet thisAlerts:
@knowjMar 24.2008 — [code=php]
$result = mysql_query("SELECT * FROM utilisateur WHERE login='".$_SESSION['login']."'");
[/code]
×

Success!

Help @Humades spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...