Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

apache/php/mysql getting blank page?

Status
Not open for further replies.

svender

Technical User
May 1, 2003
13
US
ok...i'm completely new to php/mysql/and apache... I've followed these instructions to install setup and test it all: and everthing seems to be working great except when I try the test_select_mysql.php page i get a blank page... I checked view source and i don't see any errors.. when i check the table within the database it gets updated evertime I visit the test_insert_mysql.php page... I'm totally confused...it seems it should be working.. i'm wondering if it's something else... firewall? maybe...donno... Hoping someone can look at the the link above and maybe have an idea why i'm getting blank page... Everything else is working fine... I did the simple <?php echo &quot;Hello World&quot;; ?> sample on a seperate page and it works great... oh and the test_insert_mysql.php page works good as well.. Hope this makes sense...

Thx
Svender
 
there may be something wrong in the code... I noticed the what's in the title bar when going to the page is not what is suppose to be displayed... it displays instead of test which is what is in between the <title> tags.. If you remove the code and replace it with a simple <?php echo &quot;Hello World&quot; ?> it works fine but as soon as I put the other code back in... the page just doesn't seem to load correctly... Here's the code....

<?php
// Connect to the database
$dbhost = 'localhost';
$dbusername = 'testuser';
$dbpasswd = 'testpassword';
$database_name = 'simple';
$connection = mysql_connect(&quot;$dbhost&quot;,&quot;$dbusername&quot;,&quot;$dbpasswd&quot;)
or die ('Couldn\'t connect to server.');
$db = mysql_select_db(&quot;$database_name&quot;, $connection)
or die('Couldn\'t select database.');

// Generate code to retrieve data from database.
$select_sql = 'SELECT text FROM simple_table';

// Retrieve code from database.
$result = mysql_query( $select_sql )
or die ( 'It Didn\’t Work: ' . mysql_error() );

// Display results to user.
while ( $row = mysql_fetch_object ( $result ) )
{
echo $row->text . ‘<br>’;
}
?>

Take a look....

Thx
Svender
 
This is the exact problem I'm running into as well so I'm going to bump this thread.
Bump:)
 
None of this makes sense. Is the title tag stored in the MySQL database? I do not see any HTML in the code that could generate a page title.

If <?php echo "Hello World" ?> works, then you have a problem calling the MySQL data. I would suggest going to the command prompt/terminal and testing the MySQL server with some basic queries to see if it is functioning. You might also check out a GUI for MySQL to easily manage your data. MySQL.com offers MySQL Administrator and ControlCenter for free.

- - picklefish - -
Why is everyone in this forum responding to me as picklefish?
 
Yes there is another page previous for it called test_insert_mysql.php that has the code generation info. Well for me anyway test_select_mysql.php displays a parse error for that page.

Parse error: parse error, unexpected '>' in C:\Program Files\Apache Group\Apache2\htdocs\test_select_mysql.php on line 21

But besides this I can properly run Today.php (today's date is...) test.php ( php version & info) and PhpMyAdmin works fine.

What I really am trying to accomplish is running a program that uses php & mysql to organize jobs, it's called Tasks by alexking.org and those pages aren't running correctly.
Could this be a version problem between php4.3.5 and Apache2.0.49? My last option is a xampp install to configure the settings for me, cause I can't seem to find an answer otherwise in any forums.
:(
 
Have you tried checking with Alex King or the support offered on his site? I sent him a dumb question and he responded quickly. While it would be impolite to bug him for petty and general matters, if you think the problem is definitely related to his release, you could pick his brain.

If you can post line 21 of test_select_mysql.php, we might be able to point out the error with '>'.

- - picklefish - -
Why is everyone in this forum responding to me as picklefish?
 
try replacing

echo $row->text . ‘<br>’;

with

echo $row.'<br>';

cause your query appears to be only pulling in one field anyway? alternatively try
print_r($row);
echo '<br>'
and see what comes out!!
 
This is the row 21 from above code:

while ( $row = mysql_fetch_object ( $result ) )



There is no '>' in that line is it expecting it?
 
Silly me - I never looked at the link in the first post. Moonspell has the magic but the issue is much simpler.

Could the fact that there are odd quotes in the following line...
Code:
  echo $row->text . ‘<br>’;
... be causing the problem?

It should be...
Code:
echo $row->text . '<br>';

When wrestling with a tutorial like the one posted on devarticles.com, it is best to seek help from the forum on that site where there are others that are familiar with the script. This issue was already discussed on December 21 by mattp23.

- - picklefish - -
Why is everyone in this forum responding to me as picklefish?
 
Thank you guys the code worked!!! with the '<br>'
Now on to the real issue with of getting tasks running
Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top