If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Join Issue

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-23-04, 11:11
petenyce105 petenyce105 is offline
Registered User
 
Join Date: May 2004
Posts: 86
Join Issue

have a login procedure. i have a database called test where my login information is stored. i ahve a database called info where my information is stored. in both tables their is a key called userid. When a person logs in with their own username i want to show them their only information.

you guys gave me this example and it returs this error
Parse error: parse error, unexpected T_STRING in /home/ehpadmin/http/docroot/secretdb.php on line 84


<?
$searchtype =$HTTP_POST_VARS['name'];
$conn = mysql_connect("lt","e","9t");
mysql_select_db("eh",$conn);
SELECT * FROM mem
LEFT JOIN test on test.EHPID = mem.EHPID
where test.name='someusername'
$result=mysql_query($sql,$conn) or die(mysql_error());
while ($row = mysql_fetch_assoc($result)){
$firstname=$row['First'];
$lastname=$row['Last'];
echo '<font size=\"2\">Welcome,<font color="Black"><b><font size=\"2\">&nbsp;'.($firstname).'&nbsp;'.($lastnam e).'</font></b } ?>

Much Help Needed thanks
Reply With Quote
  #2 (permalink)  
Old 12-23-04, 11:26
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
those aren't databases, those are tables, a database is something else

you say they're called test and info but your query uses mem and test

the join looks okay to me

if you have php issues, perhaps this question should be in the php forum?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 12-23-04, 13:20
matt_p matt_p is offline
Registered User
 
Join Date: Dec 2004
Location: Europe
Posts: 20
Putting an
$sql = " ............................ "; around your select may help here

(This is no "embedded sql" with precompiler like oracle or DB2 )
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On