<script src=myscript.php> not displaying
Posted: Sat Aug 30, 2008 6:10 am
Sorry i dont know quiet how to explain this so i will do my best. Basically i have this code that i can embed via src=myfile.php and it will display all the image files in a var on an html page.
this works fine but i want to use this code to display the information in a DB it works fine from the direct php file
http://protocol-x.com/dproof/dbs.php
but when i try to use it via src=myfile.php nothing happens
It has to be used as a src=myfile.php due to certain restrictions. I have tried altering it to load it in as an array as well and still will not work seems to be getting held up due to this part.
any help would be greatly appreciated
Code: Select all
<?
Header("content-type: application/x-javascript");
function returnimages($dirname="/my directory/") {
$pattern="\.(jpg|jpeg|png|gif|bmp)$";
$files = array();
$curimage=0;
if($handle = opendir($dirname)) {
while(false !== ($file = readdir($handle))){
if(eregi($pattern, $file)){
$filedate=date ("M d, Y H:i:s");
echo 'galleryarray[' . $curimage .']=["' . $file . '"];' . "\n";
$curimage++;
}
}
closedir($handle);
}
return($files);
}
echo "var galleryarray=new Array();" . "\n";
returnimages();
?>http://protocol-x.com/dproof/dbs.php
but when i try to use it via src=myfile.php nothing happens
Code: Select all
<?php
$database="DProofImages";
mysql_connect("myserver","mydatabase","mypass");
@mysql_select_db($database) or die( "Unable to select database");
$result = mysql_query( "SELECT * FROM user" )
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
print "There are $num_rows records.<P>";
print "<table width=400 border=1>\n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
foreach ($get_info as $field)
print "\t<td><font face=arial size=1/>$field</font></td>\n";
print "</tr>\n";
}
print "</table>\n";
?>Code: Select all
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
foreach ($get_info as $field)
print "\t<td><font face=arial size=1/>$field</font></td>\n";any help would be greatly appreciated