Jump to content

Muddy_Funster

Members
  • Posts

    3,372
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Muddy_Funster

  1. OK, sorry this has taken so long, but I have been ocupied by other things recently. This is where I have got to so far: change your table and make it two tables: id| int(8 ) - PK - auto_inc name| varchar() address1| varchar() address2| varchar() address3| varchar() zip| varchar() city| varchar() you can set the lengths on the varchars as you think best. id| int(12) - PK - auto_inc v_id| int(8 ) - FK type| varchar() event_day| date(0) event_time| time(0) open| intyint(1) smoking| tintyint(1) literature| tintyint(1) handicap| tintyint(1) birthday| tintyint(1) speaker| tintyint(1) rotateformat| tintyint(1) candlelight| tintyint(1) newchange| tintyint(1) active| tintyint(1) The tables are named "venue" and "event" respectivly. And here's some sample code for the results: $qry = 'SELECT name, city, type, event_day, event_time FROM venue RIGHT JOIN event ON (venue.id = event.v_id) WHERE event.event_day => CURDATE() ORDER BY city, name, type, day, time ASC'; $result = mysql_query($qry) or die ('Fatal error returning information from the database! -- '.mysql_error()); while ($row = mysql_fetch_assoc($result)){ if($city != $row['city']){ echo '<br><h4>'.$row['city'].'</h4><br>'; $city = $row['city']; } if($name != $row['name']){ ehco '<br><h5>'.$row['name'].'</h5><br>'; $name = $row['name']; } echo '<a href="yourURLlink">'.$row[type].' on '.$row['day'].' @ '.$row['time'].'</a><br>'; } Let me know how you get on.
  2. sure does, have a look at this: SELECT company_id, stage, time, COUNT(queue_id) Remaining_Processes FROM Tbl1 RIGHT JOIN Tbl2 ON (Tbl1.company_id = Tbl2.company_id) WHERE stage <> "inactive" GROUP BY company_id I don't have time to test it, but it should let you see how to get what your looking for.
  3. Format from within you SELECT. SELECT DATE_FORMAT(upddate, '%d %b %Y') UpDate, TIME_FORMAT(updtime, '%H:%i) UpTime FROM tablename
  4. Could you post your ACTUAL query (copy & paste) - it makes solving these things much easier
  5. you'll need a join. Post us your table info and we can help a bit more.
  6. Yeah, I sure do see where your coming from on that one.
  7. 'SELECT * FROM con WHERE contribution = \''.$variable.'\'';
  8. erm...learn how to use MySQL COUNT.....like someone sugested already. SELECT source, count(*) totals FROM table GROUP BY source @ souper
  9. Try using a RIGHT LEFT or a LEFT JOIN.
  10. there is no better way than to do it by Select name, phone, email, department, building FROM tablename WHERE criteria is met There are otther ways of doing it, but not better ones. You could do a single SELECT statement on a page of it's own which can populate an array, you could then pass this array to $_SESSION and reffer back to it from any page. But you would only do that if you wanted to use massive amounts of bandwith and grind your site to a halt. What is your issue with selecting only what you need, only when you need it? Why does that not strike you as the most sensible way to do things?
  11. $myQuery = mysql_query("SELECT * FROM productfeed WHERE 1 . if(isset($description)) ' AND if description = '. $description; if(isset($price)) . "); is a total mess. Try the following: $wArray = array(0 =>" WHERE description ='".$description."'", 1 => " WHERE description = '".$description."' AND price = ".$price, 2 => " WHERE price = ".$price, 3 => " WHERE 1") $query = 'SELECT id, awImage, link, description, price FROM productfeed'; if ((isset($description)) && ($description != '') && ((!isset($price)) || ($price = ''){ $wList = 0; } if ((isset($description)) && ($description != '') && ((isset($price)) && ($price != ''){ $wList = 1; } if ((!isset($description)) || ($description != '') && ((isset($price)) && ($price != ''){ $wList = 2; } if ((!isset($description)) || ($description = '') && ((!isset($price)) || ($price = ''){ $wList = 3; } $qry = $query . $wArray[$wList]; $result = mysql_query($qry) or die ('Error querying the database -- '.mysql_error()); I've never been much use at arrays, but that should work.
  12. start with the following, then repost the code for the search page: turn error reporting on, change this line: $memberIndustries =['memberIndustries']; to [php$memberIndustries =$_POST['memberIndustries'];[/code] stop using short tags "<?" and learn how to echo rather then constantly breaking out of script.
  13. wouldn't it be easier to just replace while ($result = mysql_fetch_assoc($query)){ $test2[] = $result; } with $test2 = mysql_fetch_assoc($query); ??
  14. First up, lets tidy up some of your code: $query = "SELECT id, industry FROM industries WHERE industry.status = 'true'" ; $result=mysql_query($query) or die ('Fatal Error retrieving Industry list : '.mysql_error()); while($record = mysql_fetch_array($result)){ echo "\n<option value='".$record["id"]."'> ".$record["industry"]."</option> } The following will get your result set that you want, I never use javascript, so can't advise you how to call this, but it does what you want your looking for. $query2 = "SELECT id, name FROM products WHERE products.industries = ".$_GET['page'] ; $result2 = mysql_query($query2) or die ('Fatal Error retreving industry product list : '.mysql_error()); while($record2 = mysql_fetch_assoc($result2){ //your list code here }
  15. Just want to clarify a couple of things: 1 - is there a reason that date and time are both varchar fields? 2 - I assume that there is only going to be records added to the table when there is an event actualy happening, and that you won't be adding anything for any days / citys that won't be holding anything? 3 - how open are you to having your database re-structured?
  16. nice one, thanks for that fenway
  17. fenway could you please elaborate on that?
  18. your first post had the correct syntax, your second post has you trying to insert the string value "a" into your auto_inc integer field. oh, and please use the tags when posting code up, makes life much easier.
  19. From your inital description I don't think merging into a single table will be the answer. Items has inital information regarding, well, an item. Item_stats has some more in-deapth information. You arn't going to want to access the information on Item_stats untill the end user shown an intrest in a perticular item. The question is, how many real records do you have in Item_stats? You either have the choice of moving the info out, to another differently named table, OR you can just delete the content and start from scratch....
  20. IMO you would do better with an individual table for each doctor, as well as a control table that holds the particulars of that practitioner. That would then make things much easier
  21. nah, SELECT DISTINCT only returns one row for each value in a column, even if there are 100 rows with that value, nesting selects in the way you are thinking about tends to not work too well and slows things down. PHP is much better at the contitional data checking that you want to do. And foreach is a php loop that basicly does what you are already doing with your while loop, foreach is normaly used with internal arrays within PHP. What I think would be the best way to do it would be to nest a few if statements inside the while loop. have the if statements check the values terurned from the database, and if they are not assigned, negglect to echo them to the page. It's just going to take me some time to come up with the proper code to do that (alough chances are someone else well get there before I do - and probably with better code aswell- I'll work on it when I can untill that happens).
  22. Syntax should work looking at it, what's the error your getting?
  23. whoa there....I think what you need to do is revisit your table structures. You should have seporate columns for most of the things you have in stat.
  24. i'm not getting it, could you post the code you tried with already? from your question all you need is SELECT value FROM item_stats WHERE stat = "age" Now i'm sure that's not all you want to do, so help us help you .
  25. To be honest, I dont know, I don't have time for (anti)social networking sites, I like going to the pub too much
×
×
  • 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.