Jump to content

PHP classes


bioTIN

Recommended Posts

I have tried understanding classes in PHP, but I am not even able to start writing a class for the below code:

 

$fieldnames=mysql_list_fields(fcsubscription,regular);
$fieldnames1=mysql_num_fields($fieldnames);
for ($index=0; $index < $fieldnames1; ++$index) {
   $mysql_fields[mysql_field_name($fieldnames, $index)]=$cleantake[mysql_field_name($fieldnames, $index)];
}


$subnames=mysql_list_fields(fcsubscription,sub_details);
$subnames1=mysql_num_fields($subnames);
echo "total number is ".$subnames1;
for($index=0;$index<$subnames1;++$index){
    $sub_fields[mysql_field_name($subnames,$index)]=$cleantake[mysql_field_name($subnames,$index)];
    }

 

as you can see, I call for the field names from the database and then take values from an array based on the earlier retrieved field names. Now how do I go about writing a class with variables changing? If you could explain how a class could be created for this one line :$sub_fields[mysql_field_name($subnames,$index)]=$cleantake[mysql_field_name($subnames,$index)];

}

 

i think ill be able to manage with the others.

 

thanks

Link to comment
Share on other sites

i have to extract a lot info from mysql so i thought i could give classes a shot at. Well i did end up getting the result, but now im not able to extract it.

 

foreach($sub_details->mysql_fields as $key -> $value)

{

echo $key."->".$value;

 

}

 

throws an error, actually doesnt do anything, what should i do?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.