Thread: Script error
View Single Post
  #5  
Old 04-30-2012, 02:28 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 333,837
Hall of Famer is on a distinguished road
Default

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:
$tabname=@mysql_result($data$i,"name"); 
to

PHP Code:
$tabname=$row->name
And now the $tabname will not be malfunctioning. However I strongly recommend you to remove all lines associated with $i since its totally unnecessary.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote