Jump to content

[SOLVED] MySQL join problem


atticus

Recommended Posts

I am getting an error from the following code

 

<?php
include("config.php");
$sql = "SELECT clients.*,company.company_name FROM client,company WHERE client.com_id = company.com_id ORDER BY company_name";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)) {
echo "<div class=\"result\"><h4>".$row['company_name']." </h4><br /><a href=\"com_editor.php?com_id=$row[com_id]\">Edit Company</a>  |  <a href=\"com_delete.php?com_id=$row[com_id]\">Delete Company</a><br />";
echo "<label>Name:</label> ".$row['lastname'].", ".$row['firstname']."<br /> ";
echo "<label>User Name:</label> ".$row['username']."<br /> </div>";

 

error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in line:

while($row = mysql_fetch_array($query)) {

Link to comment
https://forums.phpfreaks.com/topic/82059-solved-mysql-join-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.