Jump to content

visken

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

visken's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I am quite new to MySQL and need some help with uploading data from a textfile. The file looks as: 1|Toy Story (1995)|01-Jan-1995||http://us.imdb.com/M/title-exact?Toy%20Story%20(1995) 2|GoldenEye (1995)|01-Jan-1995||http://us.imdb.com/M/title-exact?GoldenEye%20(1995) 3|Four Rooms (1995)|01-Jan-1995||http://us.imdb.com/M/title-exact?Four%20Rooms%20(1995) 4|Get Shorty (1995)|01-Jan-1995||http://us.imdb.com/M/title-exact?Get%20Shorty%20(1995) 5|Copycat (1995)|01-Jan-1995||http://us.imdb.com/M/title-exact?Copycat%20(1995) I have a proble with uploading this file because of the brackets. I woul like to have the information between brackers in a column. If this is unpossible I would like to have the date (eg 01-Jan-1995) in a column as timestamp. Does anyone knows how I could do this?
  2. ok thank you. But I want the index of the array started at 1 instead of 0. Any idea how to do that? [!--quoteo(post=384167:date=Jun 15 2006, 03:32 PM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ Jun 15 2006, 03:32 PM) [snapback]384167[/snapback][/div][div class=\'quotemain\'][!--quotec--] [code] $m = '0/1'; $x = 5; //number of n's $y = 5; //number of m's for ($count1 = 0;$count1 < $x;$count1++) {    for ($count2 = 0;$count2 < $y; $count2++) {       $blah2[] = $m;    }    $blah1[] = $blah2; } [/code] p.s.- you shouldn't double post threads. instead, try to be clearer in your first thread [/quote]
  3. Hi all, I am new to PHP and need your help to contruct the following array: (n is number of user and m is number of movies) [code] array ([1]=>array([1]=>0/1                          [2]=>0/1                          [3]=>0/1                    ...                          [m]=>0/1 array ([2]=>array([1]=>0/1                          [2]=>0/1                          [3]=>0/1                    ...                          [m]=>0/1 ...... array ([n]=>array([1]=>0/1                          [2]=>0/1                          [3]=>0/1                    ...                          [m]=>0/1 [/code] Do you have any idea how I can make this work in PHP? Thank you for your help!!!
  4. Hi maybe I have explained my problem not well. Therefore my first problem: How do you create the following array? (n is number of user and m is number of movies) [code] array ([1]=>array([1]=>0/1                          [2]=>0/1                          [3]=>0/1                    ...                          [m]=>0/1 array ([2]=>array([1]=>0/1                          [2]=>0/1                          [3]=>0/1                    ...                          [m]=>0/1 ...... array ([n]=>array([1]=>0/1                          [2]=>0/1                          [3]=>0/1                    ...                          [m]=>0/1 [/code] Thank you for your help!!! [!--quoteo(post=384141:date=Jun 15 2006, 01:57 PM:name=visken)--][div class=\'quotetop\']QUOTE(visken @ Jun 15 2006, 01:57 PM) [snapback]384141[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hi all, I am new to PHP and need your help with the following: I want to construct the following array named [b]$arr_user_movie[/b]: (n is number of user and m is number of movies) array ([1]=>array([1]=>0/1 [2]=>0/1 [3]=>0/1 ... [m]=>0/1 array ([2]=>array([1]=>0/1 [2]=>0/1 [3]=>0/1 ... [m]=>0/1 ...... array ([n]=>array([1]=>0/1 [2]=>0/1 [3]=>0/1 ... [m]=>0/1 [b]example of use[/b]: $arr_user_movie[6][86] has to contain a 1 if user 6 has watched movie with id86, 0 otherwise I made the following script, however at the end when I check the value PHP doesn't return anything! When I insert 'echo $arr_user_movie[6][86] before line 'for ($user_id=1; $user_id<=NUMBERUSERS; $user_id++)', then PHP returns 1. Can you help me? arr_movie=array(1=>1); for ($j=2; $j<=NUMBERMOVIES; $j++) { $arr_movie[]=1;//zo voeg je telkens een veld toe } $i=1; $arr_user_movie=array($i=>$arr_movie); for($i=2; $i<=NUMBERUSERS; $i++) { $arr_user_movie[]=$arr_movie; } // $arr_user_movie[x][x] bevat een waarde 1 for ($user_id=1; $user_id<=NUMBERUSERS; $user_id++) { for ($movie_id=1; $movie_id<=NUMBERMOVIES; $movie_id++) { $query_user_movie="select * from rating where user_id=".$user_id." and movie_id=".$movie_id.""; $result_user_movie=mysql_query($query_user_movie, $connect); $num_results_user_movie=mysql_num_rows($result_user_movie); // if an entry found then set 1 else set 0: if ($num_results_user_movie==0) { $arr_user_movie[$user_id][$movie_id]=1; } else { $arr_user_movie[$user_id][$movie_id]=0; } } } [b]echo $arr_user_movie[1][1];[/b] [/quote]
  5. Hi all, I am new to PHP and need your help with the following: I want to construct the following array named [b]$arr_user_movie[/b]: (n is number of user and m is number of movies) array ([1]=>array([1]=>0/1 [2]=>0/1 [3]=>0/1 ... [m]=>0/1 array ([2]=>array([1]=>0/1 [2]=>0/1 [3]=>0/1 ... [m]=>0/1 ...... array ([n]=>array([1]=>0/1 [2]=>0/1 [3]=>0/1 ... [m]=>0/1 [b]example of use[/b]: $arr_user_movie[6][86] has to contain a 1 if user 6 has watched movie with id86, 0 otherwise I made the following script, however at the end when I check the value PHP doesn't return anything! When I insert 'echo $arr_user_movie[6][86] before line 'for ($user_id=1; $user_id<=NUMBERUSERS; $user_id++)', then PHP returns 1. Can you help me? arr_movie=array(1=>1); for ($j=2; $j<=NUMBERMOVIES; $j++) { $arr_movie[]=1;//zo voeg je telkens een veld toe } $i=1; $arr_user_movie=array($i=>$arr_movie); for($i=2; $i<=NUMBERUSERS; $i++) { $arr_user_movie[]=$arr_movie; } // $arr_user_movie[x][x] bevat een waarde 1 for ($user_id=1; $user_id<=NUMBERUSERS; $user_id++) { for ($movie_id=1; $movie_id<=NUMBERMOVIES; $movie_id++) { $query_user_movie="select * from rating where user_id=".$user_id." and movie_id=".$movie_id.""; $result_user_movie=mysql_query($query_user_movie, $connect); $num_results_user_movie=mysql_num_rows($result_user_movie); // if an entry found then set 1 else set 0: if ($num_results_user_movie==0) { $arr_user_movie[$user_id][$movie_id]=1; } else { $arr_user_movie[$user_id][$movie_id]=0; } } } [b]echo $arr_user_movie[1][1];[/b]
×
×
  • 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.