Jump to content

SweetLou

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Everything posted by SweetLou

  1. Well, depending on how you page is coded it will or will not change the look in all browsers. You seem to have found a way for you to code for all browsers and make it look the same. The pages I make usually mean I have to use xhtml 1.1 strict, and even then, I sometimes need a small IE hack. As for why bother with you own doctype, that was the main purpose of the original poster. The OP wanted to keep the page valid but still use target="_blank", this can be done by using a custom doctype.
  2. If that were even true at all, I might actually consider using them... What part don't you think is true? The part about getting the same results in all browsers or the part about making your own doctype?
  3. Yes, it would be easier, but you won't get the same results in all browsers, whereas if you had standards then your page would look like you want it to look in all browsers. If you want to code in your own way, you could just make your own doctype and have the browsers follow that standard.
  4. Works in my IceWeasel 2.0.0.1 also. Do you have a setting in FireFox to display animated gifs only once or never?
  5. fenway, I used to think like you do, but I now know better. Standards are a good thing. They make authoring a webpage so much easier. If you want to use the target attribute, then either use a different common doctype or create your own. The original poster decided to use xhtml 1.1 strict, then that person should code to that standard. Your knowledge, expertise and willingness to help with sql is admired, but as you know, how you do something in MySQL 3 might be different in MySQL 5, this is kind of like how it is in xhtml 1.1 strict or html 3, if you decide to use one over the other, than you need to follow those standards. I prefer to use xhtml 1.1 strict, since IE follows that a little closer than the other standards and it makes it a little easier to add a few hacks to make IE look the same as opposed to other standards. Oh, and for the original poster, yes I do mean IE, not FireFox. FireFox is not perfect with its standards, but it is a lot closer than IE.
  6. I'm not sure how you have things set up, but you could just write a script that checks for a date and time that the email should be sent, then just use a cronjob to run the script however often you need it. For example, if you will be sending emails out once a day, you could just run the script once a day also, looking for emails that need to be sent that day. I would probably have the script look for all records that the email send date is older than now, send all of those emails. I would also have a field for emails already sent, so that the SQL would look for all dates older than now, and the email sent field is false. Once the email is sent, then update the email sent field. Of course, you could make this as complicated as you want. For example, if an email was sent and the user didn't get the computer in 3 days, another email is sent, etc.
  7. I think I understand what you mean, it just dawned on me. Instead of having a field of default_record, create a new table. That table would be set up something like default_record, and the value would be the report_id. Then I could do a query to get the report_id and then pull that record to show? If that is what you meant, that makes sense. and should be easy to do.
  8. Never have used TIMESTAMP, but why not?
  9. Sorry, I am not sure what you mean by that.
  10. You could make the column as a timestamp, you won't need to enter the data, it will automatically add the current date. But, if you ever modify the record, the date will change again.
  11. Well, that sounds good, but we want the latest match's report to be the default report to be shown on the site. So, the default report should change weekly during the season, unless the person in charge of updating the match reports doesn't do it. I was thinking about doing it by date, but that won't be good, because we could have records for future games already in the database.
  12. I have a table that lists my rugby team's match reports. On the web page, I want to display a "default" match report, then have a menu where users can select a different report. The table consists of 7 fields.[code] report_id game_id report_title game_date game_score report_text default_report[/code] Default_report is a type tinyint(1). If this value is "1", then it is the default and it will be displayed. My question is: Is there a way to make the field default_report only have one record with the value of "1", the rest should be "0", when I set a new record as the default, the old default will be changed to "0"? If that is not possible, and I can only change the values through a query, which way would be best? Should I make all the values in default_report be "0", then update the report I want to be "1"? Something like:[code]$query = "UPDATE match_reports SET default_report='0'; mysql_query($query) or die(mysql_error()); $query2 = "UPDATE match_reports SET report_title ='" . $report_title . "', game_date='" . $game_date . "', game_score='" . $game_score . "', report_text='" . $report_text . "', default_report='" . $default_report . "' WHERE game_id='" . $game_id . "'"; mysql_query($query2) or die(mysql_error());[/code] Is there a better way?
  13. I was having a bit of trouble, so I rewrote my script. I am now using nested SELECT statements. Though, I am sure this would be big hit on the server. What I did was knowing that each user will have his own user_id, I used the SELECT DISTINCT statement. This gets each user_id. I then have another SELECT that gets the data for each distinct user_id. As you can see, there is a lot of looping here. [code]$sql_distinct = mysql_query("SELECT DISTINCT user_id FROM phpbb_xdata_data"); while($dist = mysql_fetch_array( $sql_distinct )) { $dist2 = $dist['user_id']; echo $dist2."<br />"; $result0 = ""; $result1 = ""; $result2 = ""; $result3 = ""; $sql_user = mysql_query("SELECT field_id, user_id, xdata_value FROM phpbb_xdata_data WHERE user_id ='" . $dist2 ."'"); while($rover_user = mysql_fetch_array($sql_user)) { if ($rover_user['field_id'] == 10) { $result0 = $rover_user['xdata_value']; } if ($rover_user['field_id'] == 11) { $result1 = $rover_user['xdata_value']; } if ($rover_user['field_id'] == 12) { $result2 = $rover_user['xdata_value']; } if ($rover_user['field_id'] == 13) { $result3 = $rover_user['xdata_value']; } if ($rover_user['field_id'] == 20) { $i = "true"; $sql_id = $rover_user['user_id']; $sql_email = mysql_query("SELECT user_email FROM phpbb_users WHERE (user_id = '" . $sql_id . "')"); while($row2 = mysql_fetch_array($sql_email)) {     $user_email = $row2['user_email']; } } if ($i == "true") { echo "<div style=\"border:solid 2px #2f4f4f; margin:0 auto 1em auto; width:400px;\">"; echo "<div style=\"background-color:#526f35; margin:0 0 0.3em 0; font-size:110%;\">".$result0; if (!empty($result1)){ echo " \"".$result1."\" "; } echo $result2."</div>"; echo "<div class=\"smaller\">" . $result3 . "</div>"; if (!empty($user_email)) { echo "<div class=\"smaller\"><a href=\"mailto:".$user_email."\">" . $user_email . "</a></div>"; } echo "</div>"; $i = "false"; } } }[/code] This seems to work. It is still in its testing stage, so a bit of clean up is needed, security checks, etc. I'm not very good with SQL, I was wondering if there was a better way to write this. It just seems like a lot of queries.
  14. Also, you can't be sure that what was sent by POST is what you wrote. I could easily make a form on my home computer and send it to your PHP file to process. As stated above, checking the referrer won't help since that can be altered by me. But the main reason I am replying is besides the above mentioned methods to check all data, if you are going to store this information, remember to escape characters so that malicios code won't be ran on your database. I prefer mysql_real_escape_string() and a couple of others. This should be done on ALL data your receive, even if the form is a dropdown list, a submit button, hidden or any other type.
  15. It looks to me as though you would need just the two tables, the way you have it now. The updating can be done through PHP.
  16. I didn't make the mod to phpBB, so I have no idea why the author did it this way, like I said, I would have done it another way. I have no idea what you mean by having the table converted to a name/value pairs. Thanks for looking at it. I think my best bet is to get the data with the SELECT statement I have now, then put that info into a new table as each user_id is its own row. I will have to check if the user_id is present and if it is, not to insert a new record and run this script as a crontab once a day or so. Thanks again, I appreciate you even taking the time to help.
  17. Ok, thanks for any help you can give. I was thinking I might have to make a new table and update it regularly from the querry I have already, but if I can sort without doing that, I would be happier. Here is the dump of my test site: [code]-- phpMyAdmin SQL Dump -- version 2.9.1.1-Debian-1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jan 13, 2007 at 11:52 AM -- Server version: 5.0.30 -- PHP Version: 5.2.0-8 -- -- Database: `forum` -- -- -------------------------------------------------------- -- -- Table structure for table `phpbb_xdata_data` -- CREATE TABLE `phpbb_xdata_data` (   `field_id` smallint(5) unsigned NOT NULL,   `user_id` mediumint(8) unsigned NOT NULL,   `xdata_value` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `phpbb_xdata_data` -- INSERT INTO `phpbb_xdata_data` (`field_id`, `user_id`, `xdata_value`) VALUES (10, 2, 'Kevin'), (11, 2, 'McNamee'), (12, 2, 'Hooker'), (10, 4, 'Karl'), (11, 4, 'Semple'), (12, 4, 'Flanker'), (10, 5, 'Karl'), (11, 5, 'Semple'), (12, 5, 'Prop'), (13, 2, '216 223-8366'), (14, 2, 'Sweet Lou'), (15, 2, '216 345-1413'), (16, 2, '3632 W. 152nd St. apt 302'), (17, 2, 'Cleveland'), (18, 2, 'OH'), (19, 2, '44111'), (20, 2, 'Yes'), (10, 3, 'Kevin'), (11, 3, 'McNamee'), (14, 3, 'Sweet Lou'), (12, 3, 'Hooker'), (15, 3, '216 366-6213'), (16, 3, '325663 W. 118th St.'), (17, 3, 'Cleveland'), (18, 3, 'OH'), (19, 3, '44111'), (20, 3, 'Yes'), (10, 6, 'George'), (11, 6, 'Barkley'), (14, 6, 'The Fish'), (12, 6, 'Scrumhalf'), (13, 6, '311 434-2939'), (16, 6, '132 Lorain Ave.'), (17, 6, 'Cleveland'), (18, 6, 'OH'), (19, 6, '44111'), (20, 6, 'Yes'), (14, 4, 'Idiot'), (13, 4, '382 482-8291'), (16, 4, '820 Brookpark Ave.'), (17, 4, 'Clevlenad'), (18, 4, 'OH'), (19, 4, '44320'), (14, 5, 'Happy'), (15, 5, '492 203-3829'), (16, 5, '8200 Detroit Ave.'), (17, 5, 'Lakewood'), (18, 5, 'OH'), (19, 5, '44121'); [/code] I am presently getting the info with: [code]$sql_list = mysql_query("SELECT field_id, user_id, xdata_value FROM phpbb_xdata_data WHERE user_id in (SELECT user_id FROM phpbb_xdata_data WHERE (field_id = 20 AND xdata_value = 'Yes'))");[/code] This will be an address book of my rugby team. I am using phpBB2 with a mod that gets the extra information. When field_id = 20 is the row and the xdata_value="yes" then that member is a teammate of mine. I only want the actual team members to show in the address book, not the entire forum's members.
  18. Well, if you are receiving email at work, then the script works. I would have no idea why you are not receiving at your home address, unless it is in the your spam box or if you typed the address wrong or if your home address breaks the script. But, since it is going to your work address, nothing is wrong with the script.
  19. In this example, I am trying to order by the name of the user. The user's name is always on a row that starts with the field_id=1. In my real database, it is field_12 = the last name of the user. I am trying to create an address book from the data in a table, unfortunately, the table is not set up the way I would have done it, where each user is a row. I am able to create each entry, looks something like: Steve Foley 12 River St. Tampa, FL 30338 But I can't get them to show alphbetically. I was hoping to get them to sort alphabetically and be able to a LIKE statement so that people can easily find the address of the user.
  20. I am confused, you said it worked when sending to your work address but it is not receiving. This script does not receive email, it sends it. Do you mean that when you put the address to send the email to is your work address, it works, but when it is your other email address, no email shows up in your inbox? Maybe a spam filter is catching it then. The code looks fine, well, I mean it looks functional. As for security, you have some major security holes in that code.
  21. Well, there could be a couple of reasons for this, your code is wrong, you don't have sendmail or equivalent, if you do have them, can PHP use them? Let's look at your code first.
  22. Is there anyway to add an "order by" statement to the select statement? I want to order the name. I was thinking maybe something like [code]mysql_query("SELECT field_id, user_id, value FROM xdata_data WHERE user_id in (SELECT user_id FROM xdata_data WHERE (field_id = 20 AND value = 'Yes')ORDER BY (value WHERE (field_id = '1')))");[/code] But I couldn't find anything about doing an ORDER BY using a field from another column.
  23. [quote author=mjlogan link=topic=121748.msg502138#msg502138 date=1168512540] Side Note: You field 'value' is a reserved word. [/quote]Thanks, I knew that. I was just shortening the field names, data to make it easier to read. My actual field is not called "value".
  24. Thanks guys. With your help I was able to get the results I wanted. Everything is running well now. Though I'm sure the code I wrote could have been done better.
  25. I am trying to get all the information about the users from a single table where a certain condition occurs. The table looks like: [table][tr][td]field_id[/td][td]user_id[/td][td]value[/td][/tr] [tr][td]field_id[/td][td]user_id[/td][td]value[/td][/tr] [tr][td]1[/td][td]1[/td][td]Steve[/td][/tr] [tr][td]2[/td][td]1[/td][td]Blue[/td][/tr] [tr][td]3[/td][td]2[/td][td]Yes[/td][/tr] [tr][td]1[/td][td]3[/td][td]Mary[/td][/tr] [tr][td]2[/td][td]2[/td][td]Red[/td][/tr] [tr][td]3[/td][td]3[/td][td]No[/td][/tr] [tr][td]1[/td][td]2[/td][td]Mike[/td][/tr] [tr][td]2[/td][td]3[/td][td]Red[/td][/tr] [tr][td]3[/td][td]1[/td][td]Yes[/td][/tr] [/table] What I need to do is find all users that field_id #3 is equal to "Yes" then return all information about each user. The final results will be printed into tables like [table][tr][td]Name[/td][td]Kevin[/td][/tr] [tr][td]Color [/td][td]Blue[/td][/tr][/table] [table][tr][td]Name[/td][td]Mike[/td][/tr] [tr][td]Color [/td][td]Red[/td][/tr][/table] I first did this: [code]SELECT user_id FROM table WHERE (field_id = 3 AND value = 'Yes')[/code] and thought I could somehow get the results to select the data for each user. Then I thought a subquerry would be better: [code]SELECT field_id, user_id, value FROM table WHERE user_id = (SELECT user_id FROM table WHERE (field_id = 3 AND value = 'Yes'))[/code] But, I guess this is wrong because I get an error [quote]mysql_fetch_array(): supplied argument is not a valid MySQL result resource[/quote] I have never attempted such a query and I am unsure of how to return all the information for each user
×
×
  • 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.