PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
RobertGonzalez
Site Administrator
Posts: 14293 Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA
Post
by RobertGonzalez » Fri Oct 06, 2006 2:54 pm
Code: Select all
$sql = "SELECT street, city, state, phone FROM customer WHERE user_name = '{$_SESSION['logname']}'";
Notice the single quotes around the string.
Obadiah
Forum Regular
Posts: 580 Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:
Post
by Obadiah » Fri Oct 06, 2006 2:59 pm
everah and volka...thanks
you guys are awsome!
[edited]
just one thing....what was the difference in the quotes i got to know?
RobertGonzalez
Site Administrator
Posts: 14293 Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA
Post
by RobertGonzalez » Fri Oct 06, 2006 3:02 pm
MySQL treats unquoted strings as field names (unless they are integers).
Obadiah
Forum Regular
Posts: 580 Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:
Post
by Obadiah » Sat Oct 07, 2006 10:05 am
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?
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Sat Oct 07, 2006 10:17 am
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>
Obadiah
Forum Regular
Posts: 580 Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:
Post
by Obadiah » Mon Oct 09, 2006 11:11 am
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?