Jump to content

sniperscope

Members
  • Posts

    280
  • Joined

  • Last visited

Everything posted by sniperscope

  1. Hello I wonder why my query return value. It should be return 0 but it gives me 1 record with every value is null. Here is my query $today = mktime(0, 0, 0, date("n"), date("d"), date("Y")); SELECT s.register_date, s.shop_name, s.id, s.shop_type, s.shop_area, s.deli_area, s.shop_hour, s.shop_phone, g.staff_id, g.staffl_name, g.staff_recommend, c.course_course, n.news_icon, COUNT( n.news_id ) AS NewsNumber, COUNT( cp.coupon_id ) AS CouponNumber, COUNT( g.staff_id ) AS StaffNumber, COUNT( w.shukin_id ) AS ShukkinNumber FROM shop_master s LEFT JOIN course c ON s.id = c.shop_id LEFT JOIN staff_master g ON s.id = g.shop_id LEFT JOIN news_event n ON s.id = n.shop_id LEFT JOIN coupon cp ON s.id = cp.shop_id LEFT JOIN ( SELECT w.shop_id, w.shukin_id FROM shukkin_master w WHERE staff_date = '1334588400' GROUP BY staff_master_id )w ON s.id = w.shop_id WHERE s.shop_area LIKE '%osaka%' AND s.shop_type <> 'pizza' ORDER BY g.staff_recommend DESC , n.news_date DESC , s.register_date DESC This query MUST give me 0 record since there is no pizza shop. I really appreciate for any help.
  2. Then please do NOT spend time providing a solution. Thanks for interesting anyway.
  3. I want all person name regardless they are working or not.
  4. Hello I have a little problem with left join(yet again) I want to get all staff name and staff working time. My staff table is: | id | staff_name | +-----+----------------+ | 1 | Michael | | 2 | Jason | And schedule table is: | id | staff_id | start_time | end_time | days | +-----+-----------+--------------+--------------+-------+ | 1 | 1 | 14:00 | 15:00 | 1334070000 | 2 | 1 | 20:00 | 23:00 | 1334072000 | 3 | 2 | 20:00 | 23:00 | 1334075000 | 4 | 2 | 20:00 | 23:00 | 1334076000 | 5 | 2 | 20:00 | 23:00 | 1334077000 | 6 | 1 | 20:00 | 23:00 | 1334078000 | 7 | 2 | 20:00 | 23:00 | 1334078000 | 8 | 1 | 20:00 | 23:00 | 1334080000 | 9 | 1 | 20:00 | 23:00 | 1334080000 I am running this query but it return 0 SELECT g.staff_name, s.start_time, s.end_time FROM staff_master g LEFT JOIN schedule s ON g.id = s.staff_id WHERE s.days >= '1334070000' ORDER BY s.days ASC What am i trying is to get all staff names and their one week working schedule. If they are working (lets say) thursday then get his/her start and end time else just echo 00:00 Regards
  5. i solved it. I changed my code as below <script> var counter = 1; var limit = 200; function addInput(divName) { if (counter == limit) { alert("You have reached the limit of adding " + counter + " inputs"); } else { var newdiv = document.createElement('div'); newdiv.innerHTML = '<table class="table-1"><tr><th width="4%">' + (counter + 1) + '</th><td width="18%"><select name="product_' + (counter + 1) + '"><option value="item1">item1</option><option value="item2">item2</option><option value="item3">item3</option><option value="item4">item4</option></select></td><td width="16%"><select name="color_' + (counter + 1) + '"><option value="black">black</option><option value="red">red</option><option value="blue">blue</option><option value="green">green</option></select></td><td width="11%"><select name="p_size_' + (counter + 1) + '"><option value="L">L</option><option value="M">M</option></select></td><td width="10%">input type="text" name="order_number_' + (counter + 1) + '" size="7" onfocus="addInput(\'dynamicInput\');" onkeyup="Unit_update(\'order_number_' + (counter + 1) + '\', \'item_price_' + (counter + 1) + '\');" /></td><td width="40%" class="th"><input type="text" name="item_price_' + (counter + 1) + '" size="7" value="" readonly="readonly" /></td></tr></table>'; document.getElementById(divName).appendChild(newdiv); counter++; } } function Unit_update(unit_item, calc) { var i = document.forms['ContactForm'].elements[unit_item].value; document.forms['ContactForm'].elements[calc].value = i; } </script> Hope this help someone else.
  6. Hi Currently i have a small javascript problem which i could not handle it. I really appreciate for any help. My page has a form with dynamic added form fields(onclick adds new text box) and need calculate every single added text form value separately. I almost read about 20 blogs and web sites. But there is no hope so far. Regards My JS code: <script> var counter = 1; var limit = 200; function addInput(divName) { if (counter == limit) { alert("You have reached the limit of adding " + counter + " inputs"); } else { var newdiv = document.createElement('div'); newdiv.innerHTML = '<table class="table-1"><tr><th width="4%">' + (counter + 1) + '</th><td width="18%"><select name="product_' + (counter + 1) + '"><option value="item1">item1</option><option value="item2">item2</option><option value="item3">item3</option><option value="item4">item4</option></select></td><td width="16%"><select name="color_' + (counter + 1) + '"><option value="black">black</option><option value="red">red</option><option value="blue">blue</option><option value="green">green</option></select></td><td width="11%"><select name="p_size_' + (counter + 1) + '"><option value="L">L</option><option value="M">M</option></select></td><td width="10%"><input type="text" name="order_number_' + (counter + 1) + '" size="7" onfocus="addInput(\'dynamicInput\');" /></td><td width="40%" class="th"><input type="text" name="item_pirce_' + (counter + 1) + '" size="7" value="" readonly="readonly" /></td></tr></table>'; document.getElementById(divName).appendChild(newdiv); counter++; } } function Unit_update(unit_item) { // This works if i manually add element names. var i = document.forms['ContactForm'].elements["order_number_0"].value; document.forms['ContactForm'].elements["item_price_0"].value = i; } </script> And this is my form code: <table class="table-1"> <tr><th width="4%" class="th"></th> <th width="18%" class="th">P Name</th> <th width="16%" class="th">Color</th> <th width="11%" class="th">Size</th> <th width="10%" class="th">Order</th> <th width="41%" class="th">Total</th></tr></table> <div id="dynamicInput"> <table class="table-1"> <tr><th width="4%">1</th> <td width="18%"><select name="product_0"> <option value="item1">item2</option> <option value="item2">item2</option> <option value="item3">item3</option> <option value="item4">item4</option></select></td> <td width="16%"><select name="color_0"> <option value="black">black</option> <option value="red">red</option> <option value="blue">blue</option> <option value="green">green</option></select></td> <td width="11%"><select name="p_size_0"> <option value="L">L</option> <option value="M">M</option></select></td> <td width="10%"><input type="text" name="order_number_0" size="7" onfocus="addInput('dynamicInput');" onkeyup="Unit_update(this.form);" /></td> <td width="40%" class="th"><input type="text" name="item_price_0" size="7" value="" readonly="readonly" /></td></tr></table></div> <div style="width:100% !important; text-align:center; height:45px; background-color:#E0DFE3;"> <input type="reset" value="Reset" style="font-size:16px; width:100px; height:30px; font-weight:bold;" /> <input type="submit" value="Submit" style="font-size:16px; width:100px; height:30px; font-weight:bold;" /> </div><input type="hidden" name="SendIt" /> </form>
  7. Dear spiderwell My faq page is as below. <script> jQuery(document).ready(function(){ jQuery("#ContactForm").validationEngine(); }); function GetAnswer(value) { var str = $("#div").serialize(); var val = value; $.ajax({ type: "POST", url: "answer.php?id=" + val, data: str, success: function(data){ $('#ShowResult').html(data); } }); return false; } </script> <div class="faqQuestion"> <div class="faqList" onclick="GetAnswer(0);" id="div"><span class="faqSpan"><a href="#m1">question 1</a></span></div> <div class="faqList" onclick="GetAnswer(1);" id="div"><span class="faqSpan"><a href="#m1">question 2</a></span></div> <div class="faqList" onclick="GetAnswer(2);" id="div"><span class="faqSpan"><a href="#m1">question 3</a></span></div> <div class="faqList" onclick="GetAnswer(3);" id="div"><span class="faqSpan"><a href="#m1">question 4</a></span></div> <div class="faqList" onclick="GetAnswer(4);" id="div"><span class="faqSpan"><a href="#m1">question 5</a></span></div> <div class="faqList" onclick="GetAnswer(5);" id="div"><span class="faqSpan"><a href="#m1">question 6</a></span></div> <div class="faqList" onclick="GetAnswer(6);" id="div"><span class="faqSpan"><a href="#m1">question 7</a></span></div> </div> How can i merge your code into this? Because i am using id="div" for serialize onclick="GetAnswer(0);" 0,1,2,3,4,5,6 are index numbers of answer array in answer.php Interesting thing is when array has only numbers then ie display it but if it is a Japanese character then display and soon disappear. <?php mb_language("Ja"); mb_internal_encoding("utf-8"); if(!isset($_GET['id'])) exit(); $q = $_GET['id']; $questions = array("月額での支払いは可能ですか?", "いつから使えるようになりますか。", "支払い方法はどのようになっていますか?", "サーバーのみお申し込み可能ですか?", "他サーバーから乗り換えたいのですがどうすればいいですか?", "5", "6", "サポート電話はありますか?", "電話以外にサポートしますか?", "ホームページ中止ありますか?", "Cronは使用できますか?", "海外からのアクセスに制限はありますか?", "12", "13", "アダルトサイトの利用はできますか?", "コンテンツに関して制限はありますか?", "出会い系サイトの運営はできますか?", "動画、音楽ファイルの使用はできますか?", "サーバ設置場所とバックボーンは?", "19", "20", "21", "22", "23", "24", "25", "26", "27", "FTPに接続ができません。", "HPのファイルはどのディレクトリに置けばいいの?", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41"); $answers = array("共用プラン1年契約のみとなっております。しかし、VPS又は専用プランで月払い可能です。", "お申し込みプランによって異なります。詳細は下記に書いています。<br /><br />共用プラン:すぐ使えます。<br />VPSプラン:12時間以内。<br />専用プラン:48時間以内", "支払い方法は、弊社指定の銀行口座へのお振り込み、クレジットカード決済のいずれかとなります。<br /><br /> ※ <strong>銀行振り込みの場合</strong><br />振込手数料は、お客様負担とさせていいただいております。<br /><br /> ※<strong>クレジットカード決済の場合</strong> ご利用可能なクレジットカードは、VISA / Master / JCB / AMEX です。<br />弊社ではカード番号を保持しないため、自動引落しではございませんので契約更新のたびにお支払い手続きが必要となります。", "サーバーのみお申し込み可能です。", "他サーバーから乗り換えたい場合お客様のホームページ無料でトランスファー【フォルダー、ファイル、データベース、メールアカウントなど】します。", "5", "6", "7", "8", "9", "10", "海外の一部の ISP(インターネットサービスプロバイダー)から弊社サーバへ不正アクセスが多発しているため、セキュリティ対策としてアクセス制限を実施しております。<br><br> 日本国外から弊社サーバーへアクセスした場合、アクセスできない可能性がございます。ご都合が悪い場合には、お客様センター までご連絡ください。個別にアクセス制限の調整をさせていただきます。", "12", "13", "14", "15", "16", "17", "サーバは国内に設置されており、耐震、耐火構造の堅牢な建物に24時間有人監視、入室に際するセキュリティーチェック等、万全の体制を整えております。<br><br> また、バックボーンも 国内最大級の173Gbpsに接続されております。<br>サーバーからバックボーンへの接続は200Mbpsとなります。", "19", "20", "21", "22", "23", "24", "25", "26", "27", "<p>FTPソフトの<strong>PASVモード</strong>(パッシブモード)をON又はOFFどちらかに変える。<br> 1) ファイアウォールを解除して接続してみる。<br> 2) 10分ほどしてから接続する。<br> 3) IDや、パスワードが間違っていませんか?<br>   a) コピーアンドペーストで貼り付けて下さい。<br>   b) パスワード部分への貼り付けは[ctrl]+[v]で可能ですので、お試し下さい。<br><br><br> </p> <p><strong>FFFTP</strong>でファイル一覧の取得ができない。<br> 1) [ホストの設定] - [高度タブ] へすすみ、<br> 2) [listコマンドでファイル一覧を取得]にチェックを入れる。<br> 3) 接続して、右クリックメニューの[最新の情報に更新] で表示されます。<br><br><br> </p> <p>以上を試しても接続できない場合。<br><a href=\"../contact/\" title=\"お問い合せページ\">お問い合せページ</a>よりお名前とドメイン名をお知らせ下さい。</p>", "public_html の中にアップロードして下さい。", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41"); echo '<div class="faqtitle"><span class="faqtitlespan">' .$questions[$q]. '</span></div><div class="faqanswer">' .$answers[$q]. '</div>'; ?>
  8. Some how this moron browser works in localhost but not in live server.
  9. So just tested that page in the most stupid browser ever built (Internet Explorer) Ajax return nothing. Actually it display answer about 0.5 second and return to blank. Does someone has any idea except forcing people stop using stupid browser?
  10. Okay. I solved problem (by myself ;D ) I am posting solution below. Hope this help someone else. index.php: <script> jQuery(document).ready(function(){ jQuery("#ContactForm").validationEngine(); }); function GetAnswer(value) { var str = $("#div").serialize(); var val = value; $.ajax({ type: "POST", url: "answer.php?id=" + val, data: str, success: function(data){ $('#ShowResult').html(data); } }); return false; } </script> <body> <div class="faqList" onclick="GetAnswer(555444);" id="div"><span class="faqSpan"><a href="#m1">this is FAQ question. </a></span></div> <br /><br /> <!-- Answer Display --> <div id="m1" name="m1"><div id="ShowResult"></div></div> </body> And this is answer.php : <?php //if(!isset($_GET['q'])) //exit(); $id = $_GET['q']; $questions = array("q1", "q2", "q3", "q4"); $answers = array("a1", "a2", "a3", "a4"); $return = ' <div class="faqtitle"><span class="faqtitlespan">' .$questions[$id]. '</span></div> <div class="faqanswer">$answers[$id]</a></div>'; echo $return; ?> [/code]
  11. Hi. How can i pass div id? if it is not in a form? My ajax code is : <script> jQuery(document).ready(function(){ jQuery("#ContactForm").validationEngine(); }); function GetAnswer() { var str = $("form").serialize(); $.ajax({ type: "POST", url: "answer.php", data: str, success: function(data){ $('#ShowResult').html(data); } }); return false; } </script> <body> <div class="faqList" onclick="GetAnswer();" id="1"><span class="faqSpan"><a href="#m1">this is FAQ question. </a></span></div> <br /><br /> <!-- Answer Display --> <div id="m1" name="m1"><div id="ShowResult"></div></div> </body> And this is answer.php : <?php //if(!isset($_POST['q'])) //exit(); $id = $_POST['q']; $questions = array("q1", "q2", "q3", "q4"); $answers = array("a1", "a2", "a3", "a4"); $return = ' <div class="faqtitle"><span class="faqtitlespan">' .$questions[$id]. '</span></div> <div class="faqanswer">$answers[$id]</a></div>'; echo $return; ?> What i get is Notice: Undefined index: id in C:\apache\htdocs\support\answer.php on line 4 Thanks for any advice.
  12. Dear kickstart Thanks for help and sorry for late reply. I just tested your query. It is marvelous. You cannot imagine how i appreciate. You saved my at least 3 days. Thank you soooooooo much.
  13. Dear kickstart Here is dump of shops table: DROP TABLE IF EXISTS `shops`; CREATE TABLE IF NOT EXISTS `shops` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `shop_name` varchar(250) NOT NULL, `shop_mail` varchar(100) NOT NULL, `shop_region` varchar(20) DEFAULT NULL, `shop_state` varchar(20) DEFAULT NULL, `shop_area` varchar(50) DEFAULT NULL, `shop_address_long` text, `chamber` varchar(200) DEFAULT NULL, `chamber_id` varchar(200) DEFAULT NULL, `publication` enum('yes','no') NOT NULL, `payment_plan` tinyint(1) NOT NULL COMMENT '1 = Gold, 2 = Silver, 3 = Basic', `register_date` varchar(5) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `shop_name` (`shop_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Shops data stored' AUTO_INCREMENT=33 ; -- -- Dumping data for table `shops` -- INSERT INTO `shops` (`id`, `shop_name`, `shop_mail`, `shop_region`, `shop_state`, `shop_area`, `shop_address_long`, `chamber`, `chamber_id`, `publication`, `payment_plan`, `register_date`) VALUES (1, 'shop_a', 'something@examle.com', 'kansai', 'osaka', 'nipponbashi', 'osaka city', 'osaka chamber of commerce', '21074', 'yes', 3, '12/20'), (2, 'shop_b', 'something@examle.com', 'kansai', 'osaka', 'umeda', 'osaka city', 'osaka chamber of commerce', '11395', 'yes', 2, '12/20'), (3, 'shop_c', 'something@examle.com', 'kansai', 'osaka', 'kyobashi', 'osaka city', 'osaka chamber of commerce', '14656', 'yes', 1, '12/20'), (4, 'shop_d', 'something@examle.com', 'kansai', 'osaka', 'tsukamoto', 'osaka city', 'osaka chamber of commerce', '45742', 'yes', 3, '12/20'), (5, 'shop_e', 'something@examle.com', 'kansai', 'osaka', 'nipponbashi', 'osaka city', 'osaka chamber of commerce', '19292', 'yes', 2, '12/20'), (6, 'shop_f', 'something@examle.com', 'kansai', 'osaka', 'umeda', 'osaka city', 'osaka chamber of commerce', '11902', 'yes', 3, '12/20'), (7, 'shop_g', 'something@examle.com', 'kansai', 'osaka', 'tani9', 'osaka city', 'osaka chamber of commerce', '29796', 'yes', 2, '12/20'), (8, 'shop_h', 'something@examle.com', 'kansai', 'osaka', 'nipponbashi', 'osaka city', 'osaka chamber of commerce', '19311', 'yes', 1, '12/20'), (9, 'shop_i', 'something@examle.com', 'kansai', 'osaka', 'kyoto', 'osaka city', 'osaka chamber of commerce', '2-7-1-307', 'yes', 2, '12/20'), (10, 'shop_j', 'something@examle.com', 'kansai', 'osaka', 'kyoto', 'osaka city', 'osaka chamber of commerce', '73358', 'yes', 3, '12/20'), (11, 'shop_k', 'something@examle.com', 'kansai', 'osaka', 'nipponbashi', 'osaka city', 'osaka chamber of commerce', '20449', 'yes', 3, '12/20'), (12, 'shop_l', 'something@examle.com', 'kansai', 'osaka', 'kyoto', 'osaka city', 'osaka chamber of commerce', '2-7-1-59', 'yes', 2, '12/20'), (13, 'shop_m', 'something@examle.com', 'kansai', 'osaka', 'kyoto', 'osaka city', 'osaka chamber of commerce', '2-7-1-59', 'yes', 1, '12/20'), (14, 'shop_n', 'something@examle.com', 'kansai', 'osaka', 'kobe', 'osaka city', 'osaka chamber of commerce', '18-17', 'yes', 1, '12/20'), (15, 'shop_o', 'something@examle.com', 'kansai', 'osaka', 'kobe', 'osaka city', 'osaka chamber of commerce', '18-16', 'yes', 2, '12/20'), (16, 'shop_p', 'something@examle.com', 'kansai', 'osaka', 'kobe', 'osaka city', 'osaka chamber of commerce', '18-18', 'yes', 2, '12/20'), (17, 'shop_q', 'something@examle.com', 'kansai', 'osaka', 'tennoji', 'osaka city', 'osaka chamber of commerce', '18-54', 'yes', 3, '12/20'), (18, 'shop_r', 'something@examle.com', 'kansai', 'osaka', 'tennoji', 'osaka city', 'osaka chamber of commerce', '18-62', 'yes', 3, '12/20'), (19, 'shop_s', 'something@examle.com', 'kansai', 'osaka', 'tennoji', 'osaka city', 'osaka chamber of commerce', '18-48', 'yes', 3, '12/20'), (20, 'shop_t', 'something@examle.com', 'kansai', 'osaka', 'umeda', 'osaka city', 'osaka chamber of commerce', '11814', 'yes', 3, '12/20'), (21, 'shop_u', 'something@examle.com', 'kansai', 'osaka', 'tsukamoto', 'osaka city', 'osaka chamber of commerce', '45240', 'yes', 2 '12/20'), (22, 'shop_y', 'something@examle.com', 'kansai', 'osaka', 'umeda', 'osaka city', 'osaka chamber of commerce', '12202', 'yes', 1, '12/20'), (23, 'shop_z', 'something@examle.com', 'kansai', 'osaka', 'nipponbashi', 'osaka city', 'osaka chamber of commerce', '20625', 'yes', 2, '12/20'); And search_up table: CREATE TABLE IF NOT EXISTS `search_up` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `shop_id` int(6) NOT NULL, `add_date` int(10) NOT NULL, `add_time` int(10) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=208 ; -- -- Dumping data for table `search_up` -- INSERT INTO `search_up` (`id`, `shop_id`, `add_date`, `add_time`) VALUES (1, 22, 1324825200, 943933200), (2, 23, 1324825200, 943940760), (17, 1, 1325084400, 943901640), (18, 2, 1325084400, 943902240), (19, 1, 1325084400, 943902780), (20, 3, 1325084400, 943902840), (21, 3, 1325084400, 943902840), (22, 4, 1325084400, 943903500), (23, 5, 1325084400, 943904040), (24, 6, 1325084400, 943904520), (25, 7, 1325084400, 943904760), (26, 8, 1325084400, 943905060), (27, 9, 1325084400, 943905360), (28, 10, 1325084400, 943905840), (29, 11, 1325084400, 943906140), (30, 12, 1325084400, 943907160), (31, 13, 1325084400, 943915140), (33, 17, 1325084400, 943917120), (34, 18, 1325084400, 943917720), (35, 19, 1325084400, 943918260), (36, 20, 1325084400, 943918980), (59, 9, 1325170800, 943948560), (60, 13, 1325170800, 943949160), (61, 23, 1325257200, 943896180), (62, 23, 1325257200, 943896180), (63, 23, 1325257200, 943899540), (64, 4, 1325257200, 943955280), (65, 6, 1325257200, 943955460), (68, 1, 1325257200, 943955880), (77, 19, 1325602800, 943956180), (80, 4, 1325602800, 943956360), (81, 7, 1325602800, 943956420), (94, 12, 1325689200, 943965600), (96, 4, 1325775600, 943942620), (97, 12, 1325775600, 943942680), (102, 17, 1325775600, 943948080), (103, 1, 1325775600, 943951680), (106, 10, 1325775600, 943960200), (107, 2, 1325775600, 943960320), (112, 7, 1325775600, 943972560), (113, 9, 1325775600, 943972620), (114, 5, 1325775600, 943972620), (121, 12, 1326034800, 943969320), (125, 22, 1326121200, 943928280), (128, 5, 1326121200, 943949580), (129, 19, 1326121200, 943949640), (130, 7, 1326121200, 943949700), (133, 21, 1326207600, 943931220), (134, 22, 1326207600, 943933500), (135, 20, 1326207600, 943933620), (139, 20, 1326207600, 943952520), (160, 5, 1326294000, 943924980), (161, 19, 1326294000, 943925040), (164, 6, 1326294000, 943925280), (196, 17, 1326294000, 943950780);
  14. Okay Give me a few minutes and i dump some sample data. About duplicating records. How about add " GROUP BY shop_id " into query. Then it will group by shop_id right?
  15. Dear Kickstart I really appreciate for your query. That query block bring one record(from shops table) and show it 107 times(in my case search_up table has 107 records). I am going to one more thing but not sure about performance. Also personally i hate doing tasks Easy/Lazy way. What am i thinking is search_up table holds only date and time and i need only latest records for each shops. So, create new two columns in shops table and give them "add_date" and "add_time" and sort it by ORDER BY payment_plan ASC, add_date ASC, add_time ASC Don't you think this works(actually i tested it and it works) and it is lazy way?
  16. Hi What is actual output is sorting by ID as below. Date and Time seems ignoring. ----+---------------+-----------------------+----------------+--------------+ ID | SHOP NAME | PAYMENT_PLAN | ADD_DATE | ADD_TIME | ----+---------------+-----------------------+----------------+--------------+ 11 | shop_a | gold | 2012-01-12 | 11:20 | 14 | shop_l | gold | 2012-01-09 | 13:25 | 19 | shop_f | gold | 2012-01-12 | 11:00 | 23 | shop_m | gold | 2012-01-11 | 23:30 | 51 | shop_d | gold | 2012-01-10 | 16:08 | ----+---------------+-----------------------+----------------+-------------+ 5 | shop_y | silver | 2012-01-12 | 11:21 | 9 | shop_x | silver | 2012-01-12 | 08:51 | 21 | shop_z | silver | 2012-01-11 | 15:20 | 59 | shop_h | silver | 2012-01-03 | 11:15 | 73 | shop_p | silver | 2012-01-10 | 22:31 | ----+---------------+-----------------------+----------------+-------------+ 38 | shop_i | basic | 2012-01-12 | 10:43 | 41 | shop_l | basic | 2012-01-12 | 11:19 |
  17. Hi I am doing something but i am stuck and i need some help. I have 2 tables one is holding shop information, other one is holding upgrade information. shops: CREATE TABLE shops ( id int(10) unsigned NOT NULL AUTO_INCREMENT, shop_name varchar(250) NOT NULL, shop_type varchar(50) NOT NULL, work_hour varchar(15) DEFAULT '00:00~00:00', shop_phone varchar(30) DEFAULT NULL, shop_mail varchar(100) NOT NULL, shop_address_long text qualification varchar(200) DEFAULT '--', shop_url_pc varchar(200) DEFAULT NULL, shop_url_mobile varchar(200) DEFAULT NULL, publication enum('yes','no') NOT NULL, payment_plan tinyint(1) NOT NULL, shop_login_id varchar(30) NOT NULL, shop_login_pass varchar( NOT NULL, register_date varchar(5) NOT NULL, PRIMARY KEY (id), UNIQUE KEY shop_name (shop_name), UNIQUE KEY shop_login_id (shop_login_id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Shops data stored'; search_up: CREATE TABLE search_up ( id int(10) unsigned NOT NULL AUTO_INCREMENT, shop_id int(6) NOT NULL, add_date int(10) NOT NULL, add_time int(10) NOT NULL, PRIMARY KEY (id) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; I want to get output something like: ----+---------------+-----------------------+----------------+--------------+ ID | SHOP NAME | PAYMENT_PLAN | ADD_DATE | ADD_TIME | ----+---------------+-----------------------+----------------+--------------+ 11 | shop_a | gold | 2012-01-12 | 11:20 | 19 | shop_f | gold | 2012-01-12 | 11:00 | 23 | shop_m | gold | 2012-01-11 | 23:30 | 51 | shop_d | gold | 2012-01-10 | 16:08 | 14 | shop_l | gold | 2012-01-09 | 13:25 | ----+---------------+-----------------------+----------------+-------------+ 5 | shop_y | silver | 2012-01-12 | 11:21 | 9 | shop_x | silver | 2012-01-12 | 08:51 | 21 | shop_z | silver | 2012-01-11 | 15:20 | 73 | shop_p | silver | 2012-01-10 | 22:31 | 59 | shop_h | silver | 2012-01-03 | 11:15 | ----+---------------+-----------------------+----------------+-------------+ 41 | shop_l | basic | 2012-01-12 | 11:19 | 38 | shop_i | basic | 2012-01-12 | 10:43 | i am using mysql command below but it sorts only based on plans SELECT s.id, s.shop_name, s.payment_plan, ss.add_date, ss.add_time FROM shops s LEFT JOIN ( SELECT ss.shop_id, MAX(add_date) AS add_date, MAX(add_time) AS add_time FROM search_up ss GROUP BY shop_id ) ss ON s.id = ss.shop_id WHERE s.shop_region = 'kansai' AND s.publication = 'yes' ORDER BY s.payment_plan ASC, ss.add_date DESC, ss.add_time DESC Could someone please show me what am i doing wrong ? Regards
  18. Dear abareplace Yes, i want third div with id="power-push2" @scootstah Yes, data is dynamic. All div tags, p tags or any tags store in db. In db has table which has url, start_tag and end_tag columns. Get the site (cURL) from $row['url'], pars it and get data between start_tag and end_tag. This is sort of a BOT. Dear Playful Thanks for pattern. It works well. Thanks again. Have a great day everyone who tried to help me out.
  19. Dear scootstah and playful Thanks for your help. I really appreciated. I want to ask last thing. What if a web page has multiple div tags with same class/id name? Let's say there is 5 div tag whish has same id <div id="power-push2"><a href="../?id=11" class="imghover"><img src="../1.jpg" alt="abc" width="160" height="213" /></a><p><span class="p-w15">username</span></p></div> <div id="power-push2"><a href="../?id=22" class="imghover"><img src="../1.jpg" alt="abc" width="160" height="213" /></a><p><span class="p-w15">username</span></p></div> <div id="power-push2"><a href="../?id=33" class="imghover"><img src="../1.jpg" alt="abc" width="160" height="213" /></a><p><span class="p-w15">username</span></p></div> <div id="power-push2"><a href="../?id=44" class="imghover"><img src="../1.jpg" alt="abc" width="160" height="213" /></a><p><span class="p-w15">username</span></p></div> <div id="power-push2"><a href="../?id=55" class="imghover"><img src="../1.jpg" alt="abc" width="160" height="213" /></a><p><span class="p-w15">username</span></p></div> How can i get <div id="power-push2"><a href="../?id=33" class="imghover"><img src="../1.jpg" alt="abc" width="160" height="213" /></a><p><span class="p-w15">username</span></p></div> only?
  20. How can i get everything inside of certain tag with certain id/class name Source code is: <div id="power-push2"><a href="../?id=12" class="imghover"><img src="../1.jpg" alt="abc" width="160" height="213" /></a><p><span class="p-w15">username</span></p></div> Needed part: <a href="../?id=12" class="imghover"><img src="../1.jpg" alt="abc" width="160" height="213" /></a><p><span class="p-w15">username</span></p>
  21. Dear Thorpe After editing my own post and while waiting reply. I tried to solve by myself. i solved but i was unable to edit/delete my own post. So, namely problem solved.
  22. Dear awjudd Thanks for your code. It was worked. But, i would like to ask that what if i want to sort it by two columns. I changed your query as below but it fails. Here is what i changed. PS: I took your advice and used column name in query "SELECT s.id, s.copy, s.name, s.type, s.address_short, s.access, s.salary, s.qualification, s.staff_only, s.opstions, s.picture, s.main_txt, , ss.add_time, ss.add_date FROM shops s LEFT JOIN ( SELECT ss.shop_id, MAX(add_time), AS add_time MAX(add_date) AS add_date FROM search_up ss GROUP BY shop_id ) ss ON s.id = ss.shop_id WHERE s.shop_region = 'kansai' AND s.publication = 'dsp' AND (s.shop_area = 'osaka')"
  23. Thanks for information. You wrote "first by the add_date then by the add_time." Also i mention this in my first post. But there is a problem such as, ID | Add Date | Add Time ---+-------------------+------------ 1 | 2011/12/12 | 12:50 2 | 2011/12/12 | 14:38 3 | 2011/12/11 | 13:00 4 | 2011/12/10 | 10:53 in my logic entry #4 will be output as first record. Don't you think?
  24. usort requires user-defined comparison function. The problem starts right here. Because i don't have any function. (previously i used, usort($arr); ) As matter of fact, i have no idea logic of comparison function.
  25. If you are asking created function? then asnwer will be No. I did not do/write any codes besides using standard sorting function of php. I will be glad if you guide me and/or give me a logical idea. I can do rest...
×
×
  • 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.