Forum Moderators: coopster

Message Too Old, No Replies

running php scripts in browser

         

kuper20

4:47 pm on May 23, 2008 (gmt 0)

10+ Year Member



Hello,

I'm trying to get php to work in my browser because right now I can only get it to work in php editing programs, namely PHPEdit. If I open the file in my browser it doesn't do any of the php code or display any of the echo's. I have wampserver installed which therefore has apache, php, and mysql installed.

I also want to get my database I've created on phpmyadmin to work on the local server I'm connected to. I don't know how to access phpmyadmin from there. I tried to install wampserver onto the local server but if I try to open phpmyadmin I just get a bunch of mumbo jumbo.

Any help would be greatly appreciated. I don't exactly know what's going on here and how some of this stuff is set up so if I have the wrong thought process please tell me.

Thanks

dreamcatcher

6:28 pm on May 23, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld kuper20. :)

Are you putting your .php files in the web root of your local server? Wampserver is www (http://localhost) I believe. Doesn`t sound like the .php files are parsing.

And when you say you get 'mumbo jumbo' for PHPMyAdmin, can you give us some more information about what you see?

dc

kuper20

7:05 pm on May 23, 2008 (gmt 0)

10+ Year Member



ok, well I changed some things and now phpmyadmin works through the network. But the file still doesn't run correctly on my browser, whether it's on my computer or the local network. I had my .php file in the web root on the server in wamp and before it wasn't doing anything, but now it seems like it's not parsing the php correctly. Here's what outputs in the browser:

Unable to connect to the " . "database server at this time.

" ); exit(); } // Select the player profile database if (! @mysql_select_db("player profile") ) { echo( "

Unable to locate the " . "database at this time.
" ); exit(); } echo("

Here are all the names " . "in the database:
"); // Request the text of all the names $result = mysql_query( "SELECT * FROM player_info"); if (!$result) { echo("

Error performing query: " . mysql_error() . "
"); exit(); } // Display the text of the names while ( $row = mysql_fetch_array($result) ) { echo("

" . $row["Name"] . "
"); } ?>

And here's what's in the .php file. I'm just doing a basic pulling names from my database:


<HTML>
<head><title>testing</title></head>
<BODY>

<?php

$dbcnx = @mysql_connect("localhost",
"root", "");
if (!$dbcnx) {
echo( "<P>Unable to connect to the " .
"database server at this time.</P>" );
exit();
}

// Select the player profile database
if (! @mysql_select_db("player profile") ) {
echo( "<P>Unable to locate the " .
"database at this time.</P>" );
exit();
}

echo("<P> Here are all the names " .
"in the database: </P>");

// Request the text of all the names
$result = mysql_query(
"SELECT * FROM player_info");
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>");
exit();
}

// Display the text of each name
while ( $row = mysql_fetch_array($result) ) {
echo("<P>" . $row["Name"] . "</P>");
}
?>

</BODY>
</HTML>

and thanks for the welcome :)