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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP test on AIX

Status
Not open for further replies.

normntwrk

MIS
Aug 12, 2002
336
US
Hi, I'm just starting out with PHP and would like to use it with MYSQl databases

I created a simple test and it doesn't return anything, no errors either. I type php test.php at the comand line and it just just runs without errors or any output. I do have data in the database. Any ideas if this simple test can work? I also want to be able to input data to this databsase using variables later on and could use some input / help on that as well.

<?php
mysql_connect('localhost', 'mysql', '');

mysql_select_db('test');

mysql_query('SELECT rtable FROM test') >'/tmp/test.txt';




?>
 
First, your script produces no output because your script doesn't output anything. I suppose if your PHP installation did not have the MySQL family of functions available, you would likely have seen an error, but this will depend on the settings [tt]display_errors[/tt] and [tt]error_reporting[/tt] in your php.ini.

Second, I'm not sure what this line:

mysql_query('SELECT rtable FROM test') >'/tmp/test.txt';

is supposed to do. It doesn't look like well-formed PHP code to me, but the parser will have the last say on this. I recommend you look at the sample PHP code in the PHP online manual entry for mysql_fetch_assoc()





Want the best answers? Ask the best questions! TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top