h4r00n Posted August 23, 2009 Share Posted August 23, 2009 Hi, I have created a form in Dreamweaver and connected mySQL database to it. I am having great trouble in creating a script for it. I have found many on the internet but just cannot get my head around it. The php code I have so far is: <?php $username = "root"; $password = ""; $hostname = "localhost"; $dbh = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); print "Connected to MySQL<br>"; $selected = mysql_select_db("jobjar",$dbh) or die("Could not select jobjar"); ?> and I have attached a print screen of my form and what it looks like when previewed in firefox... can anyone help? [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/171521-php-coding-for-search-form/ Share on other sites More sharing options...
ram4nd Posted August 23, 2009 Share Posted August 23, 2009 Search engine is not form and sql connection only. If you wish to build your own search engine then yo should understand how they work before. You can find many tutorials by searching from google. Link to comment https://forums.phpfreaks.com/topic/171521-php-coding-for-search-form/#findComment-904519 Share on other sites More sharing options...
h4r00n Posted August 23, 2009 Author Share Posted August 23, 2009 Hi, I was hoping that somebody might have a script I can edit? I cannot get my head around the ones on the net. Thanks Link to comment https://forums.phpfreaks.com/topic/171521-php-coding-for-search-form/#findComment-904552 Share on other sites More sharing options...
h4r00n Posted August 24, 2009 Author Share Posted August 24, 2009 Hi, I have the following code: <?php //get data $button = $_GET['submit']; $search = $_GET['search']; if (!$button) echo "You didn't submit a keyword."; else { if (strlen($search)<=2) echo "Search term too short."; else { echo "You searched for <b>$search</b><hr size='1'>"; } } ?> but keep getting an error where I have bolded the above text... any help/ Link to comment https://forums.phpfreaks.com/topic/171521-php-coding-for-search-form/#findComment-905132 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.