atticus Posted December 17, 2007 Share Posted December 17, 2007 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)) { Quote Link to comment Share on other sites More sharing options...
revraz Posted December 17, 2007 Share Posted December 17, 2007 Count how many records were returned before doing your array. Also, add a error report after the query to make sure it was accepted. Quote Link to comment Share on other sites More sharing options...
revraz Posted December 17, 2007 Share Posted December 17, 2007 Also, should clients be client here? SELECT clients.*, <---- Quote Link to comment Share on other sites More sharing options...
atticus Posted December 17, 2007 Author Share Posted December 17, 2007 thanks...I did find the query was not working because of a typo... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.