Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

creating php script for search form

Featured Replies

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?

post-11338-125103749849_thumb.jpg

Do you know how to query a database?

 

If so you will be wanting to look into FULL TEXT indexing within your database and using an appropriate query based on the users inputs.

 

If you don't know how to query a database I'd start with something simpler tbh! Running before you can walk and all that!

It's not something that can be explained and fully understood in a few minutes but this is the gist:

 

$query = "SELECT field1, field2, field3 FROM table_name WHERE field1 = 'temporary'";
$result = mysql_query($query);
$num = mysql_num_rows($result);

if ($num > 0) {
// print out results using mysql_fetch_array();
}
else {
// nothing was returned
}

 

You would need to dynamically make your query based on user input, and search gets a little more complex as for something like a job search you should really use FULL TEXT search.

 

I reccomend a book, this one is good.

  • Author

It's not something that can be explained and fully understood in a few minutes but this is the gist:

 

$query = "SELECT field1, field2, field3 FROM table_name WHERE field1 = 'temporary'";
$result = mysql_query($query);
$num = mysql_num_rows($result);

if ($num > 0) {
// print out results using mysql_fetch_array();
}
else {
// nothing was returned
}

 

You would need to dynamically make your query based on user input, and search gets a little more complex as for something like a job search you should really use FULL TEXT search.

 

I reccomend a book, this one is good.

 

hmmmm... how long will it take to make the entire script? If it doesn't take too long I'll pay someone to do it?

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.