Results 1 to 6 of 6

Thread: PHP + MySQL

  1. #1

    PHP + MySQL

    Here's my PHP Code, just testing my MySQL installation, creating databases, then listing the databases:

     $link = mysql_connect('localhost', 'root', 'foo');
     if (!$link) {
       die('Could Not Connect: ' . mysql_error() . "\n");
     if (mysql_create_db('testing')) {
       echo "Database Created Successfully\n";
        echo "Error Creating database: " . mysql_error() . "\n";
     $db_selected = mysql_select_db('testing', $link);
     if (!$db_selected) {die("Could Not Connect! " . mysql_error() . "\n")};
     $db_list  = mysql_list_dbs($link);
     while ($row = mysql_fetch_object($db_list)) {
       echo $row->Database . "\n";
     echo "Closed MySQL CONNECTION! \n";
    If you notice, I have a ton of debugging `echo` statements, however none of them print out. Usually when that Happened, I knew there was some sort of parse error or something but after googling for a while, I'm not able to figure out what I'm doing wrong.

    I understand that when I ask it to die if something doesn't work, if it doesn't die, then it must obviously be working because I checked with a wrong password and it echo'ed the Couldn't Connect Error Message however, none of the debug statements or confirmation statements are printing.
    Any help is appreciated..

  2. #2

    Re:PHP + MySQL

    Have you tried adding something to the top of the code, like
    echo "foo\n";

  3. #3

    Re:PHP + MySQL

    Yup.. Doesn't work.

  4. #4

    Re:PHP + MySQL

    Gorn & countach44 helped me out..

    I should've used mysql_query
    instead of mysql_create_db <-- it's deprecated.


  5. #5

    Re:PHP + MySQL

    remember to update your mysql also as there have been exploits found

  6. #6

    Re:PHP + MySQL

    [quote author=Mor_gath link=board=9;threadid=9929;start=0#msg89990 date=1098883869]
    remember to update your mysql also as there have been exploits found

    Thanks! Do you happen to know what version of MySQL have been exploits? 4.0.15a is what I'm running on my server -- Slackware 9.1

Similar Threads

  1. Problem starting mysql conflicts with the RPM "mysql-5.0.27-1.fc6"
    By kamakshiganesh in forum Redhat / Fedora
    Replies: 2
    Last Post: 10-26-2007, 04:35 AM
  2. Php/mysql help
    By Wildheart in forum Linux - Software, Applications & Programming
    Replies: 7
    Last Post: 08-19-2005, 10:09 PM
  3. Mysql
    By pinehead in forum Linux - General Topics
    Replies: 4
    Last Post: 11-18-2002, 01:50 AM
  4. mysql
    By pinehead in forum Linux - Software, Applications & Programming
    Replies: 5
    Last Post: 04-02-2002, 08:28 PM
  5. mysql ver 49a
    By elovkoff in forum Linux - Hardware, Networking & Security
    Replies: 4
    Last Post: 03-09-2002, 11:38 PM


Posting Permissions

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