joseph.lyons.754

I needed a grid layout to display some images. I found this one online http://alijafarian.com/demos/responsive-image-grids-using-css

Its displays but not like it should. Through a process of elimination i figured it was a js file causing this, two to be precise. init.js & skel.panel.min.js These js file came with the template and have something to do with the pages structure and display. I cant seem to find anyone having the same problem i tried using no conflict and that hasnt worked.

my header
`

    <head>
        <title></title>
        <link rel='shortcut icon' type='image/x-icon' href='images/favicon/favicon.ico' />
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <meta name="description" content="" />
        <meta name="keywords" content=""/>
        <link href='http://fonts.googleapis.com/css?family=Raleway:400,100,200,300,500,600,700,800,900' rel='stylesheet' type='text/css'>
        <!--[if lte IE 8]><script src="js/html5shiv.js"></script><![endif]-->
    <style>
        #banner
            {   
                width:auto;
                height:400px;
                margin-left: auto;
                margin-right: auto;
                position: relative;
                background: #333 url(images/banners/banner03.jpg) no-repeat center;
                background-size: 1900px;
                padding-bottom: -200px;
            }

ul.grid-nav {
    list-style: none;
    font-size: .85em;
    font-weight: 200;
    text-align: center;
}
ul.grid-nav li {
    display: inline-block;
}
ul.grid-nav li a {
    display: inline-block;
    background: #999;
    color: #fff;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 4px;
    -moz-border-radius: 4px;
    -webkit-border-radius: 4px;
}
ul.grid-nav li a:hover {
    background: #7b0;
}
ul.grid-nav li a.active {
    background: #333;
}
.grid-container {
    display: none;
}
/* ----- Image grids ----- */
ul.rig {
    list-style: none;
    font-size: 0px;
    margin-left: -2.5%; /* should match li left margin */
}
ul.rig li {
    display: inline-block;
    padding: 10px;
    margin: 0 0 2.5% 2.5%;
    background: #fff;
    border: 1px solid #ddd;
    font-size: 16px;
    font-size: 1rem;
    vertical-align: top;
    box-shadow: 0 0 5px #ddd;
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
}
ul.rig ...

joseph.lyons.754

Not really its that I cannot change the div id "marketing" to anything else. If i do it all goes haywire E.g

If i was to swap the second for the first it wouldnt work even though there the exact same and would have knock on effects on other css elements.

Thats why im asking is there something that can somewhat set the order the divs are to appear in?

#marketing
    {   
        max-width:1200px;
        width:auto;
        border-style: solid;
        border-width: 5px;
        border-color:#3c340d;
        margin-right:auto;
        margin-left:auto;
        background: #d0f6eb;
        background-size:cover;
        position: relative;
        font-size: 18pt;
        color: #3c340d;
        font-family: "Times New Roman", Times, serif;
        padding-left:1.3em;
        padding-right:10px;

            }

 #marketingHome
    {   
        max-width:1200px;
        width:auto;
        border-style: solid;
        border-width: 5px;
        border-color:#3c340d;
        margin-right:auto;
        margin-left:auto;
        background: #d0f6eb;
        background-size:cover;
        position: relative;
        font-size: 18pt;
        color: #3c340d;
        font-family: "Times New Roman", Times, serif;
        padding-left:1.3em;
        padding-right:10px;

            }

I tried your way(css in the header) and it worked but when its resized to mobile i would need the background to turn off as the aspect ratio gos all funky.

Thanks

joseph.lyons.754

I am using a responsive template to make a website.

The problem I am having is with the css I need to have different images for a handful of pages. Not all pages need different images.

I attempted this by adding another div and changing the name slightly orginally it was marketing(This div is still in use for all those pages that dont need images) I added one called marketingIndex for the homepage.(This is where the problem arose).

It worked in the sense that the background was there but it messed with the footer div(the footer rose half way up the page over the body of the text) at the end of the page only when it was resized for mobile. There is no obvious interference from any other css and in theory it should work no?

Is there some sneaky code to predetermine layout of the page like Featured -> marketing -> footer and if the name is changed it doesnt work?

The css in question:

    #marketing
    {   
        max-width:1200px;
        width:auto;
        border-style: solid;
        border-width: 5px;
        border-color:#3c340d;
        margin-right:auto;
        margin-left:auto;
        background: #d0f6eb;
        background-size:cover;
        position: relative;
        font-size: 18pt;
        color: #3c340d;
        font-family: "Times New Roman", Times, serif;
        padding-left:1.3em;
        padding-right:10px;

            }

    #marketing h2{
            padding-left:1.3em;
            color: #3c340d;
    }

    #marketingHome{
        width:auto;
        max-width:1200px;
        height:850px;
        margin-right:auto;
        margin-left:auto;
        background: url("../images/backgrounds/indexBck.jpg") no-repeat center;
        background-size:100% 100%;
        position: relative;
        padding: 7em 0em;
    }
    #marketingHome p{
            font-size: 20pt;
            color: #000;
            font-family: "Times New Roman", Times, serif;
            padding-left:1.3em;
    }

The div in question:

<div id="marketingHome">
            <div class="container">

                <div class="row" >
                    <div class="8u">
                        <header>
                        </header>

                            <section ...

joseph.lyons.754

Im tryin to add an admin to my database. Its not working but im not gettin any error messages ive tried a hundred different ways but its always the same it appears to be working but never actually does. Im hoping a more skilled eye can spot my mistake. Thanks in advance.
Heres the code:

The last 3 paragrapghs of code is the insert ive included the rest incase its interfereing. The middle paragragh is used to determine if the admin is already in the daabase this doesn't work either.

<?php 

session_start();
if (!isset($_SESSION["manager"])) {
    header("location: admin_login.php"); 
    exit();
}
// Be sure to check that this manager SESSION value is in fact in the database
$managerID = preg_replace('#[^0-9]#i', '', $_SESSION["id"]); // filter everything but numbers and letters
$manager = preg_replace('#[^A-Za-z0-9]#i', '', $_SESSION["manager"]); // filter everything but numbers and letters
$password = preg_replace('#[^A-Za-z0-9]#i', '', $_SESSION["password"]); // filter everything but numbers and letters
// Run mySQL query to be sure that this person is an admin and that their password session var equals the database information
// Connect to the MySQL database  
include "../storescripts/connect_to_mysql.php"; 
$sql = mysql_query("SELECT * FROM admin WHERE id='$managerID' AND username='$manager' AND password='$password' LIMIT 1"); // query the person
// ------- MAKE SURE PERSON EXISTS IN DATABASE ---------
$existCount = mysql_num_rows($sql); // count the row nums
if ($existCount == 0) { // evaluate the count
     echo "Your login session data is not on record in the database.";
     exit();
}
?>
<?php 
// Script Error Reporting
error_reporting(E_ALL);
ini_set('display_errors', '1');
?> ...

joseph.lyons.754

Thanks all fixed :)

joseph.lyons.754

I want to pull the image name from the database and insert it to the folder directory path using php.

I am wondering is this possible and if so how? Ive attempted it a few different ways but i can't figure it out?

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";

 This Line ---> echo "<td> <img src='/images/ <?php '. $row['images_name'] .''>" "</td>"; <---

  echo "<td>" . $row['product_name'] . "</td>";
  echo "<td>" . $row['price']. "</td>";
  echo "<td>" . $row['details'] . "</td>";

  echo "</tr>";
  }

joseph.lyons.754

Tryin to get this project to open on the server but before i can even see the php file inside i am getting errors. Solved a few but cannot see the error here hopefully ye can help.

Error 1 = SCREAM: Error suppression ignored for

Error 2 : Parse error: syntax error, unexpected '" href="' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' in C:\wamp\www\Bus\bar.php on line 5

php file :

1 <?php
2 $catsql = "SELECT * FROM categories;";
3 $catres = mysql_query($catsql);
4 while($catrow = mysql_fetch_assoc($catres)){
5 echo "<a id="" href="&quot; .$config_basedir. &quot;/products.php?id=&quot; . $catrow[">".         $catrow['name'] . "</a>";}
  ?>

joseph.lyons.754

U are a Legend :) Thanks a million :)

joseph.lyons.754

Hey Guys,

What i want it to do :

  1. Combobox is displayed with a list of countys ie Limerick Dublin Cork
  2. Choose County brings up second Combobox with countys towns and villages.
  3. Hit search brings up relevant towns and vilages from the county chosen.

What it does:

  1. Loads countys
  2. chose county
  3. Second box pops up but with no values in the combobox nd it then crashs and informs me that County_ID cannot be found and "severe null"

Code to fill First Combobox with the Countys (Works fine)

 public Activities_Area_Search1() {
        try {
            initComponents();
             JdbcRowSetImpl rowSet = new JdbcRowSetImpl();

                rowSet.setUrl("xxxxxxxxxxxxxxxx");
                rowSet.setUsername("xxx");
                rowSet.setPassword("xxx");

                rowSet.setCommand("SELECT DISTINCT County_ID FROM activities ");
                rowSet.execute();

                while (rowSet.next()) {
                    String A2 = rowSet.getString("County_ID");
                    ComboBox1.addItem(A2);

                }
        } catch (SQLException ex) {
            Logger.getLogger(Activities_Area_Search1.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {                                             

       Activities_Area_Search2 AR2 = new Activities_Area_Search2(ComboBox1.getSelectedItem());
        AR2.setVisible(true);
        dispose();
    }                                            

Code For second Combobox that shud contain relevant towns and villages but doesn't .

  public Activities_Area_Search2(Object County_ID) {
        try {
            initComponents();
             JdbcRowSetImpl rowSet = new JdbcRowSetImpl();

                rowSet.setUrl("jdbc:mysql://localhost:3306/ireland");
                rowSet.setUsername("root");
                rowSet.setPassword("MySQL5");

                rowSet.setCommand("SELECT Town FROM activities WHERE County_ID = '"+ County_ID + "'");
                rowSet.execute();

                while (rowSet.next()) {
                    String A1 = rowSet.getString("County_ID");
                    ComboBox.addItem(A1);

                }
        } catch (SQLException ex) {
            Logger.getLogger(Activities_Area_Search2.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Activities_Area_Search2("County_ID").setVisible(true);
            }
        });
    }

So my problem is with the second piece of code the combo box shows up empty and as far as i see everything is ok ...

joseph.lyons.754

Theres only four rows in it nd when i run it, it all comes back fine O_o implemented all changes and no joy still nt workin...

joseph.lyons.754

Theres only four rows in the database nd when i run it, it all comes back fine O_o implemented all changes and no joy still nt workin...

joseph.lyons.754

Yes Sorry $row['owner'] is always the same i put in your suggestions but its still not working the first name in the database keeps coming up. heres the loop with the up to date changes: `

$rs=mysql_query("select * from mailList LIMIT 20 ");
// if (!$query) die(mysql_error());

//$owner= mysql_query("select owner from mailList LIMIT 20");
// Do while loop to send email.
while($row=mysql_fetch_assoc($rs)){

    $email_to = $row['email'];
    $email_message = "";
    $email_message = "Hi ".$row['owner']."  ";
    $email_message = "";
    $email_from = "NoReply@xxxxxxxx.ie"; 
    $email_headers = "MIME-Version: 1.0\r\nContent-type:text/html;charset=utf-8\r\nFrom: $email_from\r\nReply-To: $email_from \r\n";

   mail(  $email_to,  $subject,  $email_message,  $email_headers);

// Show sent emails.
echo "$row[email]<br>";
}

I've also included the sql for the while loop aswell.

joseph.lyons.754

OK thats all workin great last question :)
The while loop is grabbing the emails properly but not the owners names i keep gettin the name from the first row in the database in all the emails?

joseph.lyons.754

Q1. Is $sender="***"; related to $mail_from="From:$email n"; or should it be ?? as $email isn't declared anywhere.

Q2. Are both lines need or could i get rid of one??

Q3. The note thats commented out is like that because it was orginally been sent from the previous page where the subject is also given thing is i don't want to do that. how would i declre it in that case??

joseph.lyons.754

Hey Guys,

I am writing this code to send out personalised emails to potential customers. And i have few questions about the code. This code is made from several tutorials and code examples. I have searched for stuff on it and theres plenty of articles about it but not what i want to do.
If anyone knows of one please throw us a link.

This has two pages the first is just a basic form to fill in the subject thats it really. And the second is below.

I'll reference the question next to the code its related to. :)

Q1. Is this line and Q2 related or should they be related?

Q2. What do these two lines do and what are they meant to do? They don't make sense to me but i've rechecked the tutorial and thats whats there? Along with the fact the varible $email isn't assigned to anything(Im gettin an erroe for it at the moment.)?

Q3. This bit of code is working but not correctly all i get when i view the emails (i am just testing by sending 4 emails at the moment) is the first name from the first person in the database?

<?php
// Check, if submitted.
//if($submit)
if(isset($_POST['submit'])){

// Get variables from POST method form.
$subject=$_POST['subject'];
//$note=$_POST['note'];

Q1. line below

$sender="***********"; // Your Email here.

echo "Email has been sent to:";

// Connect database
mysql_connect("localhost","root","");
mysql_select_db("******");

$rs=mysql_query("select * from mailList LIMIT 20 ");
// if (!$query) die(mysql_error());

// Do while loop ...

joseph.lyons.754

Im writing some code to send out emails for work. And i've been stuck on with this error for a while nw. Any help will be greatly appreciated.

Error message: Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\wamp\www\PHP\mailMany.php on line 21

Heres my code:

<?php
// Check, if submitted.
//if($submit)
if(isset($_POST['submit'])){

// Get variables from POST method form.
$subject=$_POST['subject'];
$note=$_POST['note'];

$sender="joelyonswork@gmail.com"; // Your Email here.

echo "Email has been sent to:";

// Connect database
mysql_connect("localhost","root","");
mysql_select_db("commercialenterprise");

$rs=mysql_query("select CommercialEnterprise_Email from commercialenterprise WHERE 'town' = 'Killkee'");

// Do while loop to send email.

The Line below is where error is.

while($row=mysql_fetch_assoc($rs)){
$to=$row['email'];
$mail_from="From:$email n";
$mail_from .="Content-Type: text/html; charset=utf-8 n";

mail($to,$subject,$note,$mail_from);

// Show sent emails.
echo "$row[email]<br>";
}
}
else{

// Do following codes if not found "Submit" value.(Not submitted)
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<title>Email Form</title>
<body>
<form action="<? echo $PHP_SELF; ?>" method="post" name="form" id="form">
<table>
<tr>
<td align="right">Subject : </td>
<td><input name="email" type="text" id="email" /></td>
</tr>
<tr>
<td align="right" valign="top">Note : </td>
<td><textarea name="comment" cols="60" rows="5" id="comment"></textarea></td>
</tr>
</table>
<input type="submit" name="Submit" value="Send Email" />
</form>
</body>
</html>
<?php } ?>

Thanks in advance :)

joseph.lyons.754

Can anybody point me in the direction of a good tutorial or pre written script for mailing many users from a database. Have been searching for the last two days and have got nothing good :(. Any help will be greatly appreciated. Either through gmail smpt or through a legitamate hosting site i just need sumthin to get this going. thanks

joseph.lyons.754

Lifesaver man can't thank you enough :)

joseph.lyons.754

Cool heres a mock database :
CREATE DATABASE DB;

CREATE TABLE table1 (
    id INT,
    name VARCHAR(20),
    email VARCHAR(20),
    Location VARCHAR(20)
);
INSERT INTO table1 (id,name,email,Location) VALUES(1,"Tom","tom@yahoo.com","Ennis"); 

CREATE TABLE table2 (
    id INT,
    name VARCHAR(20),
    email VARCHAR(20),
    Location VARCHAR(20)
);
INSERT INTO table2 (id,name,email,Location) VALUES(2,"John","John@yahoo.com","Ennis"); 

CREATE TABLE table3 (
    id INT,
    name VARCHAR(20),
    email VARCHAR(20),
    Location VARCHAR(20)
);
INSERT INTO table3 (id,name,email,Location) VALUES(3,"Jack","Jack@yahoo.com","Ennis"); 

CREATE TABLE table4 (
    id INT,
    name VARCHAR(20),
    email VARCHAR(20),
    Location VARCHAR(20)
);
INSERT INTO table4 (id,name,email,Location) VALUES(5,"Martin","Martin@yahoo.com","Ennis"); 

CREATE TABLE table5 (
    id INT,
    name VARCHAR(20),
    email VARCHAR(20),
    Location VARCHAR(20)
);
INSERT INTO table5 (id,name,email,Location) VALUES(4,"Tim","Tim@yahoo.com","Ennis"); 

CREATE TABLE table6 (
    id INT,
    name VARCHAR(20),
    email VARCHAR(20),
    Location VARCHAR(20)
);
INSERT INTO table6 (id,name,email,Location) VALUES(12,"Kim","Kim@yahoo.com","Ennis"); 

Heres the code for the search box:

import com.sun.rowset.JdbcRowSetImpl;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Search_All extends javax.swing.JFrame {

    public Search_All() {

    initComponents();
     try {
             JdbcRowSetImpl rowSet = new JdbcRowSetImpl();

                rowSet.setUrl("jdbc:mysql://localhost:3306/db");
                rowSet.setUsername("root");
                rowSet.setPassword("MySQL5");

    rowSet.setCommand("SELECT DISTINCT name FROM location order by name");
                rowSet.execute();
                while (rowSet.next()) {
                    String SA = rowSet.getString("name");
                    townComboBox.addItem(SA);

      }
        } catch (SQLException ex) {
            Logger.getLogger(Search_All.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        townComboBox = new javax.swing.JComboBox();
        searchButton = new javax.swing.JButton();
        exitButton = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        townComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void ...

joseph.lyons.754

Yep no joy im afraid. I have tried changing that class around quite alot but nothing i do seem to make any difference. Its like theres an error some where thats preventing all changes from being implemented O_o. But there is nothing in the code that leads me to believe there's a serious error?

This thing is diving me insane :( especially since this isn't the hard part haha

joseph.lyons.754

I have been tryin to get this to work for the past week if not two >:( with no joy. Worst of all its such a trivial problem.

The program asks you to choose a town name from a combo box when you choose the location you shoud be brought to a brand new Jframe with a populated Jtable. Now everything does what its meant to do except the jframe window which opens as the border of the window and the minmise,maximise and close buttons. You can view the database by expanding the jframe window from the bottom right corner(Click and drag it open). But i cannot leave it at that extremely unprofessional.

This design issue has been the bane of my existence for the last 2 weeks.

So I ask you out of the kindness of your hearts to do one favour or another for me:

Favour 1:
Tranfer my code into a jframe I have tried this numerous times myself but it has not worked. (A bit cheeky).

Favour 2:
Give me a step by step on how to achieve favour 1?

Or if someone has a working sample of something like this could they share it with me??

Any help would be greatly appreciated

Heres my code(Java Class):

import java.awt.*;
import java.sql.*;
import java.util.*;
import javax.swing.*;
import javax.swing.table.*;

public class Display_All extends JFrame
{
   Object JFrame;
   Object JTable;
   Object JScrollpane;

    public Display_All(Object town)
    {
        Vector columnNames = new Vector();
        Vector<Vector<Object>> data = new Vector<Vector<Object>>();
//  Get column ...

joseph.lyons.754

Figured it out I was being thick! I would delete this question due to its stupidity! but i can't seem to find the place to delete the articles you post haha

joseph.lyons.754

Hey Guys,

I am working on a search that takes in a value via textfield. Once taken in it should display another Jframe with the info but the searchbox crashes the second I run it.

Its some stupid mistake I have made or i have gone about it the wrong way but at this stage my brain is fried from lookin at this code and i am not making any head way.

The search box Code:

import com.sun.rowset.JdbcRowSetImpl;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Joe Lyons
 */
public class BB_Value_SearchBox extends javax.swing.JFrame {

    /**
     * Creates new form BB_Value_SearchBox
     */
    public BB_Value_SearchBox() {
        initComponents();

        try {

            JdbcRowSetImpl rowSet = new JdbcRowSetImpl();
             String BB_Name = rowSet.getString("BB_Name");

        } catch (SQLException ex) {
            Logger.getLogger(BB_Value_SearchBox.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
        private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {                                             

        BB_Value_Results BVS = new BB_Value_Results(searchBoxTextField.getText());
        BVS.setVisible(true);
        dispose();
    }                                            

    private void exitButtonActionPerformed(java.awt.event.ActionEvent evt) {                                           
        Main_Page MP = new Main_Page(null);
        MP.setVisible(true);
        dispose();
    }                                          

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(BB_Value_SearchBox.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(BB_Value_SearchBox.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(BB_Value_SearchBox.class.getName()).log(java.util.logging.Level.SEVERE, null, ...

joseph.lyons.754

Thanks man. All Working :)

joseph.lyons.754

Yep I know but every time i tried to change it i got errors. Hw wud i change it so it wudn't make it go haywire?? thanks

joseph.lyons.754

Hey Guys,

So I was doin a tutorial and I incorporated it into my code and it works for the most part.
The program gives you a list of town names you pick one and hit search. All good so far then the program goes into the database and pulls the relevant info from 6 tables and they display in the next gui on a Jtable.

Only problem is the column header are taken from the database aswell but I want Generic column titles as the ones from the table reflect the table they were pulled from and since there not from the same table this is a problem.

I have tried moving things around and taking things out but this leads to errors everywhere O_o

Heres the code :

 public Display_All(Object town)
    {
        Vector columnNames = new Vector();
        Vector data = new Vector();

        try
        {
            //  Connect to an Access Database

            String driver = "com.mysql.jdbc.Driver";
            String url ="jdbc:mysql://localhost:3356/ireland";
            String userid = "root";
            String password = "password";

            Class.forName( driver );
            Connection connection = DriverManager.getConnection( url, userid, password );

            //  Read data from a table

            String sql = "(SELECT * FROM activities WHERE Town ='"+town+"')"
                    + "UNION ALL ( SELECT * FROM attractions WHERE Town = '"+town+"')"
                    + "UNION ALL ( SELECT * FROM bb WHERE Town = '"+town+"')"
                    + "UNION ALL ( SELECT * FROM hotels WHERE Town = '"+town+"')"
                    + "UNION ALL ( SELECT * FROM pubs WHERE Town = '"+town+"')"
                    + "UNION ALL ( SELECT * FROM restaurant ...

joseph.lyons.754

Thanks man got it workin. One more question how do i stop it from recognising white spaces as part of the name??

joseph.lyons.754

I made both changes and it doesn't do anything still. I get what ya mean alright. And I am not getting any errors either?

Way 2

   Scanner sc = new Scanner(System.in);

        try{
            java.sql.Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/ireland","root" ,"pass"); 

        Statement stmt = con.createStatement();

       JOptionPane.showInputDialog("Please Enter the pubs name you wish to search.");

         String pubName = sc.next();

        String SQL = "SELECT * FROM pubs WHERE Pub_Name = '" + pubName +"'";

        ResultSet rs = stmt.executeQuery(SQL);

        if (rs.next()) {
                JOptionPane.showMessageDialog(null, "Pub already exists!!");
            }
        else {
                JOptionPane.showMessageDialog(null, "Pub doesn't exists!!");
            }
        }
        catch (Exception e){
          JOptionPane.showMessageDialog( null, "There was a problem inserting into the database please try again ", "ERROR", JOptionPane.ERROR_MESSAGE);
        }

Way 1

Scanner sc = new Scanner(System.in);
        try{
            java.sql.Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/ireland","root" ,"pass"); 

        Statement stmt = con.createStatement();

       String pubName = JOptionPane.showInputDialog("Please Enter the pubs name you wish to search.");

          pubName = sc.next();

        String SQL = "SELECT * FROM pubs WHERE Pub_Name = '" + pubName +"'";

        ResultSet rs = stmt.executeQuery(SQL);

        if (rs.next()) {
                JOptionPane.showMessageDialog(null, "Pub already exists!!");
            }
        else {
                JOptionPane.showMessageDialog(null, "Pub doesn't exists!!");
            }
        }
        catch (Exception e){
          JOptionPane.showMessageDialog( null, "There was a problem inserting into the database please try again ", "ERROR", JOptionPane.ERROR_MESSAGE);
        }

The same thing I press the check DB button on the jframe form the input box is displayed I enter the name the box disepears and thats it ??

Any help will be greatly appreciated

joseph.lyons.754

Im using java and my MySQL

joseph.lyons.754

Hey guys,

I was wondering if you could tell me if this is even possible or if it can be done another way???

So i have a database with 6 tables all the databases have the same columns except for the tables name ahead of the generic headers pub_name, Hotel_name, restaurant_Name etc.

Estentially i want to take all the values that meet the search criteria out of the 6 tables so if i want all the restaurants hotels and pubs that are in ennis can i do it??

Thanks