Results 1 to 2 of 2

Thread: Mysql problem

  1. #1
    Join Date
    May 2006

    Unanswered: Mysql problem

    My knowledge of mysql is very poor and with the knowledge i have, i can't solve the problems i'm facing with my linuxserver.

    Almost every php script which uses a mysql database doesn't work and I really don't know what the problem is since there is no error report.
    When i make a database for a new script, the tables will be filled and there is a connection. But when i try to run the script there's nothing happening.

    Normally the script should get all the info from the tables but not in this case.

    Can anybody tell me what the problem can be?

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    without detailed knowledge no, I can't help, and I'm guessing no one else can give a defintive answer

    what error meesages are you getting

    hint look at the php construct of
    <php statement> or die (error message)

    I often use soemthing similar to...
    $cnn=@mysql_connect($host,$UID1,$PWD1) or die("E:xxxx - Failed to open cn:$cnn ".mysql_errno().": ".mysql_error()));
    $dbr=@mysql_select_db($dbn,$cnn) or die ("E:yyyy - Failed to open db:$dbr ".mysql_errno().": ".mysql_error()));
    $sql = "
     Select * from DT_Event
     where Event_End>=curdate() or (Event_End is Null and Event_Start>-curdate())
     order by Event_Start,Event_End,Event_Name";
    // where Event_End>=curdate()
    $sqlr=@mysql_query($sql,$cnn) or die ("E:zzzz - Failed to open rs:$sqlr ".mysql_errno().": ".mysql_error()));
    if (@mysql_num_rows($sqlr)>0) {
    } else
    { //insert debug mesage to show no records returned
    my first / best guess is going to be that you probabkly haven't given the correct permissions to the web userid. if so check you grants
    failing that it could be that the mysql isnt running on your machine. check you can use MysQL adminsitrator
    check that MySQL runs on ther command line / shell
    there are ffectively 3 steps to ensure the php module is "talking" to the db server
    the connection - fails if permissionsa arn't correct
    the database -fails if the db isn't working, or if the permissions aren't correct
    the sql - fails if the SQL isn't valid.
    in nay event you need to know what is causing the problem - examining the mysqlerrno() and mysqlerror() should give a clue.
    like all software products occasionally the error message can be a bit cryptic but it will point you nt he right direction.

    if you can run mysql admin or mysql query browser AND connect tohe locsal host then by defintion the server is active that demonstrates the problem is likely to be in the permissions ofr th euser account and password specified. in this event either GRANT permissions or use mysql admin to handle the permissions

    aftert that it becoems a PHP problem, and youmay be better off asking the question on the php thread rather than the MySQL thread.

    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts