...

View Full Version : Auto creating a link



cheechm
06-03-2007, 09:29 PM
Hi,
I can't seem to make a link open in Greybox

<?php

$con = mysql_connect("");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("", $con);

$link = 'review.php?eventname=' . $row['EventName'] . '&year=' . $row['Year'];

$result = mysql_query("SELECT * FROM results");

while($row = mysql_fetch_array($result))
{
echo "<a href='".$link."' 'title="Review"' 'rel="gb_page[500, 500]"'>review</a>";
}

mysql_close($con)

?>


'title="Review"' 'rel="gb_page[500, 500]"' This part stops the page from working. How do I include it in

echo "<a href='".$link."' 'title="Review"' 'rel="gb_page[500, 500]"'>review</a>"; properly?

I hope that is clear. Thanks

Fou-Lu
06-03-2007, 11:47 PM
Hi Cheechm,
Just use a print formatting:


<?php

error_reporting(E_ALL);

$link = '<a href="review.php?event=%s&year=%d" title="Review" rel="gb_page[500, 500]">review</a>';

$con = mysql_connect("");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("", $con);

$result = mysql_query("SELECT * FROM results");

while($row = mysql_fetch_array($result))
{
printf($link, $row['EventName'], $row['Year']);
}

mysql_close($con);

?>

This assumes that year is a number as well.
Not familiar with grey box, but I'm assuming that the problem is that the link isn't properly created.
Give that a shot, see if it works.

cheechm
06-04-2007, 05:22 PM
Works perfectly. Thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum