Jump to content

Recommended Posts

I'm pretty new to php/mysql, im used to java/jsp/mssql.  I'm just trying to set it up at this point.  When I run a simple php script it works fine (ie: I can get the date etc.)  Now I'm trying to just do a simple database connection script that should print out the list of databases.  When I run it I get a completely blank screen.  I have asterisked out the username/pword but I am 100% certain they are accurate. 

 

<?php

$conn = mysql_connect("localhost", "***", "***");

$result = mysql_list_dbs($conn);

 

while($db_data = mysql_fetch_row($result)){

echo "<b> $db_data[0] </b><br>";

}

?>

 

When I go to view source, I get absolutely nothing.  This tells me that the code isn't getting into the while loop (since there is html in the while loop, yet nothing is being printed out.)  is this correct logic? 

 

Does anyone know whats wrong?

 

Many thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/68745-problem-with-php-mysql-and-apache/
Share on other sites

[Mon Sep 10 17:20:17 2007] [error] [client 127.0.0.1] PHP Fatal error:  Call to undefined function mysql_connect() in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\test.php on line 3

 

 

Sorry forgot to post the error log. 

You also never select a database.

 

Thanks for the help so far.

 

I dunno I just copied it out of a book.  I think it's supposed to just print out all the databases's names. 

 

Either way, I tried doing that but my PHP folder doesn't have a subfolder call \ext

 

It compiles php fine, but no ext folder.  weird...anyone?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.