close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Dynamic link creation from a search results page

Thread began 5/03/2010 8:23 am by freiheit | Last modified 5/04/2010 6:53 am by Jason Byrnes | 806 views | 1 replies |

freiheit

Dynamic link creation from a search results page

hi there,


I made a small search engine to look for data in a mysql database , and then display them.
The problem i have is that i want to make a link to every record that is being displayed that leads to a record page.


/* form code */

<form action="search.php" method="get">

<p>
<input type="text" name="search" id="search" />
<input type="submit" name="submit" id="button" value="submit" />
</p>
</form>
-------------------------------------------------------------------------------------

/* search code */

<?php
// get data

$button = $_GET['submit'];
$search = $_GET['search'];

if (!$button)
echo "Please choose a date.";
else {
if (strlen($search) <=8)
echo "You havent entered a date.";
else {
echo "You searched for the date <b>$search</b> <hr size='2'>";
}
}

$query = "SELECT movements.`date` FROM movements WHERE date LIKE '$search'";
$result = mysql_query($query) or die (mysql_error());
$row_result=mysql_fetch_assoc($result);
$totalRows_result=mysql_num_rows($result);

if ($search = "$totalRows_result")
echo "Date $row_result[date] found.<br> Clink HERE to see all the data related to this date".$row_result['date'];

else
echo "The date you choosed does not exists"

?>
---------------------------------------------------------------------------

Now i want from the results of this page to link to an other page. I know how to do this in html , but i dont know how in php cause i receive a lot of syntax errors which leads to parse errors.

How can i create a dynamic link in my case?

Sign in to reply to this post

Jason ByrnesWebAssist

you would change this line:

php:
echo "Date $row_result[date] found.<br> Clink HERE to see all the data related to this date".$row_result['date'];





to something like:

php:
echo "Date ".$row_result['date'] ." found.<br> Clink <a href=\"page.php?date=".$row_result['date'] ."\">HERE</a> to see all the data related to this date".$row_result['date'];
Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...