I wish to extract everything from Web as a result of a username variable I have.
I have three tables:
User (username, password, bizname, etc etc)
Biz (bizname, bizstatus, add1, add2 etc etc)
Web (bizname etc, and other fields)
I have the Username variable (as a result of my login script, which should equal user.username) and wish to extract everything from Web where user.bizname=biz.bizname and then subsequently where biz.bizname=web.bizname.
Simon
How do I write a query to achieve the following:
Moderator: General Moderators
Okay.
How about you select everything from the username row and put bizname into a variable, say $biz. The do an SQL query something like
Remember to use [php_man]add_slashes[/php_man]:
How about you select everything from the username row and put bizname into a variable, say $biz. The do an SQL query something like
Code: Select all
SELECT * FROM Biz WHERE bizname = '$biz'Code: Select all
<?php
$biz = addslashes($biz);
?>Code: Select all
SELECT
Web.*
FROM
User,
Biz,
Web
WHERE
Biz.bizname = User.bizname AND
Web.bizname = Biz.biznameReal programmers don't comment their code. If it was hard to write, it should be hard to understand.