Jump to content

alco19357

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Everything posted by alco19357

  1. what you see in the picture is the whole table lol. its currently in test mode. what is the number of rows needed before you start getting accurate results
  2. I have attached an image, please view it as it shows the visuals. Basically, I have a search form that goes to a page which executes the commands. I'm using mysql full text search in php and have set up the database with indexes (see jpeg for the visuals, it's more clear than me explaining) When someone enters a keyword in the keyword field, marked by the name: $_POST[keywords] and enters a city,state or zip and proximity, it calculates all the zipcodes in the proximity of the requested and forces them into an array. It then posts the keywords and array of zipcodes to a function. The function and its content is listed below: <?php function search_results($search_terms='', $city_state_zip=array()) { $zipcode_arr = $city_state_zip; $wherelocation = '('; $number = 0; foreach($zipcode_arr as $zc_k => $zc_v){ if($number > 0) $wherelocation .= ' || '; $wherelocation .= "zip='".mysql_real_escape_string($zc_k)."'"; $number++; } $wherelocation .= ')'; $row2=0; $db = new mysql_database; $replace = array('', '', '', ''); $search = array(',', ' ,', ', ', ' , '); $result = $db->select("SELECT *, MATCH (contact_name, business_name, phone_number) AGAINST ('".mysql_real_escape_string(str_replace($search, $replace, $search_terms))."') AS resultsInTurn FROM " . TABLE_CONTRACTOR_DETAILS . " WHERE MATCH (contact_name, business_name, phone_number) AGAINST('".mysql_real_escape_string(str_replace($search, $replace, $search_terms))."') ORDER BY resultsInTurn DESC"); if($db->num_rows($result) > 0){ # results from deep search?> <tr><td height="20"></td></tr> <tr><td><hr />1 listing<hr /></td></tr> <tr><td height="20"></td></tr> <? }else{ #no results } print_r($wherelocation); echo '<br>search term: ' . mysql_real_escape_string(str_replace($search, $replace, $search_terms)); } The problem: When i search something that's listed once (like joe smith2, joe smith1, or joe smith3), it returns 1 row, like it would be expected to do. when i search company2 (notice in the db in the picture you see 3 rows with company2, it doesn't return anything... you'd think it'd return 3 rows (what's the matter here!!!?? please help i'm puzzled) anyone who can help will be my hero Thank you, alex [attachment deleted by admin]
  3. is it at all possible to do like: $smarty->assign('asdf', "{include file='smarty/source/templates/header.tpl'}"); or $smarty->assign('header', include("smarty/source/templates/header.tpl")); I need this for a site that will have different possibilities on creating templates on the fly. It can have up to 3 columns which are dynamic (one for steps, one for form, one for shopping cart contents).. its a shopping cart obviously. I need to use assign because I cannot hardcode it into the tpl like {include ...}. it needs to look like this in tpl...: {$header} and that will dynamically include/require the header.tpl file. thank you for your help in advance! Alex
  4. again... my title was misleading. i'm sorry. it's not just a hosting company. it's a design, programming, hosting, marketing, logo, etc company. sorry!
  5. you're right. but i guess the title was misleading. it's actually not just hosting. its: web design, programming, hosting, seo/marketing, logo design, etc. so my bad. other than that... do you have any suggestions?? my bad again! thank you!
  6. let me know what you think of the design for this site. please add any suggestions, comments, concerns! thank you!! http://nyoc.net/mock1.jpg
  7. also, i'm using firefox with the Microsoft Windows Media Player Firefox Plugin enabled. When i disable the plugin, and try, it does downloads the wmv to my local and it works from there. Does anyone know if there are settings i have to change in the plugin or is there another plugin for vista out there? Thank you! Alex
  8. I have a system that reads a file (.dat) and will render it as an wmv. Code below: function download($VAR) { $db = &DB(); $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'file WHERE site_id = ' . DEFAULT_SITE . ' AND id = ' . $db->qstr(@$VAR['id']) . ' AND status = 1'; $result = $db->Execute($sql); if($result->RecordCount() == 1) { $show = true; ### Validate start date $s = $result->fields['date_start']; if($s != '' && $s != 0) if($s > time()) $show = false; ### Validate expire date $e = $result->fields['date_expire']; if($e != '' && $e != 0) if($e < time()) $show = false; ### Validate user group: if($show) { global $C_auth; @$arr = unserialize($result->fields['group_avail']); $show = false; for($i=0; $i<count($arr); $i++) { if($C_auth->auth_group_by_id($arr[$i])) { $show = true; break; } } } ### Get the filetype if($show) { $ft = $result->fields['location_type']; if($ft == 0) $file = PATH_FILES . 'file_'.$VAR['id'].'.dat'; elseif ($ft == 1) $file = $result->fields['location']; elseif ($ft == 2) $file = $result->fields['location']; ### Open the file if (@$file=fopen($file, 'r')) { ### Display the correct headers: header ("Content-Type: " . $result->fields['type']); header ("Content-Size: " . $result->fields['size']); header ("Content-Disposition: inline; filename=mylbpr.wmv"); header ("Content-Length: " . $result->fields['size']); fpassthru($file); exit; } } } echo 'Sorry, the file does not exist or you are not authorized or your access has expired!'; } When I play the page in Internet Explorer, it works with both attachment and inline as my disposition. However, in Firefox, it only works when the disposition is attachment. I can't get the file to play inline, nor can I get the file to play as an embed. Please help. Thank you!! Alex this is from the Agile Billing software
  9. before: move_uploaded_file('... chmod image directory to 777 chmod("images/", 0777); and after move_uploaded_file('... chmod image directory back to original permissions ie: chmod("images/", 0644);
  10. You may be right on that, however, when you're crunched for time (a week), the simplest option works the best Thanks for the help though!!! Alex
  11. Hi there, I have a software/application developed by Agile. I have modified the script for the file page so that it will not only "download" or buffer, but play the WMV file in a page called by the function "playinwindow". The website has been protected and the domain name has been stripped. Code is below. My problem is this: when I launch the page: index.php?_page=file:playinwindow&id=8, it should execute the playinwindow function, which will execute the "download" function, since the src for the wmv file is: index.php?_page=file:download&id=8 (escape will change nothing). This "server-side buffering" of the file (whose original content is protected in a .dat file) works without problem on IE. However, it won't play anything in Firefox. Please help!! Thanks, Alex. Code below: ############################## ## PLAY UPDATE ## ############################## function playinwindow($VAR) { $db = &DB(); $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'file WHERE site_id = ' . DEFAULT_SITE . ' AND id = ' . $db->qstr(@$VAR['id']) . ' AND status = 1'; $result = $db->Execute($sql); if($result->RecordCount() == 1) { $show = true; ### Validate start date $s = $result->fields['date_start']; if($s != '' && $s != 0) if($s > time()) $show = false; ### Validate expire date $e = $result->fields['date_expire']; if($e != '' && $e != 0) if($e < time()) $show = false; ### Validate user group: if($show) { global $C_auth; @$arr = unserialize($result->fields['group_avail']); $show = false; for($i=0; $i<count($arr); $i++) { if($C_auth->auth_group_by_id($arr[$i])) { $show = true; break; } } } ### Get the filetype if($show) { $ft = $result->fields['location_type']; if($ft == 0) $file = PATH_FILES . 'file_'.$VAR['id'].'.dat'; elseif ($ft == 1) $file = $result->fields['location']; elseif ($ft == 2) $file = $result->fields['location']; ### Open the file if (@$file=fopen($file, 'r')) { ### Play the file in Windows Media Player: echo '<center>'; echo '<table width="500" border="0" cellpadding="0" cellspacing="0">'; echo '<tr><td align="left"><a href="?_page=file:file">Back</a></td></tr><tr><td height="10"></td></tr>'; echo '<tr><td align="left"><strong>'.$result->fields['name'].'</strong></td></tr>'; echo '<tr><td align="left">'.$result->fields['description'].'</td></tr>'; echo '<tr><td height="10"></td></tr>'; echo '<tr><td align="left">'; echo '<OBJECT id=\'mediaPlayer\' width="500" height="450" classid=\'CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\' codebase=\'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112\' standby=\'Loading Microsoft Windows Media Player components...\' type=\'application/x-oleobject\'>'; //echo '<param name=\'fileName\' value="'.$result->fields['name'].'">'; // src="'.$result->fields['name'].'" echo '<param name=\'fileName\' value="http://SITEPROTECTED.com/?_page=file:download&_escape=1&id=12">'; echo '<param name=\'animationatStart\' value=\'true\'>'; echo '<param name=\'transparentatStart\' value=\'true\'>'; echo '<param name=\'autoStart\' value="true">'; echo '<param name=\'showControls\' value="true">'; echo '<param name=\'loop\' value="true">'; echo '<EMBED type=\'application/x-mplayer2\' pluginspage=\'http://microsoft.com/windows/mediaplayer/en/download/\' id=\'mediaPlayer\' name=\'mediaPlayer\' displaysize=\'4\' autosize=\'-1\' bgcolor=\'darkblue\' showcontrols="true" showtracker=\'-1\' showdisplay=\'0\' showstatusbar=\'-1\' videoborder3d=\'-1\' width="500" height="450" src="http://SITEPROTECTED.com/?_page=file:download&_escape=1&id=12" autostart="true" designtimesp=\'5311\' loop="true">'; echo '</EMBED>'; echo '</OBJECT>'; echo '</td></tr></table></center>'; }else{ echo 'Sorry, the file does not exist.'; } }else{ echo 'Sorry, you are not authorized to view this file.'; } }else{ echo 'Sorry, your access has expired.'; } } ############################## ## DOWNLOAD ## ############################## function download2($VAR) { echo 'Module disabled.'; } function download($VAR) { $db = &DB(); $sql = 'SELECT * FROM ' . AGILE_DB_PREFIX . 'file WHERE site_id = ' . DEFAULT_SITE . ' AND id = ' . $db->qstr(@$VAR['id']) . ' AND status = 1'; $result = $db->Execute($sql); if($result->RecordCount() == 1) { $show = true; ### Validate start date $s = $result->fields['date_start']; if($s != '' && $s != 0) if($s > time()) $show = false; ### Validate expire date $e = $result->fields['date_expire']; if($e != '' && $e != 0) if($e < time()) $show = false; ### Validate user group: if($show) { global $C_auth; @$arr = unserialize($result->fields['group_avail']); $show = false; for($i=0; $i<count($arr); $i++) { if($C_auth->auth_group_by_id($arr[$i])) { $show = true; break; } } } ### Get the filetype if($show) { $ft = $result->fields['location_type']; if($ft == 0) $file = PATH_FILES . 'file_'.$VAR['id'].'.dat'; elseif ($ft == 1) $file = $result->fields['location']; elseif ($ft == 2) $file = $result->fields['location']; ### Open the file if (@$file=fopen($file, 'r')) { ### Display the correct headers: header ("Content-Type: " . $result->fields['type']); header ("Content-Size: " . $result->fields['size']); header ("Content-Disposition: inline; filename=" . $result->fields['name']); header ("Content-Length: " . $result->fields['size']); fpassthru($file); exit; } } } echo 'Sorry, the file does not exist or you are not authorized or your access has expired!'; }
  12. quote modified from original context at: http://www.sitepoint.com/article/hierarchical-data-database/ for anyone who runs into this problem in the future, here is an example of hierarchy: function display_children($parent, $level) { // retrieve all children of $parent $data = new mysql_database; $result = $data->select("select * from " . TABLE_BUSINESS_CATEGORIES . " where parent='".$parent."'"); // display each child while ($row = $data->fetch_array($result)) { // indent and display the title of this child echo str_repeat(' ',$level).$row['category_name']." (parent = '".$row['parent']."' && id = '".$row['business_categories_id']."')"."\n"; // just doing a check on (parent= and id=) to ensure it's working // call this function again to display this // child's children display_children($row['business_categories_id'], $level+1); } } echo display_children('0', '0'); # this code solves miracles thankx!
  13. Hi, I have a database table with records for categories. The categories can go in depth quite a bit and can be stacked "multiple" up: meaning, Category 1 may have a parent of "root" - or 0 as a category_id. Category 3 may have parent as Category 1, Category 6 may have parent as Category 3, Category 20 may have parent as Category 6, and so on. With this example, our stack would look like the following for the Category 20: Root (or Id=0), 1, 3, 6 However, at the same time, Category 37's parent could be 3 as well as Category 6's. So we create a problem. How do we dynamically pull our categories and show their hierarchy? For this listed example, the hierarchy would look like: 0 -> 1 -> 3 -> 6 -> 20 [For Category 20] 0 -> 1 -> 3 -> 37 [For Category 37] Actual Table: We can use arrays or whatever means php 5 offers. But remember, just as Category 37 is a child, it could also turn out to be a parent in the future. To solve this, I've tried using eval and arrays. However, I get errors when doing this. My approach was to store the array pointers in an array and then loop through them and store them in a variable string format and then do an eval. However, nothing has worked and I'm crunched for time on this project. Please, please help!! A point in the right direction will be useful as well!! Thank you, Alex
  14. i'm creating an intricate site. the options for database are: mysql, sqllite, or xml it will communicate with php. i need to know, 1) which will be the fastest and lightest on bandwidth/server load overall (when the site gets massive), 2) which is most similar to mysql queries (sqllite or xml), 3) can sqllite and xml perform: select, update, delete, insert similar to the queries by mysql (i know there's something for xml called "xml_query2xml" in pear, but does this allow you to do insert, delete, and update like you would in mysql?) also, if you can provide any xml frameworks that do the following for databases, that'd help toO!! thanks, alex
  15. so basically you're saying when you update it now and don't use the form... it shows the new updates?
  16. well i have pretty much been booed off this topic :'(
  17. I was thinking along the same lines. I've tried that and restarting the machine multiple times. I tried running it outside of Dreamweaver -- straight out of the folder with Firefox (didn't work but is that bypassing the server?). I didn't have any problems earlier this morning when I was learning how to read from a database. I used the same kind of setup with the two different files. I might try uploading the files to my Godaddy account and seeing if things work better from there. I've tried to make the files as short and as simple as I can, but I just feel like I'm missing something. I dunno. I'll give it another shot tomorrow. Thanks for all of the inputs. try entering $var1 = 'hello world'; $var2 = 'hello world 2'; var_dump($var1, $var2); See what you get from the above (by just going to the address of the file and not doing the form action)
  18. this shouldn't do anything, but maybe try and clear your cache (if you're on a local machine, restart your apache server). also, idk if this will change anything but instead of using the back button on your browser, enter the actual address in the URL box
  19. ever heard of a reliable company called bluehost.com (http://www.bluehost.com/)? servers over 800,000 domains (i have two account packages). never had a problem with uptime and companies of their size do serve unlimited bandwidth and space my man. (it's called large servers and fiber optics)
  20. ftp support 99.99% or more uptime unlimited hosting unlimited bandwidth unlimited domain names unlimited mysql databases php 5, perl, cgi, pop3, imap cpanel affordable (<$10/mth)
  21. Intellectual property laws. Still a crap deal though. In fact I think it's somewhat of an insult even asking for that. I bet they wouldn't ask someone to build three houses and then they'll pick whichever they like best. eh... intellectual property laws aren't so easy to fight for
  22. ha. it depends what company you work for. an associates degree won't get you that right off the bat, you'll need to work real hard. in order to make 70,000 as a designer, you'll need to work real hard (more than 40 hrs a week). if you work for google... that'll earn you easily 80,000, but if you work for a web design firm, plan on making 10-20/hr. charging people is worse too. if you work for yourself, figure atleast 12/hr then tack on an additional tax fee (5/hr). you should always estimate more than you think it'll be because it always turns out to be more than you think will be.
  23. yes, remove the <html> <body> </body> </html> and also, be careful of IE, it has trouble with png sometimes
  24. my point. if you're inserting into the same table columns for each person, then the above post i had would be best. but even still, you'd have to loop an array. i don't see any other way because you'd still have to create the insert string
×
×
  • 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.