[ul]ive been trying to get the sql query to work for a while now and Im pretty sure I need some help.
[php]<?php
$host=“localhost”; // Host name
$username=“root”; // Mysql username
$password=“password”; // Mysql password
$db_name=“CorviTesting”; // Database name
$tbl_name=“guestbook”; // Table name
$tbl_users=“users”;//table users
// Connect to server and select database.
mysql_connect("$host", “$username”, “$password”)or die(“cannot connect server “);
mysql_select_db(”$db_name”)or die(“cannot select DB”);
/Request session variable/
session_start();
echo "Username: “. $_SESSION[‘username’];
$sql= (“SELECT email FROM users WHERE username=’”.$_SESSION[‘username’].”’; ");
echo $sql;
$result= mysqlquery($sql);
echo "result= " ($result);
?>[/php][/ul]
I’m aiming to get it to return the email where the username is equal to the username of the person using that session.
when I echo the query and run it returns with the users email but i cant get the php to work with it.
the error message i’m getting is
[Tue Dec 18 12:09:49 2012] [error] [client 127.0.0.1] PHP Parse error: syntax error, unexpected ‘(’, expecting ‘,’ or ‘;’ in /var/www/CorviTestingVuln/CorviTesting/testemail.php on line 19
So it must be something to do with the variable $result.