Code working on command line but not Browser
Posted: Tue Apr 18, 2006 11:04 pm
feyd | Please use
Any idea why?
Thank you.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi All,
I am newbie here and also new to PHP and MySQL. I have wrote a PHP script to open the db connection and read through one of the table's record. My script works in command line. I can see the result, but when i am calling it from browser, it just apear blank page.
I am using Apache2, php5 and mysql 5, installaed on SuSe linux 10.0 .
here is my script:Code: Select all
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'pass';
$dbname = 'plaincart';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die
('Error connecting to mysql');
mysql_select_db($dbname);
$result = mysql_query("SELECT user_name FROM tbl_user");
while($r=mysql_fetch_array($result,$conn))
{
echo $r['user_name'];
}
mysql_close($conn);
?>Thank you.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]