MySQL is better for me than php? Really?

Discussion in 'PHP' started by LongHaul, Oct 7, 2006.

  1. #1
    A few days ago I had a thread called "How to search several PHP files for certain values??"

    Several people suggested that a database would be better for my purposes than php, which could do my tasks but wasn't really the most efficient way.

    So for the past few days I've been trying to set up my table with phpMyAdmin on my cpanel and it just doesn't seem to be working.

    For some weird reason I have found it very difficult to find any information online geared toward a newbie using phpMyAdmin. I can't find clear explanations of data types. I can't find explanations for words like null and UNIQUE. I can't find clear explanations about auto-increment possibilities. The info I have found is scattershot and dense. The official documentation has been worthless to me; I'm getting by on random blogs and other dubious sources.

    Most frustrating, I CAN'T FIND OUT if I can do arrays or not!!! I know php can do them, and several times I've felt that php would be much easier.

    I want to have several (for example) book reviews. For each book, I will have an entry in my SQL database for title, author, publish date, chapter titles, the review text, etc. The part I'm having problems with now is the chapter titles. I want to read each chapter into my html/php document, and apply <li> formatting to it and stuff. It was simple with php only, but nobody wants to tell me if I can do this with a field. I did a title search in DP's Database forum for "array" and got no results! WTF?? :eek:

    Do I need multiple fields, one for each chapter? That seems ridiculous.

    Anyway, if I'm missing some obvious resource, please let me know. I've found some good stuff, and I indeed am able to retrieve and echo things from my table, but it's like all the simple newbie SQL information is behind a dam somewhere. php was easy to learn! phpmyadmin, ehh not so much. Bizarre.

    Thanks, you guys are very helpful. I'm just way more frustrated with databases than I ever got with php :mad:
     
    LongHaul, Oct 7, 2006 IP
  2. coolsaint

    coolsaint Banned

    Messages:
    257
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Dear Friend,
    You don't need to know PHPmyadmin or study it . It is a Web interface to administrate the Mysql Databases and Mysql server. You have to study PHP Mysql Connectivity first. How to do that.
    As well as you have to know some SQL . That is must.

    In PHP you need to study some basic PHP Mysql Functions.

    Like

    http://php.net/mysql_connect

    http://php.net/mysql_select_db

    http://php.net/mysql_query

    http://php.net/mysql_fetch_row

    http://php.net/mysql_fetch_array

    http://php.net/mysql_num_rows

    http://php.net/mysql_free_result

    These functions are needed to use Mysql from PHP. Study them first. Then i wish PhpMyadmin will become easier for you to understand.

    Thanks.

    Coolsaint
     
    coolsaint, Oct 7, 2006 IP
  3. sadcox66

    sadcox66 Spirit Walker

    Messages:
    496
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #3
    sadcox66, Oct 9, 2006 IP
  4. rb3m

    rb3m Peon

    Messages:
    192
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    A database is an array. Sort of. What PHP does when it opens a database and retrieves its contents is putting them in an array that you can then manipulate as usual.

    It would be better to create one table to hold information on books and another for information on chapters.

    The good news is that you know PHP already, so it will be easy to make the transition to PHP + MySQL. As always, I can't recommend w3schools enough. Check www .w3schools .com/ php/php_mysql_intro.asp (when can one use live links?) and also www .w3schools .com/ sql/default.asp
     
    rb3m, Oct 9, 2006 IP
  5. LongHaul

    LongHaul Peon

    Messages:
    670
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Actually, I discovered the php explode command, so I load all the chapter titles into one field separated by dummy characters. Works great!

    I've been there, it is good. And http://php.net as always helps me through most things.

    I've gotten over my initial frustrations and now that I understand the basic concepts things are starting to work out. Thanks everyone :)
     
    LongHaul, Oct 9, 2006 IP