openOffice Php MySQL - Suse

This is a discussion on openOffice Php MySQL - Suse ; On 2008-02-22, David Bolt wrote: > On Fri, 22 Feb 2008, Vahis wrote:- > >>An example: Movies, starring actors, Samuel L. Jackson. >>Names need two columns, the first column will hold also the middle >>name or initial. But better add ...

+ Reply to Thread
Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 21 to 40 of 45

Thread: openOffice Php MySQL

  1. Re: openOffice Php MySQL

    On 2008-02-22, David Bolt wrote:
    > On Fri, 22 Feb 2008, Vahis wrote:-
    >
    >>An example: Movies, starring actors, Samuel L. Jackson.
    >>Names need two columns, the first column will hold also the middle
    >>name or initial. But better add third column for name suffix like
    >>junior, jr. My experience is that it can be needed later with some names.

    >
    > Names could be a single column. There's no need to separate them, unless
    > you're wanting to be able to search on a surname.


    I cannot know that for sure. I may need to. Try "Bergman" or "Penn" in
    IMDB

    > Also, having a single
    > column for the name means you don't have to duplicate three or four
    > columns when you suddenly need to add one, or more, other "leading
    > actors"


    This is true.
    >
    >>Maybe the columns are easy to add afterwards in MySQL?

    >
    > Yes, using the command:
    >
    > alter table add column
    >
    > Using the name suffix example, and a table name movies, the command
    > would be something like:
    >
    > alter table movies add column name_suffix varchar(16) not null default '';
    >
    > This will do just what it reads like, which is to add a column that will
    > hold text of upto 16 characters per entry, the default being an empty
    > string, to the table. Any existing entries will get the new column added
    > and the default entry will be used for them.
    >
    > If, at some point in time, you discover that the 16 characters wasn't
    > enough, you can modify the column using:
    >
    > alter table movies modify column name_suffix varchar(32) not null default '';
    >
    > Which will then enlarge the name_suffix column so it can hole 32
    > characters.

    Thanks, I'm trying to pick up the idea. This thing is a bitch.

    Vahis
    Remodeling my site to train new things:
    http://waxborg.servepics.com
    --
    "The only thing more expensive than training is the lack of it"
    Henry Ford

  2. Re: openOffice Php MySQL

    Vahis wrote:
    > That looks interesting. So you install it and it resides on your box?
    > It fetches information from external sources like for example Amarok?
    > You can make Php queries to show on a web page?


    No. It is a php webpage on MySQL. Check out the demo site. Basicaly what
    you do is enter the titke of a movie you want to add to your database.
    It then will search e.g. imdb for the movie.
    That content will be added to your database, like the link to imdb, who
    plays in it, who is the director. Also an image, so you can see the DVD
    box. The year it was produced. The type of movie and so on.

    That way if you feel like watching a comedy with a certain actor, it
    will show all thos movies.

    If you put it online, you can even have severalpeople have their own
    content. E.g. your movies and the movies of a friend. That way you can
    see if he has a movie you can borrow.

    The borrowing is even integrated.

    >> Look at the demo site. It is free and open and pretty neat.

    >
    > I had a quick browse. Will do more later.
    >
    > Is that any good for learning stuff about database?


    I would say no, becaue it is rather complete and complex, because of the
    integration with websites and such. What I use to learn about databases
    is basicaly using phpMyAdmin and trial and error.

    There are some better newsgroups for this kind of stuff, but obviously
    they will also want to see that you have at least tried and searched.

    houghi
    --
    All opinions are not equal. Some are a very great deal more robust,
    sophisticated and well supported in logic and argument than others.

  3. Re: openOffice Php MySQL

    Vahis wrote:
    > An example: Movies, starring actors, Samuel L. Jackson.
    > Names need two columns, the first column will hold also the middle
    > name or initial. But better add third column for name suffix like
    > junior, jr. My experience is that it can be needed later with some names.
    >
    > Maybe the columns are easy to add afterwards in MySQL?


    Yes, it is. I use phpMyAdmin, which makes it all a LOT easier. It will
    also output searches for you in php, which you can then copy and edit
    and see what happens.

    About the name: The name is "Samuel L. Jackson" and "Samuel L. Jackson
    Jr." Unless you specifiacly want to search on first name, middle name
    and last name, I would search on parts of a name. E.g. if you search for
    Jackson, yoyu wil find both names above and also "Michael Jackson" the
    beer writer.

    What you need to set is the length of the file (which can be changes)
    and that is about it.

    > I've created a test database and a couple of tables in it.
    > I found them in /var/lib/mysql
    > Is the right place to have them?


    If your OS put them there, it is the right place. ;-)

    > Their owner is mysql, forbidden to others.
    > Is this correct?


    yes.

    >
    >> Download mysql-administrator from http://mysql.com/products/tools/administrator
    >> It's not included in opensuse 10.3 of some reason,
    >> maybe the build services has it, I don't know.
    >>

    > Sure it is. I've installed it yeasterday with YaST. As well as the Query
    > Browser.


    Install phpMyAdmin. That helped me a lot. Then look at some basic
    learning sites. Some I have looked at, but there are many, many more:
    http://www.php-mysql-tutorial.com/ and
    http://www.freewebmasterhelp.com/tutorials/phpmysql/

    And seriously, try out phpMyAdmin. Installable with YaST obviously and
    realy, it makes things a lot easier for you.

    houghi
    --
    First we thought the PC was a calculator. Then we found out how to turn
    numbers into letters with ASCII and we thought it was a typewriter. Then
    we discovered graphics, and we thought it was television. With the World
    Wide Web, we've realized it's a brochure. -- Douglas Adams.

  4. Re: openOffice Php MySQL

    On 2008-02-22, houghi wrote:
    > Vahis wrote:
    >> An example: Movies, starring actors, Samuel L. Jackson.
    >> Names need two columns, the first column will hold also the middle
    >> name or initial. But better add third column for name suffix like
    >> junior, jr. My experience is that it can be needed later with some names.
    >>
    >> Maybe the columns are easy to add afterwards in MySQL?

    >
    > Yes, it is. I use phpMyAdmin, which makes it all a LOT easier. It will
    > also output searches for you in php, which you can then copy and edit
    > and see what happens.
    >
    > About the name: The name is "Samuel L. Jackson" and "Samuel L. Jackson
    > Jr." Unless you specifiacly want to search on first name, middle name
    > and last name, I would search on parts of a name. E.g. if you search for
    > Jackson, yoyu wil find both names above and also "Michael Jackson" the
    > beer writer.


    James E. Carter, Jr.
    Carter, James E., Jr.

    The above is one person, a peanut farmer.
    Those are two ways to represent his name.

    I'm using just some movies I've listed as material.
    I'm actually trying to learn some basic stuff about relative database.
    >
    > What you need to set is the length of the file (which can be changes)
    > and that is about it.
    >
    >> I've created a test database and a couple of tables in it.
    >> I found them in /var/lib/mysql
    >> Is the right place to have them?

    >
    > If your OS put them there, it is the right place. ;-)


    I have some storage space on my ISP's server for some backups.
    I'm obviously getting a new challenge in copying my database stuff in
    there. Backing up thse databases is something different obviously.


    Gravity is a bitch.

    I've seen the MySQL Administrator backup section (GUI).
    The default is something: "This may lead to inconsistent backups and
    should be avoided if possible."

    How's that for a default setting?
    >
    >> Their owner is mysql, forbidden to others.
    >> Is this correct?

    >
    > yes.
    >
    >>
    >>> Download mysql-administrator from http://mysql.com/products/tools/administrator
    >>> It's not included in opensuse 10.3 of some reason,
    >>> maybe the build services has it, I don't know.
    >>>

    >> Sure it is. I've installed it yeasterday with YaST. As well as the Query
    >> Browser.

    >
    > Install phpMyAdmin. That helped me a lot. Then look at some basic
    > learning sites. Some I have looked at, but there are many, many more:
    > http://www.php-mysql-tutorial.com/ and
    > http://www.freewebmasterhelp.com/tutorials/phpmysql/
    >
    > And seriously, try out phpMyAdmin. Installable with YaST obviously and
    > realy, it makes things a lot easier for you.


    I've had it installed from day one.
    I faced some trouble in getting started with it, so I decided to try to
    understand some basics by going cli.

    I would really need a picture (literally) about the whereabouts of all
    these new things.
    If I have a nice GUI (like in Amarok) it's nice.
    But when it gives an error in configuring it you're lost.

    I've tried this MySQL thing before with Amarok. I had problems then and
    I went the default way SQLite. I've never even known where that is kept.

    That's another part of all this that I'm trying to get a hold on again.

    Vahis
    Remodeling my site to train new things:
    http://waxborg.servepics.com
    --
    "Too bad all the people who know how to run this country are busy
    running taxicabs or cutting hair."
    George Burns

  5. Re: openOffice Php MySQL

    Vahis wrote:
    > I've had it installed from day one.
    > I faced some trouble in getting started with it, so I decided to try to
    > understand some basics by going cli.


    I tried the same route and got completely and utterly lost with CLI.

    > I would really need a picture (literally) about the whereabouts of all
    > these new things.


    K. I have a hnagover, so I am not thinking clear. The best moment to try
    to do this. :-) I will see what I can get online for phpMyAdmin
    The first things I am going to asume:
    1) You are able to log in to phpMyAdmin
    2) You want it to work with a website

    What I will do is make a very basic database with the following content
    1) Movie
    2) Lead actor
    3) Year of release
    4) Genre

    The screen captures are from a basic Firefox site. I have however
    removed all toolbars, so you can see more.

    I will get back when I am finished with it.

    houghi
    --
    First we thought the PC was a calculator. Then we found out how to turn
    numbers into letters with ASCII and we thought it was a typewriter. Then
    we discovered graphics, and we thought it was television. With the World
    Wide Web, we've realized it's a brochure. -- Douglas Adams.

  6. Re: openOffice Php MySQL

    On 2008-02-23, houghi wrote:
    > Vahis wrote:
    >> I've had it installed from day one.
    >> I faced some trouble in getting started with it, so I decided to try to
    >> understand some basics by going cli.

    >
    > I tried the same route and got completely and utterly lost with CLI.
    >
    >> I would really need a picture (literally) about the whereabouts of all
    >> these new things.

    >
    > K. I have a hnagover, so I am not thinking clear. The best moment to try
    > to do this. :-)


    I gave up alcohol over seven years ago, so all I can say is I'm sorry

    I drove the taxi through saturday nights then.
    Seeing that crap for some time made me give up. Totally.

    Another method probably would be to see a video of yesterday night.
    On YouTube

    > I will see what I can get online for phpMyAdmin
    > The first things I am going to asume:
    > 1) You are able to log in to phpMyAdmin


    No. I'm not.

    This thing is getting scattered. I'll start another thread about
    openSUSE and Phpmyadmin.

    > 2) You want it to work with a website


    Yes. I do.

    >
    > What I will do is make a very basic database with the following content
    > 1) Movie
    > 2) Lead actor
    > 3) Year of release
    > 4) Genre
    >
    > The screen captures are from a basic Firefox site. I have however
    > removed all toolbars, so you can see more.
    >
    > I will get back when I am finished with it.


    I'm sure you'll enjoy that


    Vahis
    Remodeling my site to train new things:
    http://waxborg.servepics.com
    --
    "Too bad all the people who know how to run this country are busy
    running taxicabs or cutting hair."
    George Burns

  7. Re: openOffice Php MySQL

    Vahis wrote:
    > Another method probably would be to see a video of yesterday night.
    > On YouTube


    http://www.fosdem.org/2008/beerevent Just wait for the images and so on
    to show up. ;-)

    >> I will see what I can get online for phpMyAdmin
    >> The first things I am going to asume:
    >> 1) You are able to log in to phpMyAdmin

    >
    > No. I'm not.
    >
    > This thing is getting scattered. I'll start another thread about
    > openSUSE and Phpmyadmin.


    OK. See you there.

    houghi
    --
    First we thought the PC was a calculator. Then we found out how to turn
    numbers into letters with ASCII and we thought it was a typewriter. Then
    we discovered graphics, and we thought it was television. With the World
    Wide Web, we've realized it's a brochure. -- Douglas Adams.

  8. Re: openOffice Php MySQL

    On 2008-02-21, David Bolt wrote:
    > On Thu, 21 Feb 2008, birre wrote:-
    >
    >
    >
    >>I can also thank you for this, I have a functional query, but
    >>wanted to add the sort by tabs, and can learn from your script.

    >
    > I can't really say it's my idea, but I also can't recall where I
    > actually saw it either.


    I have more or less been able to put all this thing together.
    Your scripts that is
    I have even been able to import the data in csv.

    Now I'm trying to get also an undestanding of all this...

    There are also a couple of issues there.

    There's one strange thing with special characters.
    When I saw this I made the table with utf8.

    Also the csv is utf8 and this has been told to the importing tool.
    The characters are correct still in PhpMyAdmin searches but they get
    messed up in the web page.

    Every charset definition that I've found in the page code says utf8.

    This is minor at this stage though.

    The movies, directors, and actors have a lot names with special
    characters from whatever languages.

    I've understood that unicode utf8 would be the way to go(?)

    The other issue is what you discuss here:

    >
    >>But it should not have the db passwords in the same file,
    >>I always create a config directory with an .htaccess inside
    >>saying "deny from all" , and include that file from the main
    >>script.

    >
    > Normally I do something similar. In this case, it was a quick page that
    > I knocked together. What I should have done is to include a couple of
    > comments saying that for the best security, create a user just for the
    > script that has read-only access to that database. Makes it much safer
    > since, even if someone does manage to get the user name and password
    > together, they still can't do anything with it.
    >
    >>This prevent the db user and password to be sent to
    >>a remote browser if something bad happen to php.

    >
    > I have experience of that as well[0]. Had to change passwords on a
    > couple of databases as a result :-|


    I have also been wondering how this authentication thing should be done.

    Vahis
    --
    "Let the children's laughter remind us how we used to be."
    From "Greatest Love of All" by Michael Masser and Linda Creed.

  9. Re: openOffice Php MySQL

    On 2008-02-21, db wrote:
    > Vahis wrote:
    >
    >> On 2008-02-21, David Bolt wrote:

    >
    >>> The directors names are now links, as are the release years, and you
    >>> get a list of movies directed by a specific director, or released
    >>> during a particular year. I've added a limit so that you can restrict
    >>> the number of movies initially displayed. When I get some more free
    >>> time, I'll add in the necessary code so you can skip forwards and
    >>> backwards a page at a time.


    That forwards and backwards per page would be really nice to have

    I'm finding out that taking MySQL and Php in full control is not
    something one does overnight. It's a PITA.

    I think there's a bug somewhere and I'm trying to find it.

    Anything in the column "awards" is shown on top of the table, without
    any formatting, just everything in one go.


    >
    >> I'm trying to set up a movie database with the titles, release years,
    >> starring actors, possible Academy awards etc.

    >
    > Oh, one extra column in the table. No problem, it's easily added.


    My project is actually something that should go in some other group.
    It's not Suse related as such.

    This is already far beyond my current skills, but I'm wondering if
    this structure is really the way to go?

    I mean everything in one table.
    Should I not have different tables for different things?

    I should maybe have a table for people with columns for their first
    names and last names as well as suffixes like juniors?

    I could look for Sutherland and find
    Donald Sutherland
    Kiefer Sutherland.

    I could pick Donald Sutherland and see that he is an actor in numerous
    movies (which have a table of their own) but he is also a producer in
    Steelyard Blues.

    There are lots of actors who are also directors. And writers.

    >
    >> A bit like IMDB but only a few movies.


    I'm not trying to invent the wheel again here, no.

    I have taken movies in this only for material in trying to figure out how
    to display some data from a database.

    I'm hoping to be able to create a small database with relations and
    display some data on a web page.

    I'll go get a book as birre suggested already
    >
    > You can see the demo here:
    >
    >
    >
    > I've split the code up a bit as it makes it easier to re-use parts in
    > the other pages, so there's a few more source files here:
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > These will all need to be renamed as .php files to work, and you'll need
    > to fill in the required details in setup_database.php for it to work.
    >
    > And, with the new column, the command to create the table is here:
    >
    >


    I'm studying your code. This is where i need another book

    >

    Your help is really precious. I haven't come far yet but without your
    involvement I'd be absolutely nowhere

    Vahis
    --
    "Too bad all the people who know how to run this country are busy running
    taxicabs or cutting hair."
    George Burns

  10. Re: openOffice Php MySQL

    Vahis wrote:
    > That forwards and backwards per page would be really nice to have


    I have seen some dample code while searching for information. Sorry, I
    do not have the URL anymore, but I remember of seeing several solutions
    like that.

    > I'm finding out that taking MySQL and Php in full control is not
    > something one does overnight. It's a PITA.


    Yes. The best you can do is to work with existing examples and manuals
    you find online. Also it is nice if you aready know some php. If you
    start to learn both at the same time, you do not know wether you make a
    php or mysql error.

    > I think there's a bug somewhere and I'm trying to find it.


    PEBCAK. ;-)

    > My project is actually something that should go in some other group.
    > It's not Suse related as such.


    Indeed and you will get better help there as well.

    > This is already far beyond my current skills, but I'm wondering if
    > this structure is really the way to go?


    Best ask that there as well.


    > There are lots of actors who are also directors. And writers.


    You can do a search on directors AND writers. Most likely you will have
    a database directors and a database actors and a database movies and ...
    e.g. if you look at the database opendb, you will see that the database
    itself is called opendb. In that you have different items (which I
    confused as being the database at first)



    houghi
    --
    Theologians can pursuade themselves of anything. Anyone who can worship
    a trinity and insists that his religion is a monotheism can believe
    anything -- just give him time to rationalize it.
    Robert A. Heinlein, JOB: A Comedy of Justice

  11. Re: openOffice Php MySQL

    On 2008-02-24, houghi wrote:
    > Vahis wrote:
    >> That forwards and backwards per page would be really nice to have

    >
    > I have seen some dample code while searching for information. Sorry, I
    > do not have the URL anymore, but I remember of seeing several solutions
    > like that.
    >
    >> I'm finding out that taking MySQL and Php in full control is not
    >> something one does overnight. It's a PITA.

    >
    > Yes. The best you can do is to work with existing examples and manuals
    > you find online. Also it is nice if you aready know some php. If you
    > start to learn both at the same time, you do not know wether you make a
    > php or mysql error.


    Tell me about it
    >
    >> I think there's a bug somewhere and I'm trying to find it.

    >
    > PEBCAK. ;-)


    Right there it is. But I know there's an error in David's php because it
    shows also in his url:

    http://www.davjam.org/~davjam/vahis_demo/index.php

    You can see that there's no frames in the rows in column "Awards".
    As the fields are empty that's all you see.
    But if you add contents in a field there, it appears on top of the table
    (above) unformatted.

    I've been steering at the code without seeing it yet.
    HTML is easier to troubleshoot because a WYSIWYG editor like Seamonkey
    would show it

    >
    >> My project is actually something that should go in some other group.
    >> It's not Suse related as such.

    >
    > Indeed and you will get better help there as well.
    >
    >> This is already far beyond my current skills, but I'm wondering if
    >> this structure is really the way to go?

    >
    > Best ask that there as well.


    I've already made a reservation on a book in the public library...

    >
    >> There are lots of actors who are also directors. And writers.

    >
    > You can do a search on directors AND writers. Most likely you will have
    > a database directors and a database actors and a database movies and ...


    I think all those would be different tables in one database.

    > e.g. if you look at the database opendb, you will see that the database
    > itself is called opendb.


    The database can be named whatever.

    I have several here already, like mymovies1 to mymoviesx

    I need many to see differences when I change something.
    The old trial and error method...

    Vahis

    Remodeling my site to train new things:
    http://waxborg.servepics.com
    --
    "The only thing more expensive than training is the lack of it"
    Henry Ford

  12. Re: openOffice Php MySQL

    On Sun, 24 Feb 2008, Vahis wrote:-

    >On 2008-02-24, houghi wrote:
    >> Vahis wrote:


    >>> I'm finding out that taking MySQL and Php in full control is not
    >>> something one does overnight. It's a PITA.

    >>
    >> Yes. The best you can do is to work with existing examples and manuals
    >> you find online. Also it is nice if you aready know some php. If you
    >> start to learn both at the same time, you do not know wether you make a
    >> php or mysql error.

    >
    >Tell me about it


    That's one of the reasons for always adding:

    or die("SQL error: ".mysql_error());

    to each of the commands that use MySQL. As for finding PHP errors, you
    can always use the command line and php/php5 to parse the file. That way
    you will get notices like this:

    davjam@dav2:~/public_html/vahis_demo> php5 index.php >/dev/null
    PHP Notice: Undefined index: order in /home/davjam/public_html/vahis_demo/get_parameters.php on line 3
    PHP Notice: Undefined index: way in /home/davjam/public_html/vahis_demo/get_parameters.php on line 19
    PHP Notice: Undefined index: limit in /home/davjam/public_html/vahis_demo/get_parameters.php on line 33
    PHP Notice: Undefined index: start in /home/davjam/public_html/vahis_demo/get_parameters.php on line 48

    if you're passing values either via the URL (GET) or via forms (GET or
    POST).

    If there are any errors or notices, you'll get told about them, and
    where they are. My most common mistake is to miss off a ';' which is
    very good because you get a completely blank page. Using php5 on the
    command line, I get a syntax error on the next non-blank line following
    the error. E.g. I stripped the ';' from the end of line 21 of index.php:

    $who=""
    $year="";

    and this results in:

    davjam@dav2:~/public_html/vahis_demo> php5 index.php >/dev/null
    PHP Parse error: syntax error, unexpected T_VARIABLE in /home/davjam/public_html/vahis_demo/index.php on line 22
    davjam@dav2:~/public_html/vahis_demo> head -22 index.php|tail -1
    $year="";

    A quick check for the lines above shows:

    davjam@dav2:~/public_html/vahis_demo> head -22 index.php|tail -3

    $who=""
    $year="";

    >>
    >>> I think there's a bug somewhere and I'm trying to find it.

    >>
    >> PEBCAK. ;-)


    Well, in this case it wasn't in his location. It was in mine.

    >Right there it is. But I know there's an error in David's php because it
    >shows also in his url:
    >
    >http://www.davjam.org/~davjam/vahis_demo/index.php
    >
    >You can see that there's no frames in the rows in column "Awards".
    >As the fields are empty that's all you see.
    >But if you add contents in a field there, it appears on top of the table
    >(above) unformatted.


    Never noticed it because I had the awards column filled with blanks.
    Adding a few test entries highlights the problem.

    >I've been steering at the code without seeing it yet.
    >HTML is easier to troubleshoot because a WYSIWYG editor like Seamonkey
    >would show it


    The line:



    should read:



  13. That was caused, in part, by Quanta trying to fix an error I made, but
    mostly by me not noticing its correction. The reason for the
    tags was because I had thought about creating a similar page to the
    directors, and releases, for the awards. I added the code to add the
    links, then changed my mind. Instead of stripping out the
    snippet, I deleted the wrong bits and Quanta did its best to fix it.


    Regards,
    David Bolt

    --
    www.davjam.org/lifetype/www.distributed.net: OGR@100Mnodes, RC5-72@15Mkeys
    SUSE 10.1 32bit | openSUSE 10.2 32bit | openSUSE 10.3 32bit | openSUSE 11.0a1
    SUSE 10.1 64bit | openSUSE 10.2 64bit | openSUSE 10.3 64bit
    RISC OS 3.6 | TOS 4.02 | openSUSE 10.3 PPC |RISC OS 3.11

  14. Re: openOffice Php MySQL

    Vahis wrote:
    > You can see that there's no frames in the rows in column "Awards".
    > As the fields are empty that's all you see.
    > But if you add contents in a field there, it appears on top of the table
    > (above) unformatted.


    Probably he has already corrected it, because I do not see anything,

    > I've been steering at the code without seeing it yet.
    > HTML is easier to troubleshoot because a WYSIWYG editor like Seamonkey
    > would show it


    vim is all you need. :-D

    I am working on my database as well and that is all I use. If it is good
    enough for me, it should be good enough for the rest of the world. :-D

    What I am trying to figure out is how I can do the following:
    http://houghi.eu/
    The first field will be street and postalcode, so no problem there. The
    second part will be a 4 digit number from a database.

    I can do one. I can do the other (http://houghi.eu/location.php) I am
    just to daft to combine them. :-D

    The esential code for the second page is:
    $query = "SELECT * FROM `adresses` WHERE `number` like '1003'";
    $result = mysql_query($query);
    $row = mysql_fetch_array($result, MYSQL_ASSOC);
    $wholestreet =
    "{$row['street']},{$row['postcode']},{$row['city']},{$row['country']}
    ";
    echo "$wholestreet";

    And it is the '1003' that needs to change.

    > I have several here already, like mymovies1 to mymoviesx


    No need for that last one, if it is what I think it is. You just add a
    type of movie, like Horror. SienceFiction and Pr0n. And you then show
    only those that are NOT Pr0n.

    Something like:
    SELECT * FROM `movies` WHERE `type` NOT LIKE '%Pr0n%'

    houghi
    --
    Theologians can pursuade themselves of anything. Anyone who can worship
    a trinity and insists that his religion is a monotheism can believe
    anything -- just give him time to rationalize it.
    Robert A. Heinlein, JOB: A Comedy of Justice

  15. Re: openOffice Php MySQL

    On Sun, 24 Feb 2008, Vahis wrote:-

    >There's one strange thing with special characters.
    >When I saw this I made the table with utf8.
    >
    >Also the csv is utf8 and this has been told to the importing tool.
    >The characters are correct still in PhpMyAdmin searches but they get
    >messed up in the web page.


    Have you checked to see if there's any output before the character
    encoding is defined? You can check using curl:

    curl http://path/to/page | head -10

    You shouldn't see anything before these four lines:






    If there is, you might have grabbed the scripts before I removed the
    debugging output.

    >Every charset definition that I've found in the page code says utf8.
    >
    >This is minor at this stage though.


    I only found this problem when debugging the scripts. I had a few "echo"
    commands prior to the character encoding is defined, and that mucked
    things up a bit. Once the "echo" commands were removed, the pages
    displayed correctly.

    >The movies, directors, and actors have a lot names with special
    >characters from whatever languages.
    >
    >I've understood that unicode utf8 would be the way to go(?)


    Since I was writing using Quanta and nano, and the default is to use the
    UTF-8 character encoding in openSUSE, that's the character encoding I
    chose for the database. It made it much easier than me trying to convert
    to the ISO-8895-1 encoding that the pages were originally designed for.

    >> I have experience of that as well[0]. Had to change passwords on a
    >> couple of databases as a result :-|

    >
    >I have also been wondering how this authentication thing should be done.


    As I said, I use two users for the table. One user gets a read-only
    access by creating it with:

    grant select on .* to ''@'' identified by '';

    The other user gets all permissions on the database:

    grant all on .* to ''@'' identified by '';

    That way, I don't have any worries about the user name and password for
    the restricted user being found out, since it can't do anything to the
    database but read from it.

    I can then create a .htaccess protected directory with all the required
    scripts to create an update page for manipulating the database, e.g.
    adding, deleting, modifying entries, and no-one else gets to mess it up.


    Regards,
    David Bolt

    --
    www.davjam.org/lifetype/ www.distributed.net: OGR@100Mnodes, RC5-72@15Mkeys
    SUSE 10.1 32bit | openSUSE 10.2 32bit | openSUSE 10.3 32bit | openSUSE 11.0a1
    SUSE 10.1 64bit | openSUSE 10.2 64bit | openSUSE 10.3 64bit
    RISC OS 3.6 | TOS 4.02 | openSUSE 10.3 PPC |RISC OS 3.11

  16. Re: openOffice Php MySQL

    On 2008-02-24, David Bolt wrote:
    > On Sun, 24 Feb 2008, Vahis wrote:-
    >
    >>On 2008-02-24, houghi wrote:
    >>> Vahis wrote:

    >
    >>>> I'm finding out that taking MySQL and Php in full control is not
    >>>> something one does overnight. It's a PITA.
    >>>
    >>> Yes. The best you can do is to work with existing examples and manuals
    >>> you find online. Also it is nice if you aready know some php. If you
    >>> start to learn both at the same time, you do not know wether you make a
    >>> php or mysql error.

    >>
    >>Tell me about it

    >
    > That's one of the reasons for always adding:
    >
    > or die("SQL error: ".mysql_error());
    >
    > to each of the commands that use MySQL.




    >>You can see that there's no frames in the rows in column "Awards".
    >>As the fields are empty that's all you see.
    >>But if you add contents in a field there, it appears on top of the table
    >>(above) unformatted.

    >
    > Never noticed it because I had the awards column filled with blanks.
    > Adding a few test entries highlights the problem.



    >
    > The line:
    >
    >
    >
    > should read:
    >
    >


  17. I can see it now when it's put in front of me on a plate

    Believe it or not but I had my eyes on that line for a while already.
    I was sure it has to be the one.
    I just couldn't figure it out what to do with it.

    I changed it, had a look in Firefox, made it worse, changed it back and
    made another change, had a look. And on and on...

    Still I think I may have learnt something. I must have

    >
    > That was caused, in part, by Quanta trying to fix an error I made, but
    > mostly by me not noticing its correction. The reason for the
    > tags was because I had thought about creating a similar page to the
    > directors, and releases, for the awards. I added the code to add the
    > links, then changed my mind. Instead of stripping out the
    > snippet, I deleted the wrong bits and Quanta did its best to fix it.


    I've been using only Kate and Vim in these exercises.

    I must have a look at Quanta, it's mentioned often as a good editor.

    You know, this is probably the n+1st time that I've tried to get this journey
    started.
    And I've always fallen off the wagon by the time of "Hello World".

    This time I have a feeling I'm getting somewhere.

    I just can't thank you enough for helping me getting started.

    Vahis
    Remodeling my site to train new things:
    http://waxborg.servepics.com
    --
    "The only thing more expensive than training is the lack of it"
    Henry Ford

  18. Re: openOffice Php MySQL

    On 2008-02-24, houghi wrote:
    > Vahis wrote:
    >> You can see that there's no frames in the rows in column "Awards".
    >> As the fields are empty that's all you see.
    >> But if you add contents in a field there, it appears on top of the table
    >> (above) unformatted.

    >
    > Probably he has already corrected it, because I do not see anything,


    He has.
    >
    >> I've been steering at the code without seeing it yet.
    >> HTML is easier to troubleshoot because a WYSIWYG editor like Seamonkey
    >> would show it

    >
    > vim is all you need. :-D


    Kate is nice, too.



    > I am
    > just to daft to combine them. :-D




    Wait a little (a few years). I'll help you out
    >
    >> I have several here already, like mymovies1 to mymoviesx

    >
    > No need for that last one, if it is what I think it is.


    You think wrong ( I can understand that)

    > You just add a
    > type of movie, like Horror. SienceFiction and Pr0n. And you then show
    > only those that are NOT Pr0n.
    >
    > Something like:
    > SELECT * FROM `movies` WHERE `type` NOT LIKE '%Pr0n%'
    >

    I wouldn't need genres for those movies (like small tetas and big tetas)
    I only have big ones in them

    But I've made several databases while practising.
    I have this ambitious idea of having different tables for different data
    and then combining them with queries. I think this is called relations


    Vahis
    --
    "Too bad all the people who know how to run this country are busy running
    taxicabs or cutting hair."
    George Burns

  19. Re: openOffice Php MySQL

    On 2008-02-24, David Bolt wrote:
    > On Sun, 24 Feb 2008, Vahis wrote:-
    >
    >>There's one strange thing with special characters.
    >>When I saw this I made the table with utf8.
    >>
    >>Also the csv is utf8 and this has been told to the importing tool.
    >>The characters are correct still in PhpMyAdmin searches but they get
    >>messed up in the web page.

    >
    > Have you checked to see if there's any output before the character
    > encoding is defined? You can check using curl:
    >
    > curl http://path/to/page | head -10
    >
    > You shouldn't see anything before these four lines:
    >
    >
    >
    >
    >
    >
    > If there is, you might have grabbed the scripts before I removed the
    > debugging output.

    No. Just:
    curl http://localhost/testsite/index.php | head -10
    % Total % Received % Xferd Average Speed Time Time Time
    % Current
    Dload Upload Total Spent Left
    Speed
    100 9748 0 9748 0 0 262k 0 --:--:-- --:--:-- --:--:--
    0

    >
    >>Every charset definition that I've found in the page code says utf8.
    >>
    >>This is minor at this stage though.

    >
    > I only found this problem when debugging the scripts. I had a few "echo"
    > commands prior to the character encoding is defined, and that mucked
    > things up a bit. Once the "echo" commands were removed, the pages
    > displayed correctly.


    If I set the charset in the browser (Firefox, Seamonkey, Konqueror, IE)
    to ISO-8859-1 it'll be fine. If UTF8 it's wrong, in Seamonkey it's a
    mess.

    The same thing happens on this page, BTW:

    http://www.php-editors.com/articles/sql_phpmyadmin.php

    No biggie.

    >
    >>The movies, directors, and actors have a lot names with special
    >>characters from whatever languages.
    >>
    >>I've understood that unicode utf8 would be the way to go(?)

    >
    > Since I was writing using Quanta and nano, and the default is to use the
    > UTF-8 character encoding in openSUSE, that's the character encoding I
    > chose for the database. It made it much easier than me trying to convert
    > to the ISO-8895-1 encoding that the pages were originally designed for.
    >
    >>> I have experience of that as well[0]. Had to change passwords on a
    >>> couple of databases as a result :-|

    >>
    >>I have also been wondering how this authentication thing should be done.

    >
    > As I said, I use two users for the table. One user gets a read-only
    > access by creating it with:
    >
    > grant select on .* to ''@'' identified by '';
    >
    > The other user gets all permissions on the database:
    >
    > grant all on .* to ''@'' identified by '';
    >
    > That way, I don't have any worries about the user name and password for
    > the restricted user being found out, since it can't do anything to the
    > database but read from it.
    >
    > I can then create a .htaccess protected directory with all the required
    > scripts to create an update page for manipulating the database, e.g.
    > adding, deleting, modifying entries, and no-one else gets to mess it up.


    That sounds safe. I'll do that

    Thanks again.

    Ever thought of a trackday in Finland?
    You'll have a free ride

    Vahis
    --
    "Too bad all the people who know how to run this country are busy running
    taxicabs or cutting hair."
    George Burns

  20. Re: openOffice Php MySQL

    On Sun, 24 Feb 2008, Vahis wrote:-

    >On 2008-02-24, David Bolt wrote:


    >> If there is, you might have grabbed the scripts before I removed the
    >> debugging output.

    >No. Just:
    >curl http://localhost/testsite/index.php | head -10
    > % Total % Received % Xferd Average Speed Time Time Time
    > % Current
    > Dload Upload Total Spent Left
    >Speed
    >100 9748 0 9748 0 0 262k 0 --:--:-- --:--:-- --:--:--
    >0


    Okay, that's a bit weird. Using my demo, I get:

    davjam@adder:~/public_html/vahis_demo> curl http://adder.davjam.org/~davjam/vahis_demo/index.php | head -10
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 3394 100 3394 0 0 172k 0 --:--:-- --:--:-- --:--:-- 0






    Movies


    These columns can be sorted by clicking the header:



    >If I set the charset in the browser (Firefox, Seamonkey, Konqueror, IE)
    >to ISO-8859-1 it'll be fine. If UTF8 it's wrong, in Seamonkey it's a
    >mess.
    >
    >The same thing happens on this page, BTW:
    >
    >http://www.php-editors.com/articles/sql_phpmyadmin.php
    >
    >No biggie.


    That page doesn't specify a text encoding and so they go with the
    defaults.


    Regards,
    David Bolt

    --
    www.davjam.org/lifetype/ www.distributed.net: OGR@100Mnodes, RC5-72@15Mkeys
    SUSE 10.1 32bit | openSUSE 10.2 32bit | openSUSE 10.3 32bit | openSUSE 11.0a1
    SUSE 10.1 64bit | openSUSE 10.2 64bit | openSUSE 10.3 64bit
    RISC OS 3.6 | TOS 4.02 | openSUSE 10.3 PPC |RISC OS 3.11

  21. Re: openOffice Php MySQL

    On Sun, 24 Feb 2008, Vahis wrote:-

    >On 2008-02-24, David Bolt wrote:


    >>

  22. >
    >I can see it now when it's put in front of me on a plate


    I've lost count of the number of times I've done that.

    >Believe it or not but I had my eyes on that line for a while already.
    >I was sure it has to be the one.
    >I just couldn't figure it out what to do with it.


    First thing I spotted was the missing
    , then I noticed the .
    That's when I figured out what had caused it.

    >> That was caused, in part, by Quanta trying to fix an error I made, but
    >> mostly by me not noticing its correction. The reason for the
    >> tags was because I had thought about creating a similar page to the
    >> directors, and releases, for the awards. I added the code to add the
    >> links, then changed my mind. Instead of stripping out the
    >> snippet, I deleted the wrong bits and Quanta did its best to fix it.

    >
    >I've been using only Kate and Vim in these exercises.


    Not keen on vim. I can use it for basic text editing but I much prefer
    nano to it. Heck, I even prefer emacs to vim. Now, I'm not entirely sure
    about this but I have a feeling the editor in Quanta is either based
    upon kate or kwrite. The reasoning is that all three share the same
    syntax highlighting and, as far as I know, kwrite is a cut-down version
    of kate.

    >I must have a look at Quanta, it's mentioned often as a good editor.


    You'll find it in the kdewebdev3 package, along with a few other useful
    packages. From the package description:


    * Quanta--an HTML editor (native source and WYSIWIG) with lots of
    features, like a PHP debugger

    * KLinkStatus--validator for links on HTML pages

    * KImageMapEditor--an HTML image map editor

    * KXsldbg--XSLT debugger

    * KFileReplace--batch search and replace tool


    I like it for two reasons. The first is the syntax highlighting, and the
    other is the handy tool-tip feature for the mysql commands when writing
    php scripts.


    Regards,
    David Bolt

    --
    www.davjam.org/lifetype/ www.distributed.net: OGR@100Mnodes, RC5-72@15Mkeys
    SUSE 10.1 32bit | openSUSE 10.2 32bit | openSUSE 10.3 32bit | openSUSE 11.0a1
    SUSE 10.1 64bit | openSUSE 10.2 64bit | openSUSE 10.3 64bit
    RISC OS 3.6 | TOS 4.02 | openSUSE 10.3 PPC |RISC OS 3.11

  23. Re: openOffice Php MySQL

    David Bolt wrote:
    > Not keen on vim. I can use it for basic text editing but I much prefer
    > nano to it. Heck, I even prefer emacs to vim. Now, I'm not entirely sure
    > about this but I have a feeling the editor in Quanta is either based
    > upon kate or kwrite. The reasoning is that all three share the same
    > syntax highlighting and, as far as I know, kwrite is a cut-down version
    > of kate.


    I can understand that vim might look like a horror (although not as bad
    as emacs) but it has its advanatages. You just need to install ~/.vimrc.
    There are several ones available.

    One neat trick I just learned was ` = G`. It neatly indents the
    HTML files. :-D

    > I like it for two reasons. The first is the syntax highlighting, and the
    > other is the handy tool-tip feature for the mysql commands when writing
    > php scripts.


    The first I have with vim as well. I also use bluefish and notepad++ and
    nvu. The latter is interesting if you work on both Windows and Linux,
    because it is available on both.

    houghi
    --
    The whole principle [of censorship] is wrong. It's like demanding that
    grown men live on skim milk because the baby can't have steak.
    -- Robert A. Heinlein in "The Man Who Sold the Moon"