Jump to content

Eiolon

Members
  • Posts

    358
  • Joined

  • Last visited

Everything posted by Eiolon

  1. The error: The query: // Query the database for topic information. $query_topic = "SELECT *, DATE_FORMAT(topic_date, '%M %e, %Y at %l:%i %p') as convdate FROM topics WHERE topic_id = ".$_GET['topic_id'].""; $topic = mysql_query($query_topic) OR die ('Cannot retrieve topic information.'); $row_topic = mysql_fetch_array($topic); The code: <?php echo nlbr2($row_topic['topic_body']) ?> Am I not using nlbr2 correctly? I tried doing it this way and got the same error: $message = nlbr2($row_topic['topic_body']) Then I echoed $message. Thanks for your help!
  2. I've been using DATETIME to store my dates and times in MySQL. Is there any reason why I should use TIMESTAMP over it besides it being 4 bytes compared to 8 bytes?
  3. Ah, I understand now. Thanks for that, works perfect
  4. I am having problems repeating in the "Availability" column. The result which goes in the column is done in the math below the query so its not in the recordset. How would I get this information to repeat? Currently, it lists the same value as the first record called "Test Program". I have attached a photo to make it a little clearer. Thanks! <?php # /programs/index.php // Connect to the MySQL server and database. require_once('../mysql_connect.php'); // Query the database for user information. $query_programs = "SELECT program_id, program_name, DATE_FORMAT(program_date, '%M %e, %Y at %l:%i %p') as convdate, program_coordinator, program_seats, program_registered FROM programs"; $programs = mysql_query($query_programs) OR die ('Cannot retrieve program information.'); $row_programs = mysql_fetch_array($programs); $number1 = $row_programs['program_seats']; $number2 = $row_programs['program_registered']; $seats = $number1 - $number2; // Close the database connection. mysql_close(); ?> <table width="100%" border="0" cellspacing="1" cellpadding="6" bgcolor="#CCCCCC"> <tr bgcolor="#E5E5E5"> <td><strong>Program</strong></td> <td><strong>Date & Time</strong></td> <td><strong>Availability</strong></td> <td><strong>Coordinator</strong></td> </tr> <?php do { ?> <tr bgcolor="#FFFFFF"> <td><a href="program.php?program_id=<?php echo $row_programs['program_id'] ?>"><?php echo $row_programs['program_name'] ?></a> </td> <td><?php echo $row_programs['convdate'] ?></td> <td><?php echo $seats ?> seats remaining</td> <td><?php echo $row_programs['program_coordinator'] ?></td> </tr> <?php } while ($row_programs = mysql_fetch_array($programs)); ?> </table>
  5. I currently use a date/time chooser that was made in javascript. The user clicks on the picture of a calendar and selects the date and time. It then puts the data into the text field of the form. My question, is there a way to disable the text field so the user HAS to use the date/time chooser to enter the data into the field? It's very important that the datetime format is kept so I don't want them entering it in their own format. Thanks!
  6. Thanks, I can't believe I overlooked aliasing. Works like a charm
  7. The information is displayed correctly. The problem comes into play with the record id's. The link I would click on for the employees name is echoing the job id and not the employee id so I get sent to the job page and not the employee profile. The link I would click on for the job is echoing fine. Thanks! I have tried various joins and I have tried employee.php?id=<?php echo $r_emp['e.id']; ?> instead of employee.php?id=<?php echo $r_emp['id']; ?> Any suggestions? <?php # department.php require_once('mysql_connect.php'); $q_emp = "SELECT e.id, e.first_name, e.last_name, e.job_id, j.id, j.title FROM employees e INNER JOIN jobs j ON (e.job_id = j.id) WHERE department_id = 4 ORDER BY last_name ASC"; $emp = mysql_query($q_emp) OR die ('Could not query employee information.'); $r_emp = mysql_fetch_array($emp); ?> <table width="100%" border="0" cellspacing="1" cellpadding="6" bgcolor="#CCCCCC"> <tr bgcolor="#E5E5E5"> <td><strong>Employee</strong> </td> <td><strong>Job Title</strong></td> </tr> <?php do { ?> <tr bgcolor="#FFFFFF"> <td><a href="employee.php?id=<?php echo $r_emp['id']; ?>"><?php echo $r_emp['last_name']; ?>, <?php echo $r_emp['first_name']; ?></a></td> <td><a href="job.php?id=<?php echo $r_emp['id']; ?>"><?php echo $r_emp['title']; ?></a></td> </tr> <?php } while ($r_emp = mysql_fetch_array($emp)); ?> </table>
  8. For my site, I am trying to find a way to make member profiles viewable by typing the domain/username. So instead of: http://www.mydomain.com/profile.php?id=15 I would use: http://www.mydomain.com/username Any tutorials on how to do this available? Thanks!
  9. I am creating a forum and I am trying to show how many threads have been created in each forum. With my current code, it's giving me the total threads for ALL forums. On top of that, each forum is getting the same result. Any help would be appreciated. <?php # forums/index.php // Connect to the MySQL server and database. require_once ('../mysql_connect.php'); // Query database for forum information. $query_forums = "SELECT * FROM forums"; $result_forums = mysql_query ($query_forums) OR die ('Cannot execute the query.'); $row_forums = mysql_fetch_assoc ($result_forums); $totalposts = mysql_num_rows ($result_forums); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Forums</title> </head> <body> <table width="100%" border="0" cellspacing="1" cellpadding="6" bgcolor="#CCCCCC"> <tr bgcolor="#E5E5E5"> <td>Forum</td> <td>Posts</td> <td>Last Post</td> </tr> <?php do { ?> <tr bgcolor="#FFFFFF"> <td><a href="view_forum.php?forum_id=<?php echo $row_forums['forum_id']; ?>"><?php echo $row_forums['forum_name']; ?></a></td> <td><?php echo $totalposts ?></td> <td></td> </tr> <?php } while ($row_forums = mysql_fetch_assoc ($result_forums)); ?> </table> </body> </html>
  10. I am running on a Windows box but using Apache instead of IIS (not sure if that matters). Thanks for the info, though. I've been searching for awhile on how to do this but can't find anyone who has done it yet.
  11. This is an internal project I am working on. I know that the NetBIOS cannot be routed outside the LAN but it can go through routers and switches so I am hoping this can be accomplished via PHP. Any ways, as the subject says, I'd like to log the name of the computer instead of the IP address if possible. Thanks in advance for your help!
  12. Here is what I am trying to do: When a user logs in, a session variable is passed. The variable is the users ID. If the variable is passed successfully, they are logged in and I want to query the users information based on the session variable. <?php # main.php // Start the session. session_start(); // Check for the session value. if (isset($_SESSION['id'])) { // Query database for user information. $query = "SELECT username, firstname, lastname FROM users WHERE id = '.$_SESSION['id'].'"; $result = mysql_query ($query) OR die ('Cannot execute the query.'); $auth = mysql_fetch_array ($result); } else { // Quit the script and redirect to login page. header ("Location: http://" . $_SERVER['HTTP_HOST'] . dirname ($_SERVER['PHP_SELF']) . "index.php"); exit(); } ?> Here is the error I am receiving: I can get this to work if I create and pass a variable for each piece of user info during the login process but I thought it would be easier to pass the users ID and just query their info from there. Thanks for your help!
  13. Hello, I have an ordering system. When someone submits an order request it sends an e-mail to the purchasers which contains the item information and a link to manage the order our intranet site. The problem is the link is just a general like such as http://intranet/orders What I would like to do is link directly to the item record itself. Is it possible to include a direct link to the record in the e-mail? Thanks.
  14. So I take it this cannot be done with PHP? I was reading on a solution using Javascript but it appears it only works in IE.
  15. Hi all. I am wanting to disable a check box when another one is checked. Here is a screenshot of what I am trying to do. Basically, if the registration fee box is checked I want the online registration box to be disabled (because participants can't pay online from the website). Thanks!
  16. Yes, that's exactly what I needed. I'll begin with that. Thanks!
  17. Hello, I know how to insert a date by filling in a field but I don't know how to do it using a drop down menu. One menu being month, another the day and the last the year. Any code snipplets I can disect and play with or tutorials on this?
  18. I created a login script that uses sessions but I am wondering if I am using the right approach. Right now, if a session is valid, the user can see the secured page. If not they are redirected to the login page. This is the code for the secured page. <?php # main.php // Start the session. session_start(); // Check for the session value. if (isset($_SESSION['username'])) { echo '<p>Welcome back, '.$_SESSION['username'].'.</p>'; } else { // Quit the script and redirect to login page. header ("Location: http://" . $_SERVER['HTTP_HOST'] . dirname ($_SERVER['PHP_SELF']) . "login.php"); exit(); } ?> So as you can see, the session is the user's username. That works for what it does but lets say I want to pull more data from the user over to this page, such as their permissions, personal info, etc. Should I be passing that info through as sessions? Or how about, instead of the username, should I be passing the users id through then on the secured page query for data based on the user id? Thanks for your help and I hope this I could explain it clearly for you to understand.
  19. Here is a quick run down on what you need to do: 1. Create a page that queries and lists all the sold items (example: sold_items.php) 2. The receipt link that is clicked on, use a variation of the following: receipt.php?id=<?php echo $row_items['item_id']; ?> 3. Create a page that queries the database and selects the info that matches the item_id in the above link (receipt.php) It really is one of the more basic aspects of PHP and you can probably find dozens of tutorials to grab the code from.
  20. I want to resize the command-line window and want to know if it is possible. If I maximize it, the window only fills half the screen. Is there a way to configure it so it fills the entire screen? I want to run it in 1680x1050 if possible. Thanks!
  21. My company uses a proxy server so my server status script only works internally. I can't check the status of a server on the Internet because of this. Is there a script (paid even) that allows me to go through the proxy server to see an external server? Thanks!
  22. This is what I have in my secured page called main.php and works fine: <?php # main.php // Start the session. session_start(); // Check for the session value. if (isset($_SESSION['username'])) { echo '<p>Welcome back, '.$_SESSION['username'].'.</p>'; } else { // Quit the script and redirect to login page. header ("Location: http://" . $_SERVER['HTTP_HOST'] . dirname ($_SERVER['PHP_SELF']) . "login.php"); exit(); } ?>
  23. I am not sure if this is a PHP or a MySQL question so you can move it if need be. I've created an inhouse help desk for my work. It works well but it's inconvenient for people to fill out a form with their name, email and problem. A request was made to simply send an email from their mail client to an address (i.e. helpdesk@domain.com) and have it initiate the ticket. So here's my question: is there anything like this on the net that I could use as an example? I have no idea where to start with a request like this or if its even possible to do. Thanks!
×
×
  • 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.