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?

Edited by sagive: forgot Something

6 Years
Discussion Span
Last Post by sagive

try this

SELECT * FROM ProfilesWebsites LEFT JOIN ProfilesAccounts 
ON ProfilesWebsites.ProfileWebsiteName = ProfilesAccounts.ProfileWebsiteName
Votes + Comments
Helped me a lot, thanks

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..

Edited by sagive: added some data


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

Thanks a lot :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.