Jump to content

$mok3

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

$mok3's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIKE '%Greg%'or names_last LIKE '%Greg%'' at line 1 i dont understand y it not work any1 can help? <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Results</title> </head> <body bgcolor="#000000" text="#FFFFFF"> <?php if(!$_POST['submit']) { echo 'Please go back and enter a search query'; exit; } else { $search = $_POST['submit']; } //connecting to the database require 'config.php'; @$dbconn = mysql_connect ($hostname, $mysql_login, $mysql_password); If (!$dbconn){ echo ' PHP could not connect to the database' . mysql_error(); exit; } else { echo ' A successesful connection was established'; } //Successful connection starts search mysql_select_db(dbpease12, $dbconn); $query = "SELECT * fROM Names". "where names_first LIKE '%".$search."%'". "or names_last LIKE '%".$search."%'"; $result = mysql_query($query) or die(mysql_error()); ?> <table width="534" border="1" cellpadding="10"> <tr> <td width="78">ID</td> <td width="148">First Name </td> <td width="115">Last Name </td> </tr> <?php while ($row = mysql_fetch_assoc($query))?> <?php { ?> <tr> <td><?php echo $row['names_id']; ?> </td> <td><?php echo $row['names_first']; ?></td> <td><?php echo $row['names_last']; ?></td> </tr> <?php } ?> </table> <?php //Closes connection mysql_close($dbconn); ?> </body> </html>
×
×
  • 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.