I am banging my head against the wall here.
I've tried everything that I can think of to get this to work.
class myData {
function myStuff($sql){
$result = @mysql_query($sql,$connection) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$adId = $row['adId'];
$adName = $row['adName'];
$adData .= "my adId is $adId and guess what? my adName is $adName <br/><br/>";
}
}
}
Note, I am also using a "require_once" of a file which holds variables for
$connection = mysql_connect("localhost","maDB","maPassword") or die(mysql_error());
$db_name = "myDB";
$db = @mysql_select_db($db_name,$connection) or die(mysql_error);
in my index page I have the following
sql = "select * from tablename";
$objAdvertisers = new myData;
$objAdvertisers->myStuff($sql);
Using this method keeps giving me an error of
unexpected T_CLASS...
I've tried several other things, but I was almost sure that this was the way that it was sposed to work?
All I am trying to do is create a generic connect to database and pass $sql as an argument, then store some information based on that as an array for each record that matches my request.
I am using a PHP4 server.
Any help?
Thanks
Sage