Page 6 of 6

Posted: Fri Oct 06, 2006 2:54 pm
by RobertGonzalez

Code: Select all

$sql = "SELECT street, city, state, phone FROM customer WHERE user_name = '{$_SESSION['logname']}'";
Notice the single quotes around the string.

Posted: Fri Oct 06, 2006 2:59 pm
by Obadiah
everah and volka...thanks :) you guys are awsome!
[edited]

just one thing....what was the difference in the quotes i got to know?

Posted: Fri Oct 06, 2006 3:02 pm
by RobertGonzalez
MySQL treats unquoted strings as field names (unless they are integers).

Posted: Sat Oct 07, 2006 10:05 am
by Obadiah
ok...im wanting to do a logout and i was wondering if i could (like a submit buttons action property) call a php function with anchor tag here is my log out function...or my attempt....firstly ill ask if ive done it right

Code: Select all

function clearsessionscookies() 
{ 
    unset($_SESSION['auth']); 
    unset($_SESSION['logname']); 
     
    session_unset();     
    session_destroy(); 
}
assuming thats done correctly how do i use a link to point to it?

Posted: Sat Oct 07, 2006 10:17 am
by volka
Like always: Send a parameter within a new http request and let the script react on that parameter.

Code: Select all

<?php // whatever.php
function clearsessionscookies()
{
	unset($_SESSION['auth']);
	unset($_SESSION['logname']);

	session_unset();     
	session_destroy();
} 

if ( isset($_GET['action']) && 'logout'===$_GET['action'] ) {
	clearsessionscookies();
}
?>
<html>
	<head><title>...</title></head>
	<body>
		<a href="whatever.php?action=logout">logout</a>
	</body>
</html>

Posted: Mon Oct 09, 2006 11:11 am
by Obadiah
heres a weird question for you guys...say you want to populate a dropdown box with the file names in a specific folder...is their a way of doing that in php?

Posted: Mon Oct 09, 2006 11:45 am
by RobertGonzalez
Have a look at the PHP Filesystem functions. Please note this is a little off-topic for session usage.