Jump to content

jefkin

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Everything posted by jefkin

  1. Hi Can. You can do this, but it's not very eficient. Best way to do it is: table ticks (id integer auto_increment, name varchar(6) not null); table ticks_for_products (id integer auto_increment, tick_id integer not null, prod_id integer not null); table myproducts .... something including an id field like maybe (id integer auto_increment, ... Now, you have a straight query on the ticks_for_products table. However, that may not be an option, in which case: Modifiy your tickeditems data so that it begins and ends with a ',' so change: 1,5,10,23,45    and          3,5,12,34 into ,1,5,10,23,45,    and          ,3,5,12,34, Then build your query as: [code] $query = " SELECT * FROM myproducts "; $join = ' WHERE '; foreach ($thickeditems as $item) {     $query .= $join . "tickeditems like '%,$item,%' ";     $join      = " AND "; } mysql_query($query) ... [/code]
  2. Some suggestions.  the first one seems most likely, particularly since your connecting to everything all at once: xml, mysql, mail .... You could be execing your PHP script time.  If you have access to your ini file, you could give your scripts a longer execution time. But there may be easier ways to get all of this done.  Maybe breaking the functionality into seperate pages, which redirect to each other... Just some suggestions, HTH Jeff
  3. You could throw a little javascript in your form: This may not work for you out of the box, but I'm sure you could tweak it!  :) [code] <form method='get' id="search_form" action=''> <input type="hidden" id="my_i" name="which" value="<?= $_REQUEST['p'] ?>" /> <!-- put a script tag here!!!  (script) --> function search() {   i          = document.getElementById('my_i').value;   sel        = document.getElementById('select_srch');   form        = document.getElementById('search_form");   form.action = "friends/" + sel.options[sel.selectedIndex].value + "/" + i;   form.submit(); } </script> <select name='l' id="select_srch" onChange="javascript: search();"> <option>All</option> <option value='Disabled_People'>Disabled People</option> </select> </form> [/code] Jeff
  4. Something comes to mind after a glance at the code. Your code to prevent looking at other people's mail could be wrong: You check against $stat[id], but I don't see a place where you set $stat[id].  If you haven't set it, then PHP treats it like ''.  Your security compares $mail[owner] against $stat[id] (or '')  That could be the problem. However, since you use that variable all through the code, you may have other bugs waiting to happen.
  5. Another option, depending on your web server, is using url rewriting (Apache REWRITE mod) to make the urls a user sees and uses completely different from what's going on behind the scenes. Jeff
  6. t.bo There are some hacking ways to suck the spaces out, but I'd suggest fixing the database.  This is to expand on Rich's comment To convert to using a DATETIME column involves more than just the database, but the database is probably the hardest part. first add the date column (using a different name) mysql> ALTER TABLE `agenda` ADD date_dt DATETIME; next copy the existing date data mysql> UPDATE `agenda` SET date_dt = date; you may have to deal with problems here, but that shouldn't be too hard. now you have the data in a datetime column.  your next step is to remove the old, invalid column. mysql> ALTER TABLE `agenda` DROP date; in order to minimize the impact on your scripts, let's change the name of the valid date column to 'date'. mysql> ATLER TABLE `agenda` CHANGE date_dt date DATETIME; Now, your table has a real date column.  This might affect your php scripts, but if so, it should be for the better.  Good luck, Jeff
  7. Hi w32, My opinion is the best way to handle this is with the same query, you used, just add a bit of 'control' logic in your php display.  I'm going to wave my hands about some of this, since I can't see your display code, but maybe using something like: [code] $category = $db->query("SELECT * FROM forum_categories fc LEFT JOIN forums f ON fc.catid=f.catid ORDER BY fc.cat_position, f.position ASC"); $last_cat = -3; // or some other non-used catid number you could always use -2345678 that doesn't seem like a regular category id :) while ($cat = $db->one_result($category, ...) /* loop on query result row */)  // you fill in your code here. {   if ($last_cat != $cat['catid']) // you probably need to change access.   {         $last_cat = $cat['catid'];       ?> <!-- display chunk for category -->       <div id="category"><?= /* hand waving:  assume your category name is: */ $cat['cat_name'] ?></div>       <!-- blah blah --><?PHP     }     ?><!-- display chunk for forums -->     <div id="forum"><?= /* more hand waving: assume your forum name is: */ $cat['forum_name'] ?></div>     <!-- etc, etc, your forum links and stuff... --><?PHP } ?> [/code]
  8. Yes Sir!  :) Redarrow, Sir!  :o I have already read everything I could find on headers, Sir!  ;D As I mentioned, the script works EVERYWHERE except for IE.  I've scoured bulitin boards, and news groups, and mailing lists.  I chose this group because the tone was usually very helpful and quick.  And I'm not asking for a complete solution, though I'd be a fool to ignore it, I'm just looking for a resource.  I'm looking for:  "Oh, checkout this thread, or this site." You gave me a hint that I already knew, my friend.  I didn't just cut and paste this code without understanding it.  I do understand it, read the RFC's top to bottom, and I don't know if I'm dealing with a IE bug, a windows bug, or if I've missed some other header to make it work there.  I have been searching for a solution to this for over 3 weeks.  The client is getting antsy, and so am I. I've shown the code.  Is it realy so much to ask for a bit more than 'look up header'? I hope I don't offend you redarrow, I'm just glad I got a repsonse.  Maybe this post should move to some other forum here.  Or maybe someone can suggest a group that can help me answer my question. Jeff
  9. That error happened with the ',' between your two table names 'ibf_members,ibf_member_extra' that suggests to me that your MySQL can't handle the 2 table update. You could break the statement up into 2 updates instead, or maybe upgrade your MySQL. Jeff
  10. Hi Rectifier, it sounds like you're using a PHP prior to 4.2, According to the docs, you don't need to call srand on PHP >= 4.2.0. If your PHP is an earlier version, try this. [code] <?php $numbers = range(1, 20); srand((float)microtime() * 1000000); $pics = array("img1.jpg", "img2.jpg", "img3.jpg","img4.jpg", "img5.jpg"); shuffle($pics); for ( $i = 0; $i < 5; $i++ ) { echo '<img src="portfolio/' . $pics[$i] . '" border="0">&nbsp;&nbsp;'; } ?> [/code] Jeff
  11. [quote author=onlyican link=topic=107387.msg431027#msg431027 date=1157766141] I am running MySQL V 4.2.1 SELECT MAX(IF(email = '{info@disabledfriends.net}',1, 0)) AS em_dup, MAX IF(username='{jamie}', 1, 0)) AS us_dup FROM findafriend; and I got You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF(username='{jamie}', 1, 0)) AS us_dup FROM findafriend' at lin (I am using MySQL front, so I dont get all the error [/quote] Sorry onlyican, I was presenting the SQL as if in a string for PHP. In my PHP, a double quoted string with {$somevar} in it interpolates the '{' and '}' as part of the variable refrence. To phrase the query more like other examples I've seen here: [code] 'SELECT MAX(IF(email = \'' . $email . '\',1, 0)) AS em_dup, MAX IF(username=\'' . $user . '\', 1, 0)) AS us_dup FROM findafriend' [/code] or for your query for pasting into a mysql interface directly: [code] "SELECT MAX(IF(email = 'info@disabledfriends.net',1, 0)) AS em_dup, MAX IF(username='jamie', 1, 0)) AS us_dup FROM findafriend" [/code] Jeff
  12. making some assumptions about fields... [code] <?PHP #... db connection stuff, query your database table, ... somthing like "SELECT header, content, footer FROM ..." #... put results in array $results foreach ($results as $news_item) {   ?>   <div id="header"><?= $news_item['header'] ?></div>   <div id="content">       <h4>... other content stuff ...</h4>       <?= $news_item['content'] ?>   </div>   <div id="footer"><?= $news_item['footer'] ?></div> <?PHP } ?> [/code] I'm not sure if this is what your after, but hth. Jeff
  13. Sure it works maxic0, But it doesn't do what barkster wanted: [quote author=barkster link=topic=107387.msg430837#msg430837 date=1157744184] That is what I have now and that only checks to see if username is already taken.  I want to check to see if username or email is already used.  Then I need to determine which it is.  I was trying to do it all in one step  like [/quote] With the above query barkster can test or either or both conditions. Jeff
  14. [quote author=kenrbnsn link=topic=107412.msg430979#msg430979 date=1157758672] To jefkin: You don't need to serialize any data that is put into a session variable, since all data is automagically serialized when the session array is stored. Ken [/quote] Izat so!  ;D learn something new every day! Thanks Ken.
  15. Karen, I've kept my templating system (Smarty) on a very short leash for a long time, and now that I know it fairly well, I've begun to play with it. Smarty may not be the latest and greatest, but it's stable, and extensible, and worst case you can just write straight php, and it doesn't get offended :) Jeff
  16. karstev, A somewhat stretching -- posiblity is if you use Smarty or some other templating system, Smarty has the ability to filter output, and may have added text prior to your <?PHP, Unfortunately, I've only encountered that error when some text (not just spaces) was output before the session_start(). Depending on your platform, sometimes invisible characters could be 'hiding' out. You might try the old standby, rebuilding the file from scratch, though you've probably already tried it  :-X Sorry if that doesn't help. Jeff
  17. session_start() sends header urls. If any spaces, blank lines, or text is in the file before <?PHP then PHP already sent your headers prior to seeing the session_start() call. Check out your file. Jeff
  18. [quote author=Muhammad Mustafa link=topic=107390.msg430845#msg430845 date=1157744605] hello all plz every body help me to edit this query [code]$SQL = '' . 'SELECT * FROM articles WHERE category=\'' . $_GET['cat_id'] . '\' AND type=0 AND status=1 AND tim<' . $_GET['tim'] . ' ORDER by tim DESC LIMIT 10';[/code] *snip* [/quote] Assuming $_GET['tim'] and database tim is in mysql database date form. [code] $SQL = '' . 'SELECT * FROM articles WHERE category=\'' . $_GET['cat_id'] . '\' AND type=0 AND status=1 AND tim<' . $_GET['tim'] .             ' AND datedif(' . $_GET['tim'] . ', tim) <= 7 ORDER by tim DESC LIMIT 10'; [/code] Jeff
  19. [quote author=onlyican link=topic=107387.msg430935#msg430935 date=1157753435] thats MySQL 5 and above aint it or MSQL [/quote] mysql -V mysql  Ver 14.7 Distrib 4.1.11, for mandrake-linux-gnu (i586) When I found out 4.1.11 supported it, I jumped for joy  :D Jeff
  20. Maybe a better solution is to store your array data with serailize()/unserialize() saver: $_SESSION['names'] = serialize($names); .... reader: $names = unserialize($_SESSION['names']); .... HTH Jeff
  21. With a decent version of MySQL:   "SELECT MAX(IF(email = '{$email}', 1, 0)) AS em_dup, MAX(IF(user = '{$user}', 1, 0)) AS us_dup from users" Jeff
  22. Two other options for you mrbrightside, One, code all your variables in form elements and use $_POST['xyz'] to get them. Two, use sessions to hold your variables and use $_SESSION['xyz'] to get them. For either one, you'd want some sort of interface where you could set the variable, then store it by your chosen method, and display or whatever. Two can be tricky if you're unfamiliar with session variables. Jeff
×
×
  • 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.