User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 374,010 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,880 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 159 | Replies: 2
Reply
Join Date: May 2008
Posts: 4
Reputation: CBnewbie is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
CBnewbie CBnewbie is offline Offline
Newbie Poster

PHP problem...

  #1  
May 7th, 2008
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...
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2008
Location: UK
Posts: 51
Reputation: xan is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 10
xan's Avatar
xan xan is offline Offline
Junior Poster in Training

Re: PHP problem...

  #2  
May 7th, 2008
comment the $set and $row_set lines and add this: echo($setSQL); and post the result here.
Reply With Quote  
Join Date: Jul 2006
Location: Remunj
Posts: 142
Reputation: pritaeas is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 16
pritaeas's Avatar
pritaeas pritaeas is offline Offline
Junior Poster

Re: PHP problem...

  #3  
May 7th, 2008
my guess is that the dataSet function should contain:

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

It looks incomplete.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 10:43 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC