hello, i am trying to edit my search engine, i have manages to get it to retrieve data from two mysql tables however now depending on which of the two tables the data is from i would like to display a link whilst adding an array from the table.
table 1 = tip
field name i wish as an array = tipid
table 2 = pic
field name i wish to use as an array= pictipid
i tell the search which table the data is from by using field name "type"
tip = text
pic = picture
here is the code i am currently using;
$sql = "SELECT tipid,title,discription,type FROM tip WHERE title LIKE \"%$string%\"
UNION
SELECT pictipid,title,discription,type FROM pic WHERE title LIKE \"%$string%\" order by title";
$query = mysql_query($sql) or die(mysql_error());
$row_sql = mysql_fetch_assoc($query);
$total = mysql_num_rows($query);
while ($row_sql = mysql_fetch_assoc($query)) {
$pictipid=$row_sql["pictipid"];
$tipid=$row_sql["tipid"];
$title=$row_sql["title"];
$discription=$row_sql["discription"];
$type=$row_sql["type"];
if (($type='text')
$link="<a href=viewtip.php?tipid=$tipid target=new>View Tip</a>)";
else
($link="<a href=viewpictip.php?pictipid=$pictipid target=new>View Picture Tip</a>))";
echo "$title";
echo "$discription";
echo "$type";
echo "$link";
any idea's?
thanks in advance...
matt