Jump to content

dsk3801

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

About dsk3801

  • Birthday 04/12/1978

Contact Methods

  • Website URL
    http://www.reflex-hosting.com

Profile Information

  • Gender
    Not Telling
  • Location
    Dallas, TX USA

dsk3801's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [!--quoteo(post=375591:date=May 20 2006, 06:25 PM:name=anatak)--][div class=\'quotetop\']QUOTE(anatak @ May 20 2006, 06:25 PM) [snapback]375591[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hello, If I understand correctly I use the third table to store just the primary keys ? data example infotype typeid 1 type bar typeid2 type club typeid3 type restaurant info infoid 1 name bar/restaurant1 infoid2 name club1 infoassign record 1 infoid 1 typeid1 record2 infoid1 typeid 3 record 3 ifoid 2 typeid 2 I am I correct in my interpretation ? thanks a lot I think I begin to see the light at the end of the tunnel (and it is not the train running towards me) anatak [/quote] Yes! That's exactly it. I think you'll find it much easier to work with, and if you ever have to expand the system later (let them have more than 3 types), it will also be a lot easier. You'd simply have to add more fields to the form and wouldn't have to change anything else. :)
  2. [!--quoteo(post=375391:date=May 19 2006, 06:44 PM:name=Pulling Out Hair)--][div class=\'quotetop\']QUOTE(Pulling Out Hair @ May 19 2006, 06:44 PM) [snapback]375391[/snapback][/div][div class=\'quotemain\'][!--quotec--] Cron Job to process phpList e-mail “Q” I am at my wits end. I finally figured out this problem Status: 404 Content-type: text/html X-Powered-By: PHP/4.3.2 No input file specified. Only to start getting this error Content-type: text/html X-Powered-By: PHP/4.3.2 Fatal Error: Mysql is not supported in your PHP, recompile and try again. I know Mysql and PHP work on my site because I can process the “Q” manually. What am I missing? I really need some help there is a huge patch missing out of my hair as I continue to pull it. [/quote] how are you executing the cron script? I usually do a "where php" on the command line first to find out where the php binary is located, then run it, like this: /usr/local/bin/php -f /home/username/public_html/cron_file.php You can also do: /usr/local/bin/php --help To get a list of the command line options. On some servers I've had to specify which php.ini file to use when running on the command line, which there is an option for.
  3. I wonder if this would work? $sql = "select `fname`, `birthday`, `email` from `pro_membersu` where `fname` like '%{$name}%' and `address` like '%{$address}%' and `price` like '%{$price}%';"; alternatively, if you just want to match when one or more conditions are found, then you could use or instead of and: $sql = "select `fname`, `birthday`, `email` from `pro_membersu` where `fname` like '%{$name}%' or `address` like '%{$address}%' or `price` like '%{$price}%';";
  4. [!--quoteo(post=375434:date=May 19 2006, 10:08 PM:name=shoz)--][div class=\'quotetop\']QUOTE(shoz @ May 19 2006, 10:08 PM) [snapback]375434[/snapback][/div][div class=\'quotemain\'][!--quotec--] Unfortunately after manually visiting your page to figure out the rules, it shouldn't be too difficult to spam it. There's nothing stopping someone from using their spamming tool to go through the page and automatically look at the numbers to generate a valid result. The reason why the CAPTCHAs using images are useful is the fact that it's difficult to write a program that can recognize the characters (numbers, letters etc) that are distorted in the picture. [a href=\"http://en.wikipedia.org/wiki/Captcha\" target=\"_blank\"]http://en.wikipedia.org/wiki/Captcha[/a] [/quote] Have to agree with this one. I also recently saw an article about using a 3x3 matrix (9 images), 3 of which were kittens and the rest weren't. The user had to click the 3 kittens before it would let them submit the form. Here's the link if you want to read it over - [a href=\"http://www.thepcspy.com/articles/security/the_cutest_humantest_kittenauth\" target=\"_blank\"]http://www.thepcspy.com/articles/security/...test_kittenauth[/a]
  5. The third table serves as a link between the two and makes it a lot easier to get the data. I would redesign it like this: info infoID (primary key) infoname (name of business) infotype infotypeid (primary key) infotypename (description of business like bar, restaurant) infoassigns infoID infotypeid You would then create an HTML form that had three drop down selectors, each selector having the values from the infotype table. Something like this (pardon the abstraction): Business Name: [ ] Type 1: [ ] (drop down selector, <select name="type1"><option value="infotypeid">infotypename... Type 2: [ ] same drop down as above Type 3: [ ] same drop down as above When the form is saved, you save the business name to the info table and use mysql_insert_id() to get the infoID for that record. Then you save a new record in the infoassigns table for each type selected, storing the infoID and the infotypeid. Then you can run this query to get the results: SELECT info.infoID, info.infoname, infotypes.infotypename FROM infoassign, info, infotypes WHERE infoassign.infoID = info.infoID AND infoassign.infotypeid = infotypes.infotypeid I hope this makes sense. It's not an easy thing to explain.
  6. What is this doing: $tmpl->add_template("editprofile_form"); If you're using a template system of some kind, it would depend on how that template system handles PHP code within the templates. Does the add_template() method read in the template file using fread or something similar or does it include() the template file? If it is using something like fread to get the contents of the file, the PHP inside would not be processed.
  7. [code] $var = '$variable$'; if (strlen($var) == 0) {     $var = 0; } [/code]
  8. Actually, after thinking a little bit, a better way to do it... for demonstration purposes, I created three tables: [b]info[/b] ----- [i]info_id[/i] int unsigned auto_increment primary [i]name[/i] text [b]info_types[/b] ----- [i]Info_TypeId[/i] int unsigned auto_increment primary [i]description[/i] text info_assign ----- info_id int unsigned Info_TypeId int unsigned You can then use the following SQL statement: SELECT info.name, info_types.description FROM info_assign, info, info_types WHERE info_assign.info_id = info.info_id AND info_assign.Info_TypeId = info_types.Info_TypeId There are a couple of advantages to this method. First, you can have an as many info types per info item as you want (not limited to just 3). The disadvantage is that you'll need a little extra care to prevent duplicating the info.name field. I'd do it something like this: [code] $sql = "SELECT info.info_id, info.name, info_types.description FROM info_assign, info, info_types WHERE info_assign.info_id = info.info_id AND info_assign.Info_TypeId = info_types.Info_TypeId"; $db = mysql_connect(...connection info); mysql_select_db($dbName); $q = mysql_query($sql, $db); $list = array(); $names = array(); while ($data = mysql_fetch_assoc($q)) {     if (!is_array($list[$data['info_id']]))     {         $list[$data['info_id']] = array();     }     $list[$data['info_id']][] = $data['description'];     $names[$data['info_id']] = $data['name']; } foreach ($names as $id => $name) {      echo "$name<ul>";      foreach ($list[$id] as $infoType)      {           echo "<li>$infoType</li>";      }      echo '</ul>'; } [/code] The results will be a list of all of your info names followed by a bullet list of all the info types assigned to that info name.
  9. It might be a little easier if you could post the structure of the two tables. I'm pretty sure I know how to do it, but I want to test it before I embarass myself. :)
×
×
  • 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.