Jump to content

help in assiging correct variables


pixeltrace

Recommended Posts

guys,
i need help, kindly check
[a href=\"http://www.sinagtala.net/sinag3/eventsmain.php\" target=\"_blank\"]http://www.sinagtala.net/sinag3/eventsmain.php[/a]
if you'll notice the
Arturo Rocha Memorial Mass
there is a dead image link.
that's my problem.
i'm not sure whats my mistake on my script but what i wanted to happen there is
from my script i have the if-else condition wherein if the $uRow[2] ==1 the image table
should not appear there. which is happening to the other contents.
but if my $uRow[2] is not equal to 1 there should be an image there
below is the scrpt that i used for that:
===================

<?
include 'db_connect.php';

$uSql = "SELECT event_image, event_title, event_description, event_imagelink FROM events WHERE event_type = 'tour' ORDER by event_date DESC";
$uResult = mysql_query($uSql, $connection);
if(!$uResult){
echo 'no data found';
}
else{
while($uRow = mysql_fetch_row($uResult)){
?>
---------------
<?
$eimages = '$uRow[3]';
if ($uRow[0] == 1) { echo ""; }
else {
echo '<td width="70" rowspan="2" align="center" valign="top"><table width="70" border="1" cellpadding="0" cellspacing="0" bordercolor="#666666">';
echo '<tr><td>';
echo '<a href="images/events/$eimages.jpg" target="_blank"><img src="images/events/thumbs/$eimages.gif" width="60" height="60" border="0"></a>';
echo '</td></tr></table></td>';
}?>

==================
hope you guys can help me with this
thanks in advance!



Link to comment
https://forums.phpfreaks.com/topic/4228-help-in-assiging-correct-variables/
Share on other sites

Since you started your echo with single quotes you have to come out of the echo to print up the link.

[code]
echo '<a href="images/events/'.$eimages.'.jpg" target="_blank"><img src="images/events/thumbs/'.$eimages.'.gif" width="60" height="60" border="0"></a>';[/code]

Ray
Ray,
Thanks but its still not working.

do you think there is something wrong with the variables that i've used
this is my sql query
=========
<?
include 'db_connect.php';

$uSql = "SELECT event_image, event_title, event_description, event_imagelink FROM events WHERE event_type = 'tour' ORDER by event_date DESC";
$uResult = mysql_query($uSql, $connection);
if(!$uResult){
echo 'no data found';
}
else{
while($uRow = mysql_fetch_row($uResult)){
?>
============
and this is the script that i used for the image link with the modifications that you suggested
============
<?
$eimages = '$uRow[3]';
if ($uRow[0] == 1) { echo ""; }
else {
echo '<td width="70" rowspan="2" align="center" valign="top"><table width="70" border="1" cellpadding="0" cellspacing="0" bordercolor="#666666">';
echo '<tr><td>';
echo '<a href="images/events/'.$eimages.'.jpg" target="_blank"><img src="images/events/thumbs/'.$eimages.'.gif" width="60" height="60" border="0"></a>';
echo '</td></tr></table></td>';
}?>
===========

do you think it has something to do with this variable?
$eimages = '$uRow[3]';
the data that should appear on the $eimages will come from the database
but with the modification that you suggested, when you click on the imagelink
this is the picture link that is showing
$uRow[3].jpg

===========
any suggestions?
thanks in advance!
gaia,

correct me on this one, i assigned $eimages for uRow['event_imagelink']
since the data on the row of imagelink is the imagename of the image on the script that i made here

echo '<a href="images/events/'.$eimages.'.jpg" target="_blank"><img src="images/events/thumbs/'.$eimages.'.gif" width="60" height="60" border="0"></a>';

is this correct?
if not can do you have any suggestions on this. because honestly i am still getting confused with assigning variables.
======== this is my query
<?
include 'db_connect.php';

$uSql = "SELECT event_image, event_title, event_description, event_imagelink FROM events WHERE event_type = 'tours' ORDER by event_date DESC";
$uResult = mysql_query($uSql, $connection);
if(!$uResult){
echo 'no data found';
}
else{
while($uRow = mysql_fetch_row($uResult)){
?>

======== and this is the script that i used for the imagelink
<?
$eimages = '$uRow[3]';
if ($uRow[0] == 1) { echo ""; }
else {
echo '<td width="70" rowspan="2" align="center" valign="top"><table width="70" border="1" cellpadding="0" cellspacing="0" bordercolor="#666666">';
echo '<tr><td>';
echo '<a href="images/events/'.$eimages.'.jpg" target="_blank"><img src="images/events/thumbs/'.$eimages.'.gif" width="60" height="60" border="0"></a>';
echo '</td></tr></table></td>';
}?>


Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.