Web Hosting Talk







View Full Version : mysql help


Snitz
10-31-2008, 07:40 AM
mysql help

I have a set of mysql lines that fetches data from a table, here's the code.
PHP Code:



$sql = "select テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*t1.*,テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*t2.Name as estate_type,テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*t3.Name as estate_status,テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*t4.Name as estate_township,テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*t5.Name as estate_roomtype,テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*t6.Currency as estate_rent_currency,テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*t7.Images as estate_images,テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*t8.Name as estate_cityテつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*t9.Name as Locationテつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*from t_advert t1テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*inner join t_properties t2 on t2.PageType='EstateType'テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*inner join t_properties t3 on t3.PageType='EstateStatus'テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*inner join t_properties t4 on t4.PageType='TownShip'テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*inner join t_properties t5 on t5.PageType='RoomType'テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*inner join t_exchange t6 on t6.Currency=t1.RentCurrencyテつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*inner join t_advert_images t7 on t7.ParentID=t1.IDテつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*inner join t_properties t8 on t8.PageType='City'テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*inner join t_properties t9 on t9.PageType='Location'テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*where テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*t2.ItemIDテつ*テつ*テつ*= t1.EstateType and t2.PageLang='".$_SESSION['Lang']."' and テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*t3.ItemIDテつ*テつ*テつ*= t1.EstateStatus and t3.PageLang='".$_SESSION['Lang']."' and テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*t4.IDテつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*= t1.TownShipID andテつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*t5.ItemIDテつ*テつ*テつ*= t1.RoomType and t5.PageLang='".$_SESSION['Lang']."' and テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*t6.Currency = t1.RentCurrency and テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*t7.ParentID = t1.ID and t7.Seq = (select min(Seq) from t_advert_images where Visible='1' and ParentID=t1.ID group by Seq LIMIT 0,1) and テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*t8.IDテつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*= t1.CityID andテつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*t9.IDテつ*テつ*テつ*テつ*テつ*テつ*テつ*= t1.Location andテつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*t1.Visible='1' and t1.PrivateAdvert='1' order by t1.RentPrice ascテつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*";$qrPrivateAdvert = mysql_query($sql); while($rsPrivateAdvert = mysql_fetch_array($qrPrivateAdvert)) {




What I did was add the "t9.Name as Location" which is an existing field in the table and that method is working fine on other pages, I just don't know what I'm doing wrong in here. This code is not functioning at all, can anyone help me please.
Thanks,
George





__________________http://drugart.deviantart.com

webcertain
10-31-2008, 08:27 AM
Hi George,
if you output the result of mysql_error(); , that will help you see what the server is saying, and that should help you track it down a little. However i also notice that
Code:
t7.Images as estate_images,
t8.Name as estate_city
t9.Name as Location
should be this
Code:
t7.Images as estate_images,
t8.Name as estate_city,
t9.Name as Location
missing a comma





__________________
WebCertain - SEO, PPC, PR - The services you need to increase your site traffic. Specialists in over 35 languages and country-specific SEO! www.webcertain.com

carolinahosting
10-31-2008, 08:42 AM
Could Location be a reserved word? Have you tried `Location` instead of Location? Also, have you tried your query in phpmyadmin? Good place to validate if a query works.





__________________
Custom PHP Designhttp://www.customphpdesign.com
PHP * HTML * Javascript

Snitz
10-31-2008, 09:32 AM
Thanks webcertain, looks like I've been missing a comma hehe but that didn't solve the problem, still not working.
And yes the Location field is valid.





__________________http://drugart.deviantart.com






Last edited by Snitz : 10-31-2008 at 09:44 AM.

albunix
10-31-2008, 04:06 PM
Quote:



Originally Posted by Snitz


Thanks webcertain, looks like I've been missing a comma hehe but that didn't solve the problem, still not working.
And yes the Location field is valid.


How about you just dissect PHP from the actual query and just writ your query
from starting small and than progressing while having successive runs?
mysql -h yourhost.com -u your_username db_name < file.sql -p
will let you funnel your sql query to the server to see progressively if you're
erring somewhere.
Thanks.





__________________Erald T -- Client Service EngineerNavisite Dedicated Hostinghttp://dedicatedhosting.navisite.com24/7/365" Myth or Reality

Steve_Arm
10-31-2008, 04:17 PM
PHP Code:



$qrPrivateAdvert = mysql_query($sql);echo myslq_error();exit(); while($rsPrivateAdvert = mysql_fetch_array($qrPrivateAdvert)) {




what's the output?





__________________
PHP Code Repository | Worst Wide Web, now PR2