8
Contributors
9
Replies
20
Views
7 Years
Discussion Span
Last Post by aru211285
0

ok but my page is full php like

<?
$dbhost = 'xxxxxxxxxxx;
    $dbuser = 'xxxxxxxx';
    $dbpass = 'xxx';
    $dbname = 'xxxxx';
    $TABLE_NAME='xxxxx';
    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
    mysql_select_db($dbname, $conn) or die(mysql_error()); 
    $keyword=$_GET[key];
    $result = mysql_query("SELECT NewsPaper,Link,Lang FROM xxxx WHERE State LIKE '%$keyword%'",$conn);
    if (!$result) 
    {
            die('Query failed: ' . mysql_error());
    }

/* fetch rows in reverse order */
for ($i = 0; $i < mysql_num_rows($result); $i++) {
    if (!mysql_data_seek($result, $i)) {
        echo "Cannot seek to row $i: " . mysql_error() . "\n";
        continue;
    }

    if (!($row = mysql_fetch_assoc($result))) {
        continue;
    }


    $NewsPapers[]=$row['NewsPaper'];
    $Links[]=$row['Link'];

}
$nor=sizeof($NewsPapers);



for($j = 0; $j < mysql_num_rows($result); $j++)
{

    print "
    <tr>
        <td><a href=\"[B]".$Link[$j]."[/B]\" target=_blank> <img src=\"/images/news3.gif\" /> <font color=\"#FFFFFF\" size=3>".$NewsPapers[$j]."</font></a> </td>";
}


        ?>

help me in this

Edited by Reverend Jim: Fixed formatting

1
echo "<tr><td><a href='$Link[$j]' target='_blank'> <img src='/images/news3.gif' /> <font color='#FFFFFF' size='3'>$NewsPapers[$j]</font></a></td>";

the html is screwed up,
a mix of xhtml and html,
attributes are required to be quoted,
dtd is required
some browsers will fail to render on this type of error

wrape code in [code=language] [/code] tages where language is html php asp etc. to make viewing simpler

like the instructions on the top of the page tell you

Edited by almostbob: n/a

Votes + Comments
useful
-1

if you want to use in side the html tag or href
use like this
<a href="<?php echo $Lnag[0] ?>"><?php echo $Lnag[0] ?></a>
this is the answer for you question.
if any dobut reply me.

Votes + Comments
Do not use this code in your file, the poster has not bothered to read any part of your existing code and this generic crap will kill php at the first [icode]?>[/icode]
0

if you want to use in side the html tag or href
use like this
<a href="<?php echo $Lnag[0] ?>"><?php echo $Lnag[0] ?></a>
this is the answer for you question.
if any dobut reply me.

Do not use this code in your file, the poster has not bothered to read any part of your existing code and this generic crap will kill php at the first ?>

1

Looks like the other guys have allready answered this, But in case not:

$url = 'http://www.mysite.com'; // or $url = $lang[0];
$link = '<a href="'.$url.'" target="_blank">mylink</a>';
echo $link;

Thats the idea. you may need to modify slighty for your exact need but should do the trick.

Edited by TheWabbit: n/a

0

Many thanks, Little Jon - that's very helpful

Miles

<a href="<?= $Lang[0] ?>" target="_blank">My Lang Link</a>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.