Jump to content

Warprunner

New Members
  • Posts

    4
  • Joined

  • Last visited

Warprunner's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Here is straight from the DB : The <a href=”http://www.ada.gov” Target="_blank"> Americans with Disabilities Act </a> was enacted in 1990 to establish the prohibition ...
  2. I am doing a search engine for free for a Autism site. I am having a problem with a php query returning an embedded link from a MySql db. The issue is it returns http://mysitename.com and then concatenates the link I had put in which is http://www.ada.com In the db Text field it is : <a href="http://www.ada.com" target="_blank">The Americans with Disabilities Act </a>was enacted in 1990 to establish the prohibition of discrimination.... Results are the link goes to http://www.mysitename.com/"www.ada.com" (Please notice the quotes as well). I don't know why it's putting in mysitename.com or why it's putting quotation marks around the real link or lastly why it's making my link a sub folder of mysitename.com. Pic of the results: Here is the code: <?php // create short variable names $searchtype=$_POST['searchtype']; $searchterm=trim($_POST['searchterm']); if (!$searchtype || !$searchterm) { echo '<p><strong>You have not entered search details. Please go back and try again.</strong></p>'; exit; } if (!get_magic_quotes_gpc()){ $searchtype = addslashes($searchtype); $searchterm = addslashes($searchterm); } @ $db = new mysqli("*","*","*","*"); if (mysqli_connect_errno()) { echo 'Error: Could not connect to database. Please try again later.'; exit; } $query = "select * from acronymns where ".$searchtype." like '%".$searchterm."%' ORDER BY title "; $result = $db->query($query); $num_results = $result->num_rows; echo "<p>Number of records found: ".$num_results."</p>"; for ($i=0; $i <$num_results; $i++) { $row = $result->fetch_assoc(); echo "<p><strong>".($i+1).". "; echo $row['acro']; echo " - "; echo $row['title']; echo "</strong><br />"; echo $row['desc']; echo "</p>"; } // $result->free(); $db->close(); ?> Thank you ahead of time.... this is really driving me nuts!
×
×
  • 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.