Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sami
Starting Member
2 Posts |
Posted - 2006-02-07 : 03:58:13
|
| hi. i am new to SQL and i have a bit of problems in retrieving the data from the database. i built a website called Betahosts.com and i a friend of mine did the database design and the "search" thing since im not familiar with PHP and SQL. he did some examples in the database aswell but wen i'm doing a search nothing is coming up. the table were the examples are is called 'products'. i this table there are several columns including "dspace" "stype" & "price" which are the categories of my search option . i opened the php file and tried to examine the code and i found the string that it fetches the data from the database . "SELECT * from products where $pr $ds $st LIMIT $limit,$nop". i then tried to run this string in the database itself and it gave me an error. so i tried a simple query. SELECT * from products where price = 88 and it gave me a result.wat can be causing this. this following is a part of the code in the search.phpif($price==1){$pr="price<'25'";}elseif($price==2){$pr="price<'100' and price>'24'";}elseif($price==3){$pr="price>'100'";}else{$pr="";}if($dspace==1){$ds="and dspace<'50'";}elseif($dspace==2){$ds="and dspace<'250' and dspace>'50'";}elseif($dspace==3){$ds="and dspace>'250'";}else{$st="";}if($stype==1){$st="and stype<'25'";}elseif($stype==2){$st="and stype<'100' and stype>'24'";}elseif($stype==3){$st="and stype>'100'";}else{$st="";} $Link = db_connect(); $q="SELECT * from products where $pr $ds $st LIMIT $limit,$nop";$Result = mysql_query ("$q"); ?>any help would be really apriciated |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-02-07 : 08:33:25
|
| >>SELECT * from products where $pr $ds $st LIMIT $limit,$nop";Are you using MySQL or PostGreS?This is SQL Server ForumMadhivananFailing to plan is Planning to fail |
 |
|
|
sami
Starting Member
2 Posts |
Posted - 2006-02-08 : 04:35:48
|
| im using mysql. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-02-08 : 04:37:13
|
quote: Originally posted by madhivananThis is SQL Server Forum
Microsoft SQL Server Forum----------------------------------'KH' |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-02-08 : 05:21:26
|
Well. by default, SQL Server is for Microsoft MadhivananFailing to plan is Planning to fail |
 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2006-02-08 : 05:34:57
|
| What was the dspace and stype of the results you got for your query? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-02-08 : 06:35:30
|
quote: Originally posted by sami im using mysql.
Post at mySQL forum of www.DBForums.comMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|