DayDreamer16 Posted July 16, 2010 Share Posted July 16, 2010 i hardly ever make anything with php or even code anything so therefore i'm a newb, but this problem is nagging me. here's my code <?php mysql_connect("localhost", "username", "password"); mysql_select_db("database"); $sql = mysql_query("SELECT * FROM searchengine WHERE pagecontent LIKE '%$_GET[term]%' LIMIT 0,$_GET[results]"); while($ser = mysql_fetch_array($sql)) { echo "<h2><a href='javascript:popUp('$ser[pageurl]');'>$ser[title]</a></h2>"; echo "<p>$ser[pagecontent]</p>"; echo "<p><a href='$ser[link]'>$ser[link]</a></p>"; } ?> i have this code in the header <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function popUp(URL) { day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=150');"); } // End --> </script> i cant get the page to popup within the php echo, can anyone help? i'm sure its a simple fix. Quote Link to comment Share on other sites More sharing options...
isedeasy Posted July 16, 2010 Share Posted July 16, 2010 try <?php mysql_connect("localhost", "username", "password"); mysql_select_db("database"); $sql = mysql_query("SELECT * FROM searchengine WHERE pagecontent LIKE '%{$_GET['term']}%' LIMIT 0,{$_GET['results']}"); while($ser = mysql_fetch_array($sql)) { echo "<h2><a href=\"javascript:popUp('{$ser['pageurl']}');\">{$ser['title']}</a></h2>"; echo "<p>{$ser['pagecontent']}</p>"; echo "<p><a href=\"{$ser['link']}\">{$ser['link']}</a></p>"; } ?> Quote Link to comment Share on other sites More sharing options...
DayDreamer16 Posted July 16, 2010 Author Share Posted July 16, 2010 thankyou Quote Link to comment Share on other sites More sharing options...
isedeasy Posted July 16, 2010 Share Posted July 16, 2010 Also make sure you sanitize any input before using it in a query Quote Link to comment Share on other sites More sharing options...
DayDreamer16 Posted July 16, 2010 Author Share Posted July 16, 2010 ok Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.