Forum » Programiranje » [PHP]Internal Server error 500
[PHP]Internal Server error 500
KernelPanic ::
Spostovani!
Na svojem serverju probam pognati sledeco skripto:
Na svojem serverju probam pognati sledeco skripto:
<?php session_start(); if($_SERVER["REQUEST_METHOD"]=="POST") { $hostname_localhost ="localhost"; $database_localhost ="test"; $username_localhost ="test"; $password_localhost ="test"; $localhost=mysql_connect($hostname_localhost, $username_localhost, $password_localhost) or die(mysql_error()); echo "Connected to Server.<br/>"; mysql_select_db($database_localhost) or die(mysql_error()); echo "Connected to Database.<br/>"; $username=mysql_real_escape_string($_POST['username']); $password=mysql_real_escape_string($_POST['password']); $query_user=mysql_query("SELECT id_customer, lastname, firstname FROM ps_customer WHERE email=$username AND passwd=$password"); $number_of_users=mysql_num_rows($query_user); if($number_of_users==1) { echo "User found.<br/>"; } else { echo "User not found.<br/>; } // if } // if ?>Ko jo pozenem, mi browser javi:
HTTP/1.0 500 Internal Server ErrorKo grem gledat v /var/log/apache2/error.log pa dobim:
[Thu Apr 19 19:49:18 2012] [error] [client xxx.xxx.xxx.xxx] PHP Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in /var/www/zenit-ms-real.com/php/login.php on line 36Skripto urejam z urejevalnikom vi in ni mi jasno, kje je napaka. Mi lahko kdo pomaga?
x3ca ::
Manjka ti narekovaj pri zadnjem echu. Pa sej to vids ze iz tega kako forum kodo pobarva.
Zgodovina sprememb…
- spremenila: x3ca ()
KernelPanic ::
keworkian ::
Saj če pogledaš kodo k si jo prpopal bi vidu da nimaš obarvan string...
Obscenities in B-Flat
Zgodovina sprememb…
- spremenil: keworkian ()
KernelPanic ::
Saj če pogledaš kodo k si jo prpopal bi vidu da nimaš obarvan string...Ja, vse je to res, ampak vijlocna in rdeca sta mi bile ze enaki ... :D Ok, zdej pa zares matr. Ko to funkcijo poklicem skozi HttpPost v sledeci metodi:
private void loginToDatabase(final String strUsername, final String strPassword) { HttpClient client=new DefaultHttpClient(); HttpPost post=new HttpPost("http://mojadomena.com/php/login.php"); HttpResponse response=null; try { List<NameValuePair> loginInfo=new ArrayList<NameValuePair>(2); loginInfo.add(new BasicNameValuePair("username", strUsername)); loginInfo.add(new BasicNameValuePair("password", strPassword)); post.setEntity(new UrlEncodedFormEntity(loginInfo)); response=client.execute(post); } catch(Exception e) { int i=0; } finally { } // try-catch-finally } // loginToDatabasekaj mi mora server vrniti, oz. kaj se manjka (v tej metodi), da se logiram v bazo z username in password?? In kako mi naprimer php skripta vrne stevilo zadetkov (userjev z username in password) v bazi moji aplikaciji, ki tece na android platformi?