Jump to content

Moron

Members
  • Posts

    369
  • Joined

  • Last visited

Everything posted by Moron

  1. The above works fine. It's selecting all members who are on that board and who are checked as Active. It just doesn't work when I put in more than two perimeters.
  2. Here's the main snippet: $RESULTMEMBER=mssql_query("select * from MemberInfo MI where BoardName='Youth Advisory Board' and RepresentativeFor = 'City Staff Representative' order by MI.[LName]"); $RESULTYAB=mssql_fetch_assoc($RESULTMEMBER); $RESULTMEMBERCOUNT=mssql_num_rows($RESULTMEMBER); mssql_data_seek($RESULTMEMBER,0); while ($RESULTYAB = mssql_fetch_assoc($RESULTMEMBER)) { (Do Stuff Here) So why can't I add the "and Active = '-1'" part into the query here? It works fine here: $RESULTMEMBER=mssql_query("select * from MemberInfo MI where BoardName='Youth Advisory Board' and Active = '-1' order by MI.[LName]"); $RESULTYAB=mssql_fetch_assoc($RESULTMEMBER); $RESULTMEMBERCOUNT=mssql_num_rows($RESULTMEMBER);
  3. What is: MemberInfo MI Why is there a space in therE? What is: MI.[LName] Brackets for what? MI is the abbreviation for MemberInfo. The space is normal. The bottom line seems to be that I can only use two stipulations in the WHERE clause, but not three. That's why I'm wondering if my syntax is just wrong. I've tried every bracketing combination I can think of.
  4. Here's the entire query: $RESULTMEMBER=mssql_query("select * from MemberInfo MI where BoardName='Youth Advisory Board' and RepresentativeFor = 'City Staff Representative' order by MI.[LName]"); It works fine. But if I make it: $RESULTMEMBER=mssql_query("select * from MemberInfo MI where BoardName='Youth Advisory Board' and RepresentativeFor = 'City Staff Representative' and Active = '-1' order by MI.[LName]"); (adding the Active part) ..it crashes. The "Active" part works fine elsewhere. The error this causes is:
  5. "Active" corresponds to a Y/N checkbox in the database. It works fine in other queries.
  6. Okay, this query works fine: where BoardName='Youth Advisory Board' and RepresentativeFor = 'City Staff Representative' But if I add another element: where BoardName='Youth Advisory Board' and RepresentativeFor = 'City Staff Representative' and Active = '-1' ...it crashes. The "Active = '-1'" part works fine in other queries. Is my syntax wrong when I go to three criterias in the WHERE statement?
  7. I've now eliminated Apache as the problem. If I hit a direct web path to the files, everything runs like a champ. I think it might be a weird bug in Joomla! itself.
  8. I see several errors in the Apache log that refer to not being able to map certain images. I can fix that by, if nothing else, using straight HTML code for the images instead of embedding the HTML code inside PHP. The website is currently on IIS. We're moving it to Apache on the same server using a Joomla! interface. PHP runs fine on Apache as long as there isn't a database connection. So why would the same connection statement fail if running on the same server?
  9. I'm helping to migrate a website from IIS to Apache (using Joomla). PHP runs fine, but the database connection is failing, even though the exact same connection statement works fine in the IIS (Windows) version. Is there a difference?
  10. Okay, let's say that my database result produces the number.... 423487.00 I can easily use substr() to give me "423," a comma, then "487.00" to produce... 423,487.00 But.... if the thousands position is under 100, like say 23,487.00, then it adds a number from somewhere. How do I directly plug the comma in there, putting it 6 positions from the right, regardless of what is before it?
  11. That's what I assumed, but I can't seem to find examples anywhere.
  12. There are a bazillion javascript dropdown menus out there and I'm going to be using one. My question is, how do I use a variable, selected by a Javascript dropdown, in a query? In specific, this will be for employee paystubs online. They'll select their pay period ending date from the menu, then the query will be ran using that date in the WHERE statement. Thanks!
  13. I figured it out. Thanks, everyone.
  14. Sorry I let this go for a while. I was off for a week. Anyway, here's the WHERE portion: WHERE ((M2.[EMPNO] = '".$_POST['empcode']."' and M2.[MSSNO] = '".$_POST['password']."') or (M2.[MSSNO] = '".$_SESSION['password']."' and M2.[EMPNO] = '".$_SESSION['empcode']."')) I want to only use the last four digits of M2.[MSSNO] by truncating it with substr().
  15. Thanks, but this crashes everything. The entire WHERE statement is: WHERE ((M2.[EMPNO] = '".$_POST['empcode']."' and M2.[MSSNO] = '".$_POST['password']."') or (M2.[MSSNO] = '".$_SESSION['password']."' and M2.[EMPNO] = '".$_SESSION['empcode']."'))
  16. I'm already using the substr() function (see above), but I'm having a very hard time using it in the query. Maybe it's a syntax problem. Basically, I want to say WHERE substr(M2.[MSSNO], -4) ...is equal to $_SESSION['password'] Have I missed something here or is the problem that I'm using the wrong syntax in the query?
  17. I'm writing an "employee information" application that allows employees to track accrued leave, benefits, etc.... I had been using their employee number as the username and SSN as the password. I've just been told that they want me to use just the last four of the SSN for security purposes. The database field has the entire SSN. I can use the following line... $lastfour = substr($_SESSION['password'], -4); // returns last four of password ... to truncate it to just the last four digits. But my question is, how do I incorporate $lastfour into the query? The WHERE part of the query is: WHERE ((M2.[EMPNO] = '".$_POST['empcode']."' and M2.[MSSNO] = '".$_POST['password']."') or (M2.[MSSNO] = '".$_SESSION['password']."' and M2.[EMPNO] = '".$_SESSION['empcode']."')) Since the $lastcode function uses the SSN as pulled from M2.[MSSNO], I'm assuming that it doesn't "exist" until after the query is ran. Or am I wrong about that? Cliffnotes: Instead of using the entire SSN from the database, I want to use the last four digits as determined by the $lastfour function.
  18. This line: echo "<img src=\"photos/$department/$filename\" width=120 height=160 border=5 bordercolor=blue>"; ....produces no image and the properties say: http://server/mainfolder/photos/Computer%20Services%20%20%20%20%20%20%20%20%20% Am I correct in assuming that the multiple "%20" entries at the end represent the remainder of the field? If so, how do I make it cut off after the last actual character? (I want the legitimate %20 spaces intact)
  19. Aaargh. See my user name. I just can't get it to work. Thanks anyway, everyone.
  20. The storage works like this: I open up an Access database (yeah, yeah, I know) with an MS SQL back end. I click on the image block and paste the image into it (after resizing, etc....), then save. Then, of course, the php code queries straight from the SQL. In your code posted above, would I need a connection statement on that page or is the connection statement on the page I call it from sufficient? And speaking of which, how do I call it? With an <IMG> tag?
  21. Here's the thing, guys, and maybe I didn't explain myself very well. Right now, I create a link to the employee's picture by using the first and last name from the database. For example, an employee named Fred Smith will have a link constructed that points to FredSmith.jpg and his picture will show. That's no problem. But the reason I had to resort to this method is because I couldn't pull the image straight out of the database and have it show properly. When it shows at all, it only shows ASCII garbage. I don't want to have to maintain a folder full of employee images and constantly make sure that each file name is exactly FirstnameLastname.jpg and that it matches the database exactly. Not only that, but when I take someone's picture and he tells me that his name is Tom Jones, I don't want to have to browse to his picture and rename it ThomasJones.jpg a week later when he tells me that it isn't showing. See what I mean? I want to know the proper, working method, once and for all, to pull a binary image from the database and have it show as a picture. Any help will be greatly appreciated. EDIT: In case anyone is wondering, yes, I have the GD Library installed and working properly.
  22. I never got this resolved some months ago, so I switched to using the First name and Last name from a database to construct a link to the images. This presents two problems (so far): 1. I have to keep these images in a folder and make sure that the file names match the first and last names from the database. 2. We have two employees with the exact same first and last names. No kidding. I've researched this a few times and it appears that I need two components for this to happen: one php file, like "image.php" or whatever that displays the image, and an <IMG> tag to point to this image.php file. But I still can't get anything but a red 'x' so far. Anyone know the correct way of doing this?
  23. Sorry to bump something so old, but this has reared its ugly head again. The code will read the file just fine except it doesn't recognize line breaks between paragraphs. The HTML <PRE> tag removes all word wrap and makes it stretch into the next county. I haven't had any luck with nl2br, either. I tried the.... file() .... array idea, but I can't make heads or tails of it.
×
×
  • 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.