Re: php and html image tag...
| From: | Jas | Date: | Mon, 08 Apr 2002 14:29:52 +0000 |
| Subject: | Re: php and html image tag... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-92052@lists.php.net to get a copy of this message | ||
Nevermind I got it fixed... I forgot to include a couple of fields from my
database into my array. =). If you would like to use the code I am putting
it here...
<?php
$table = "cm_dev_ads";
$dbh = mysql_connect('localhost','user_name','password') or
die('Could not
connect to database, please try again later');
mysql_select_db('bignicke') or die('Could not select database, please try
again later');
$record = @mysql_query("SELECT wel_area, ad01, ad02, ad03, ad04, ad05, ad06,
ad01_t, ad02_t, ad03_t, ad04_t, ad05_t, ad06_t FROM $table",$dbh);
while ($row = mysql_fetch_array($record)) {
$wel_area = $row['wel_area'];
$ad01 = $row['ad01'];
$ad02 = $row['ad02'];
$ad03 = $row['ad03'];
$ad04 = $row['ad04'];
$ad05 = $row['ad05'];
$ad06 = $row['ad06'];
$ad01_t = $row['ad01_t'];
$ad02_t = $row['ad02_t'];
$ad03_t = $row['ad03_t'];
$ad04_t = $row['ad04_t'];
$ad05_t = $row['ad05_t'];
$ad05_t = $row['ad05_t'];
$ad06_t = $row['ad06_t'];
}
?>
That is the db connection and the results put into an array...
<?php
require 'db_index.php';
?>
This calls to the array script, now to echo them into my java-script it is
as follows...
<a href='javascript:openPopWin("<?php echo $ad01; ?>", 420,545,
"", 0,
0)'onmouseover="window.status='This weeks full page ad';return
true"><img
src="<?php echo $ad01_t; ?>" width="200" height="100"
vspace="0" hspace="0"
border="0"></a>
Hope this helps some other people that might want to do the same type of
thing...
Jas