Hey guys.. i have been having trouble with this script:

$con = mysql_connect("localhost","XXXXXXXXX","XXXXXXXX");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("XXXXXXX", $con);

echo "<table class='viewuserprofiles'>";
echo "<tr>";
echo "<td>שם האתר</td><td>סוג</td><td>קישור</td><td>משתמש</td><td>סיסמה</td><td>תיאור</td>";

$query = "SELECT * FROM ProfilesWebsites, ProfilesAccounts ".
 "FROM ProfilesWebsites LEFT JOIN ProfilesAccounts ".
	"ON ProfilesWebsites.ProfileWebsiteName = ProfilesAccounts.ProfileWebsiteName"; 
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result))
  {
echo "</tr><tr>";
echo "<td>" .$row['ProfileWebsiteName']. "</td>";
echo "<td>" .$row['ProfileWebsiteType']. "</td>";
echo "<td><a href='" . $row['ClientWebsiteUrl'] . "' target='_blank'>קישור לפרופיל</a></td>";
echo "<td>". $row['ProfileWebsiteUser'] ."</td>";
echo "<td>". $row['ProfileWebsitePass'] ."</td>";
echo "<td>". $row['profileWebsiteInfo'] ."</td>";
echo "</tr><tr>";
}

echo "<br style='clear: both' />";
echo "</table>";

if (!$result)
  {
  die('Could not connect: ' . mysql_error());
  }

got MySql 5+..

Can Anyone Spot the problem?

Recommended Answers

All 3 Replies

try this

SELECT * FROM ProfilesWebsites LEFT JOIN ProfilesAccounts 
ON ProfilesWebsites.ProfileWebsiteName = ProfilesAccounts.ProfileWebsiteName
commented: Helped me a lot, thanks +3

Thanks a lot man.. that works beautiflly

Got a question if could help a bit more :)

Can i show the LEFT JOIN value even when the othere table has no
value corresponding..??

am i making any sense?

______________________________________
| valueTABLE1 - |
| valueTABLE1 - valueTABLE2 |
| valueTABLE1 - valueTABLE2 |
| valueTABLE1 - |
| valueTABLE1 - |
---------------------------------------

Hope this makes it a little bit clearer.. got an idea?

Now what i am seeing is the objects on both tables
only when they both exist on both and i want to know where
i still need to insert for the "right (in this expample)" table
becouse the left table has a some value and the right
one is missing it..

Sorry, Please Ignore and thanks for your help..
i should just change the value i am comparing..

Thanks a lot :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.