![]()  | 
	
| 
		 
			 
			#1  
			
			
			
			
			
		 
		
	 | 
||||
		
		
  | 
||||
| 
		
	
		
		
			
			 
			
			I don't know how to get this to work with the new script. I've been trying since last night. 
		
		
		
		
		
		
			
		
		
		
		
		
	
	Code: 
	$query = "SELECT * FROM ".$GLOBALS['prefix']."tabs WHERE username = '".$GLOBALS['username']."'"; $result = runquery($query); $num = mysql_numrows($result);  | 
| 
		 
			 
			#2  
			
			
			
			
			
		 
		
	 | 
||||
		
		
  | 
||||
| 
		
	
		
		
			
			 
			
			Ok here is what I have so far and it isn't working LOL 
		
		
		
		
		
		
			
		
		
		
		
		
	
	Code: 
	function gettabs() {
$formcontent = "";
$data = $adopts->select("tabs", array("username", "name"), "username = '{$username}'")->fetchObject();
$num = count($data);
	$i=0;
	while ($i < $num) {
		$tabname=@mysql_result($data, $i,"name");
		$formcontent = $formcontent."<option value='myadopts.php?tab=".$tabname."'>".$tabname."</option>";
		$i++;
	}
	return $formcontent;
}
 | 
| 
		 
			 
			#3  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
			
			 
			
			Don't mix the old mysql_* functions with PDO. The two are very different. 
		
		
		
		
		
		
		
		
	
	PHP Code: 
	
			
	 | 
| 
		 
			 
			#4  
			
			
			
			
			
		 
		
	 | 
||||
		
		
  | 
||||
| 
		
	
		
		
			
			 
			
			ok now I have this.. and still not working. Bear with me. 
		
		
		
		
		
		
			
		
		
		
		
		
	
	Code: 
	function gettabs() {
$formcontent = "";
$result = $adopts->select("tabs", array("username", "name"), "username = '{$username}'")->fetchObject();
	$i=0;
	while ($row = $result->fetchObject()) {
		$tabname=@mysql_result($data, $i,"name");
		$formcontent = $formcontent."<option value='myadopts.php?tab=".$tabname."'>".$tabname."</option>";
		$i++;
	}
	return $formcontent;
}
 | 
| 
		 
			 
			#5  
			
			
			
			
			
		 
		
	 | 
||||
		
		
  | 
||||
| 
		
	
		
		
			
			 
			
			First of all, you are having an issue Id refer to as 'variable scope'. You are defining a function gettab() without passing any arguments, while the variable $username is undefined as a local variable inside your function. You either have to declare $username as global variable, or pass it as an argument to your function. Read this manual from PHP for reference: 
		
		
		
		
		
		
			http://php.net/manual/en/language.variables.scope.php On the other hand, you still use mysql_result() which no longer works with this new script as we are incorporating PDO. I thought Fadillzzz already explained clearly to you not to use mysql functions anymore... Now change this line: PHP Code: 
	
			
	PHP Code: 
	
			
	
				__________________ 
		
		
		
		
		
	
	![]() Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.  | 
| 
		 
			 
			#6  
			
			
			
			
			
		 
		
	 | 
||||
		
		
  | 
||||
| 
		
	
		
		
			
			 
			
			Ok another thing. I'm suppose to add this... 
		
		
		
		
		
		
			
		
		
		
		
		
			Code: 
	 AND ".constant("PREFIX")."owned_adoptables.tab = '{$tab}'
Is this correct for functions.php? Code: 
	function gettabs() {
$formcontent = "";
$result = $GLOBALS['adopts']->select("tabs", array("username", "name"), "username = '{$username}'");
	while ($row = $result->fetchObject()) {
		$tabname=$row->name; 
		$formcontent = $formcontent."<option value='myadopts.php?tab=".$tabname."'>".$tabname."</option>";
	}
	return $formcontent;
}
Last edited by SilverDragonTears; 04-30-2012 at 03:44 AM.  | 
| 
		 
			 
			#7  
			
			
			
			
			
		 
		
	 | 
||||
		
		
  | 
||||
| 
		
	
		
		
			
			 
			
			Umm are you trying to select from multiple tables? If so, use the method join() before calling select().
		 
		
		
		
		
		
		
			
				__________________ 
		
		
		
		
		
	
	![]() Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.  | 
| 
		 
			 
			#8  
			
			
			
			
			
		 
		
	 | 
||||
		
		
  | 
||||
| 
		
	
		
		
			
			 
			
			I figured it out :D Thank you for the help!
		 
		
		
		
		
		
		
			
		
		
		
		
		
	
	 | 
| 
		 
			 
			#9  
			
			
			
			
			
		 
		
	 | 
||||
		
		
  | 
||||
| 
		
	
		
		
			
			 
			
			Hmm... this pulls up everyone's tabs instead of just the logged in user 
		
		
		
		
		
		
			
		
		
		
		
		
			Code: 
	$result = $GLOBALS['adopts']->select("tabs", array("username", "name"), "username = '{$username}'");
heh. Code: 
	$result = $GLOBALS['adopts']->select("tabs", array("username", "name"), "username = '".$GLOBALS['username']."'");
Last edited by SilverDragonTears; 04-30-2012 at 04:49 PM.  | 
| 
		 
			 
			#10  
			
			
			
			
			
		 
		
	 | 
||||
		
		
  | 
||||
| 
		
	
		
		
			
			 
			
			Of course the old script wont work, didnt I tell you before that you need to worry about the variable scope issue? What is $username in your function? If you neither pass it as an argument to your function tab(), nor declare it as global variable, it will be considered an undefined variable.
		 
		
		
		
		
		
		
			
				__________________ 
		
		
		
		
		
	
	![]() Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.  | 
![]()  | 
	
	
		
		
  | 
	
		
  | 
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Parse error: syntax error, unexpected T_STRING | MikiHeart | Questions and Supports | 29 | 10-31-2013 01:46 AM | 
| ACP Error : Fatal error: Class 'AppController' not found in... | Isura | Questions and Supports | 39 | 06-17-2013 03:26 AM | 
| PHP Error on other script. | Tequila | Webmasters Area | 4 | 09-19-2012 07:38 AM | 
| Parse error: syntax error, unexpected T_ELSE in /home/.nyles/ | Saphira | Questions and Supports | 11 | 05-26-2009 12:45 PM | 
						What's New? | 
					
						What's Hot? | 
					
						What's Popular? |