Jump to content

Ezio

Members
  • Posts

    42
  • Joined

  • Last visited

Posts posted by Ezio

  1. Hey guys,

    I have a base 64 encoded data of a video and i need to save it to the server, and view it later.

    How do i do that...i know how to do that for images..but for videos i have no idea..any help?

  2. How do i display a message in yii with a link using "setflash"

     

    in my controller it is:

     Yii::app()->user->setFlash('index','Password Reset Successful click here to login');

    and in my view:

    echo Yii::app()->user->getFlash('index');  

    what i want to do is the "click here" text would be a link to the login page(site/login)..

    ...any ideas??

  3. Hey guys,

     

    here is the problem that i am having, i am connecting to the server using these lines:

    $link = mysql_connect('localhost', 'username', 'password');if (!$link) {    die('Not connected : ' . mysql_error());}

    it shows the following error:

    Not connected : No connection could be made because the target machine actively refused it.

    what am i doing wrong..??

  4. Don't immediately push the new array onto the other array. Create it as a variable first:

    $cat = array("category id" => $row->category_id,"category name" => $row->category);

    Then add your subcategory data to the $cat array, and after it's done then push $cat onto $category_data. You can also refer to the last element as $category_data[count($category_data) - 1].

    will try your way and see if it works :-)

  5. what does the error say? and you might want to remove those spaces from category id and name also remove the [] from them

    it does not shows an error, it just shows a blank page when i print_r the array...so there must be some error in my code...

    & i have removed the errors that you said still with no luck :-(

  6. I did that something like this:

     

     

    $category_data = array();while ($row = mysql_fetch_object($category_query)) { $category_data[] = array( "category id" => $row->category_id, "category name" => $row->category; ); $sub_query = mysql_query("SELECT * FROM subcategories WHERE category_id ='".$row->category_id."';"); $num_subcategory = mysql_num_rows($sub_query); if($num_subcategory > 0){ while ($sub_row = mysql_fetch_object($sub_query) { $subcategory_id[] = $sub_row->subcategory_id; $subcategory_name[] = $sub_row->subcategory;

    }

    }

     

     

    then i have to take it into $category_data[ ] array..that is where i get the error..

  7. i have 3 tables in mysql categories, subcategories, values.

     

    now i want to get the values from categories table then count the number of values returned if it is greater than 0 then i fetch the category id from the categories table using while loop, next i check if the subcategory table has any data with the category id that i got from previous table if number of values is greater than 0 then i fetch the subcategory id from the subcategories table using while loop, now again i check the values table, if it has any data with subcategory id, if it is greater than 0 then i fetch all the values...

     

    my code looks something like this...

     

    $category_query = mysql_query("SELECT * FROM categories"); $num_category = mysql_num_rows($category_query); if($num_category > 0){ while ($row = mysql_fetch_object($category_query)) { $category_id[] = $row->category_id; $category_name[] = $row->category; $sub_query = mysql_query("SELECT * FROM subcategories WHERE category_id ='".$row->category_id."';"); $num_subcategory = mysql_num_rows($sub_query); if($num_subcategory > 0){ while ($sub_row = mysql_fetch_object($sub_query) { $subcategory_id[] = $sub_row->subcategory_id; $subcategory_name[] = $sub_row->subcategory; } for ($j=0; $j < $num_subcategory; $j++) { $subcategory_data[] = array("subcategory id"=> $subcategory_id[$j]); } } } for($i=0; $i<$num_category; $i++){ $category_data[] = array("category id"=>$category_id[$i], "category name"=>$category_name[$i],); }

    i want to get the subcategory_data[] into category_data[]...........i cannot figure this out.. :-(

  8. Hey guys,

    I was wondering if there is a way by which i can insert the local date and time of a user anywhere around the world in my phpmyadmin using php..??

    ...means suppose if a user logins from newyork, i save the local date and time of that user, and the same code would help me to save the local date and time of some other user logging from a different location, say london..How do i do that..??

  9. I have saved the users subscription date and time using now() in the database and when a user logs in to his profile i subtract the current date and time from the date and time from database to check if a month has passed or not..

    ..it works fine if i take a static days of 30 but what if a month has 31 days..??

  10. Actually i wanted to fetch the date & time from my mysql database (I had used now() to store the date and time) and subtract it later with the current date and time to check if x number of months has passed or not.

  11. Something like this:

     

    if($current_date_time - $date_time_from_db > 30){

     

    echo"1 month has passed please register."

     

    }else{

    echo "Carry on";

    }

     

     

    please help.

×
×
  • Create New...