OK, I'm new to PHP, and working with someone else's code. Kinda got thrust into this. I keep getting these two errors everytime someone tries use a online application page:

PHP Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in F:\home\admissions\application\appadmin\dataset.php on line 27

PHP Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in F:\home\admissions\application\appadmin\dataset.php on line 29

I've looked around at other issues involving this, but I can't seem to find anything similar to this code. Here is the code that it is referring to:

<?php
require("admApp.inc");
//require('index.php');
class datastuff{
	
	/**
	 * Returns a single record with all values
	 *
	 * @param string $t dB table
	 * @param string $a column name WHERE statement
	 * @param string $c column value for WHERE
	 * @param string $a2 AND col name
	 * @param string $c2 col value of AND
	 * @param string $o ORDER by value
	 * @param string $s sort order ASC DESC RAND
	 * @return Array of data values
	 */
	function getDataSimple($t,$a,$c,$a2,$c2,$o,$s){
		
		datastuff::dataSet();	
		$setSQL="SELECT * FROM ".db_name.".".$t." "; 
		$setSQL .= $a != "" ? "WHERE ".$a." = '".$c."'" : null; 
		$setSQL .= $a2 != "" ? " AND ".$a2." = '".$c2."'" : null; 
		$setSQL .= $o != "" ? " ORDER BY ".$o." ".$s.";" : null;
		
		$set = mysql_query($setSQL);
		$row_set = mysql_fetch_assoc($set);
				
		mysql_free_result($set);
				
		return $row_set;
	
	}
	
	/**
	 * Mysql connect
	 *
	 */
	function dataSet(){
		db_link;
	}
	
}
?>

Anyone see anything that doesn't look right in there? This is for an application that is completed online, sent to MySQL, and then from there the admin people can process it and send it on to another system called POISE. Any help in this would be greatly appreciated.

Thanks,
Charles...

Recommended Answers

All 2 Replies

comment the $set and $row_set lines and add this: echo($setSQL); and post the result here.

my guess is that the dataSet function should contain:

$db_link = mysql_connect($host, $user, $pass);

It looks incomplete.

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.