Jump to content

Not THAT urgent, offer your free help at any time you wish


sabo86

Recommended Posts

You're breaking out of the query incorrectly.

 

$query = "select * from items where Category = '.$_POST['searchtype'].'";

 

See how you open the string with " but then when you get the the = you break out using '.

 

Try this:

 

$query = "select * from items where Category = ".$_POST['searchtype']."";

Link to comment
Share on other sites

Thanks for that..

I am trying to re structure my code because i am not getting results..

what's the problem in this code:

 

if($_POST['searchtype']="Accessories")

  {$field="Accessories";}

  else if ($_POST['searchtype']="Seatings")

  {$field="Seatings";}

  else if ($_POST['searchtype']="Local Office Furniture")

  {$field="Local Office Furniture";}

    else if ($_POST['searchtype']="European Office Furniture")

  {$field="European Office Furniture";}

 

$query = "select * from items where Category = $field;

 

The error i am getting is :

Parse error: parse error, unexpected '>' in C:\Program Files\EasyPHP 2.0b1\www\test fleifel\results.php on line 55

 

and line 55 is : echo "<p>Number of records found: ".$num_results."</p>";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.