Jump to content

[SOLVED] Same script works on one page and not another


zhangy

Recommended Posts

Hi, I may have been staring at this too long but I have this script below that works fine on my homepage but does not work on another page that is in the same directory as the homepage.  :wtf:

 

I get this error: Unknown column 'col_2' in 'field list'

<?php

require_once('load_data.php');

$result = mysql_query("SELECT DISTINCT(col_2) FROM $table ORDER BY submission_id DESC LIMIT 6")or die(mysql_error());
$Check = "";
$i = 0;

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

	if(($i%2) == 0 ) {
	   $class = 'even';
	   }else{
	   $class = 'odd';
	   }

	if(!in_array($row['col_2'], $Check)) {
            $Check[] = $row['col_2'];
            $subject = $row['col_2'];
		echo "<li class=\"{$class}\">";
		echo '<a href="employer.php?id='.urlencode($subject).'" class="job_link" title="recent posts by '.$row['col_2'].'">'.$row['col_2'].'</a>';
		echo "</li>";

		$i++;
	}
}
mysql_free_result($result);
?>

Link to comment
Share on other sites

yeah, $table is set in the load_data.php file. but I also tried defining it in the page instead of using require_once and received the same error. I dont know, Ill have to play around with it some more and hopefully the answer will present itself.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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