Hi,
I have a simple problem but cannot manage to solve quickly.
I have the following script:
$db_name = \"database\";
$table_name = \"users\";
$connection = @mysql_connect(\"localhost\", \"xxx\", \"yyyyy\") or die(\"Couldn\'t connect.\");
$db = @mysql_select_db($db_name, $connection) or die(\"Couldn\'t select database.\");
$sql = \"SELECT * FROM $table_name WHERE username = \\"$username\\" AND password = password(\\"$password\\")\";
$result = mysql_query($sql) or die (\"Can\'t execute query.\");
$num = mysql_numrows($result);
if ($num != 0) {
echo \"<P>Congratulations $username, you\'re authorized!</p>\";
Now i have a different script in where i want to make use of the $username variable to allow guest users only to show say 10 records:
$sql = \"SELECT row_id, date, location FROM $table_name where location = trim(\\"$location\\") \";
so if it is the guest user i use LIMIT 5 and if it is say the Administrator user i do not want to use the LIMIT string.
So depending on the value of the $username i wish to build a different $sql string.
But whatever i do i cannot seem to make use of the $username variable which is filled in the earlier used logon script.
What am i doing wrong ??
Greetz Chris