1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How To See The Mysql Database Table In A Webpage ?

Discussion in 'PHP' started by gether, Jan 20, 2013.

  1. #1
    if i have some sort of data in my mysql database table ...


    how can i see it in a webpage ?
     
    gether, Jan 20, 2013 IP
  2. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #2
    You SELECT the data from the table (in PHP, using SQL), then create HTML with the returned data. This is a "if you have to ask, we can't give you enough information here" situation. You have to learn programming, PHP and SQL - a process that will take from 6 months to years, depending on how logical you are and how fast you learn. The practical solution is to hire someone to do it for you.
     
    Rukbat, Jan 20, 2013 IP
  3. gether

    gether Member

    Messages:
    87
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #3
    echo $row['firstname']

    like that ?

    what if i was able to upload an avi file to a table or a record in the mysql database table named "video"

    could i do this ?


    echo $row['video']


    i have been trying to improve ...i feel like a real idiot .. when it comes to thinking about processing streams ...
    last day i kind of got the idea of getting a stream to a programing language...

    thats what from a noob point of view programs does.. get stream ...process stream ...

    [​IMG]

    [​IMG]


    and its like.. and .. and .. and ..
     
    gether, Jan 20, 2013 IP
  4. DrShirts

    DrShirts Peon

    Messages:
    28
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    1
    #4
    "what if i was able to upload an avi file to a table or a record in the mysql database table named "video""
    If your database table is named video you cant echo video
    if the table has a field called video then yes you can echo it
    don't forget to the the content type header though.. its the only way the browser knows what kinda data your sending.
    and don't echo anything else (no white space) when doing so!

    But honestly you don't WNAT to store AVIs in the database, it will make your database big and bulky
    instead store relative paths to files in the file system. That way the database is lean and mean.

    IE

    save the video in /data/videos/myvide.avi
    and store only "/data/videos/myvide.avi" in the field
     
    DrShirts, Jan 20, 2013 IP
  5. gether

    gether Member

    Messages:
    87
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #5
    i understand ... thanks..
    but if i try to echo that record ... in a webpage ...

    how would it look like ... would it automatically have a jw player type container for it ?

    [​IMG]
     
    gether, Jan 21, 2013 IP
  6. DrShirts

    DrShirts Peon

    Messages:
    28
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    1
    #6
    Nop!
    You will need to basically set this up as if it was a normal JS install, but instead of a static file, point it to a file that will pull the video from the database

    Basically:

    1) Create a new page (say call if video.php) that takes in some paramaters (say videoid) that can be used to find the video you want to display
    2) That video.php would query the database and ONLY echo the video itself (nothing else)
    3) You would need to set the headers correctly to tellt he browser what content is (IE: header("Content-Type: video/x-flv ");)
    4) You would need to download JW Player and install it on the page you want the content to be displayed as you would for a static video
    5) You would need to point JW player to the above new file you created with the proper paramaters to play the video ie: video.php?id=<?=$row['rowID']?>

    if you want soemthing simpler to get working try removing the JS player and try with images first (img tags are more forgiving then debugging a js player) but the process is identicle

    Also be careful of which browser and which formats. Not all borwsers can play all formats so you may need to keep differnt versions of the video in the databse.
     
    DrShirts, Jan 21, 2013 IP
  7. gether

    gether Member

    Messages:
    87
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #7
    what is this JW player coded in ? is it in c programing language ?

    [​IMG]
     
    gether, Jan 21, 2013 IP
  8. gether

    gether Member

    Messages:
    87
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #8
    [​IMG]

    [​IMG]

    [​IMG]
     
    Last edited: Jan 22, 2013
    gether, Jan 22, 2013 IP
  9. ezprint2008

    ezprint2008 Well-Known Member

    Messages:
    611
    Likes Received:
    15
    Best Answers:
    2
    Trophy Points:
    140
    Digital Goods:
    1
    #9
    Are you trying to tap other websites and display their videos by SQL injection their database?
    If it were your own database you'd only have to SELECT * (* is a wildcard for all fields)
    it would echo the video names..and then you could turn names to PHP variables and have them displayed. So your question doesn't make sense why you couldn't do that. It sounds as if you want to find the table-fields of somebody ELSES SQL and dump the video names and then display them to your own site. Otherwise you wouldn't have to ask it seems since you have already successful echo"first_name" "last_name" ..its the same thing for a video - video_name - date etc fields
     
    ezprint2008, Jan 26, 2013 IP
  10. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #10
    Gether knows absolutely nothing about programming, and he's trying to "learn" how to write PHP scripts while maintaining that absolute lack of programming knowledge. Kind off like swimming nude in the ocean without getting wet. He's been advised many times to learn programming before he tries to write programs, but he refuses.
     
    Rukbat, Jan 26, 2013 IP
  11. ezprint2008

    ezprint2008 Well-Known Member

    Messages:
    611
    Likes Received:
    15
    Best Answers:
    2
    Trophy Points:
    140
    Digital Goods:
    1
    #11
    LOL..ah
     
    ezprint2008, Jan 26, 2013 IP
  12. gether

    gether Member

    Messages:
    87
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #12
    but nobody has really emphasized the importance of this ... anywhere

    [​IMG]

    that could be $_GET
     
    gether, Jan 26, 2013 IP
  13. ezprint2008

    ezprint2008 Well-Known Member

    Messages:
    611
    Likes Received:
    15
    Best Answers:
    2
    Trophy Points:
    140
    Digital Goods:
    1
    #13
    I like how you put them images at the bottom of all your posts.
    Gether your best start point will probably be:
    1. download WAMP (free download to run a developer system on your computer)
    2. Buy the PHP, MYSQL, Apache Book (you can skip the Apache section for awhile since you'll have wamp
    3. Start with the basic PHP math and logic scripts to get a basic understanding.
    4. Create some very basis SQL programs that work with your PHP scripts.

    Process that and then move on to the bigger and more complex scripts that interact with SQL.
    As it is right now you're in the sand castle building Olympics and you're asking how a shovel and bucket work. You need to start at the basics and build your way forward. You will be good within 6 months if you stay at it.
     
    ezprint2008, Jan 27, 2013 IP
  14. gether

    gether Member

    Messages:
    87
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #14
    i dont know.. images helps you see things better... i arrange them in my facebook account .. lol ..

    the html php mysql
    [​IMG]
    the php $_GET

    [​IMG]

    the WAMP server

    [​IMG]

    the stuff in the processor

    [​IMG]
     
    gether, Jan 27, 2013 IP
  15. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #15
    If you see the world that way you're right-brained. To be a programmer you have to be left-brained. That explains why you can't understand anything anyone tells you about programming.

    If I were you I'd concentrate on designing, not programming - the look of the site, templates, art. People who think in pictures waste their time if they try to learn programming - they'll never get it.
     
    Rukbat, Jan 28, 2013 IP
  16. gether

    gether Member

    Messages:
    87
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #16
    i like replies.. lol ...that way i can ask more and learn more..

    so where am i again in this huge programming world ?

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]


    trying to understand




    echo $row ['firstname']

     
    gether, Jan 28, 2013 IP
  17. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #17
    You're a fish trying to rid a bicycle. You're not physically equipped to do what you want. You'd probably make a great artist, though (which is something that programmers suck at).
     
    Rukbat, Jan 28, 2013 IP
  18. omgitsfletch

    omgitsfletch Well-Known Member

    Messages:
    1,222
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    145
    #18

    LOL WUT
     
    omgitsfletch, Jan 28, 2013 IP
  19. xxxize

    xxxize Member

    Messages:
    33
    Likes Received:
    2
    Best Answers:
    2
    Trophy Points:
    38
    #19
    hahahahaha!! sorry mates! Rukbat your phrase is very right and funny!! I was read the thread to help, but in the end you describe perfect why he don't need help!!

    Gentlemen, have a nice day!
     
    xxxize, Feb 4, 2013 IP
  20. yenerich

    yenerich Active Member

    Messages:
    697
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    75
    #20
    Here is a very simple way:

    <?php
     
     
    $sql = "SELECT name, url, title FROM nav";
    $result = mysql_query($sql);
    while($row = mysql_fetch_object($result)){
      $name = $row->name;
      $url = $row->url;
      $title = $row->title;
      echo "<li><a href='$url' title='$title'>$name</a></li>";
    }
     
    ?>
    Code (markup):
    In this case i search in the name, url and title rows, but you can adjust to search oin your owns.
    And then, as you can see i print them very easy using echo.
     
    yenerich, Feb 5, 2013 IP