progolf069
Programmer
I am now in the stages I am ready to start accessing one of my many Postgrsql Databases that I have installed on my Redhat Linux 7.2 machine. I have CGI working correctly, and my databases are working just fine from the command line (in telnet), but now I want to integrate the databases to the web side of things.
Currently I have this script written:
When I execute the above script, I don't access the server, I only print out the psql med2000..... line. This is understood, and I know why that is happening. Is there anyway that I can do like a system call for that command to be processed on the server and then have it display the results? When I execute the command on the server's command line (in telnet) it automatically generates (the -H attribute of that string) all of the HTML code for you example of the output:
... continues on....
Any suggestions?
Basic question-- is there anyway that I can run that command (psql med2000 -U ian -H -c "SELECT * FROM icd9;"
on the server side and return the results to the user (on the web)?
Thanks for your assistance and any feedback you give!
Currently I have this script written:
Code:
#!/usr/bin/perl
# database.cgi -- does database lookups!
# my first -- database to web output script!+
#PATH='/usr/local/pgsql/bin:/bin';
print "Content-type: text/html\n\n";
print <<"EOF";
print '<html><head><title>ICD9 Med Codes</title></head><body>';
print 'psql med2000 -U ian -H -c "SELECT * FROM icd9;"';
print '</body></html>';
EOF
When I execute the above script, I don't access the server, I only print out the psql med2000..... line. This is understood, and I know why that is happening. Is there anyway that I can do like a system call for that command to be processed on the server and then have it display the results? When I execute the command on the server's command line (in telnet) it automatically generates (the -H attribute of that string) all of the HTML code for you example of the output:
Code:
<table border=1>
<tr>
<th align=center>trans_num</th>
<th align=center>icd9_diag</th>
</tr>
<tr valign=top>
<td align=left>001 </td>
<td align=left>Cholera^M</td>
</tr>
<tr valign=top>
<td align=left>001.0 </td>
<td align=left>Due to Vibrio cholerae^M</td>
</tr>
<tr valign=top>
<td align=left>001.1 </td>
<td align=left>Due to Vibrio cholerae el tor^M</td>
</tr>
<tr valign=top>
<td align=left>001.9 </td>
<td align=left>Cholera, unspecified^M</td>
</tr>
Any suggestions?
Basic question-- is there anyway that I can run that command (psql med2000 -U ian -H -c "SELECT * FROM icd9;"
Thanks for your assistance and any feedback you give!