Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • Gender

Eiolon's Achievements

Advanced Member

Advanced Member (4/5)



  1. I am working on a calendar but am having difficulty finding a way to loop the events through the concatenation. Having it loop on the outside of the string brings only the first event for the day, not all of them. If I loop outside of the string of $week outputs all the events but it creates a new "day" square for each event. Thanks for your advice. for ($day = 1; $day <= $count_days; $day++, $str++) { $date = $year_month . '-' . $day; $sth_events = $dbh_mysql->prepare(" SELECT id, name, date_time FROM events WHERE date_time LIKE '$date%' "); $sth_events->execute(); while ($row_events = $sth_events->fetch(PDO::FETCH_ASSOC)) { $name = $row_events['name']; } if ($today == $date) { $week .= '<td>' . '<div class="today">' . $day . '</div>' . $name; } else { $week .= '<td>' . '<div class="day">' . $day . '</div>' . $name; } $week .= '</td>';
  2. Thanks for all your advice. I have done all you have suggested. The only error that returns is the Notice: Undefined variable: $LastActivityDate No connection errors reported and the company's database I am connecting to does see the server connect without a problem.
  3. I've been connecting to a database for a number of years now. The MSSQL server was updated the other day and it can no longer pull the data down. I connect with PHP PDO ODBC driver. The connection to the server is good, but nothing is returned. I can throw the query into my SQL client and bring up the data without a problem. Any ideas on what I can try? Here is a sample: <?php $HOSTNAME = ''; $DATABASE = 'db'; $USERNAME = 'user'; $PASSWORD = 'pass'; try { $dbh = new PDO("odbc:Driver={SQL Server};Server=$HOSTNAME;dbname=$DATABASE", "$USERNAME", "$PASSWORD"); array (PDO::ATTR_PERSISTENT => true); } catch (PDOException $e) { echo $e->getMessage(); } $Barcode = '37782555863'; $sth = $dbh->prepare(" SELECT LastActivityDate FROM Customers WHERE Barcode = :Barcode "); $sth->bindParam(':Barcode', $Barcode); $sth->execute(); while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { $LastActivityDate = $row['LastActivityDate']; } ?> <?php echo $LastActivityDate; ?>
  4. So I have a search form that has multiple fields. All the fields are optional, however, I want users to be able to narrow things down by entering some or all if desired. What I don't know how to do is exclude a field from the search query if nothing is entered. So the form is setup as: Subject: select Topic: text Title: text Year: select Location: text Type: text Current search query and PHP: $subject = $_GET['subject']; $topic = $_GET['topic']; $title = $_GET['title']; $year = $_GET['year']; $location = $_GET['location']; $type = $_GET['type']; $sth = $dbh->prepare(" SELECT * FROM periodic WHERE SUBJECT = :subject AND TOPIC = :topic AND TITLE = :title AND YEAR = :year AND LOCATION = :location AND TYPE = :type "); $sth->bindParam(':subject', $subject); $sth->bindParam(':topic', $topic); $sth->bindParam(':title', $title); $sth->bindParam(':year', $year); $sth->bindParam(':location', $location); $sth->bindParam(':type', $type); $sth->execute(); Obviously the initial query is requiring something in each field with the AND operator and unfortunately, unless the field actually is NULL any field left blank will throw off the results. Thanks for your pointers.
  5. I have submit buttons and they look identical in IE and Chrome but are rendering differently in Firefox. It looks like they are adding padding to it, even though I have a CSS reset and explicitly state the padding. Any ideas on how to force it to look like the IE/Chrome variants? It typically isn't a problem but when the button is next to a text field it isn't uniform with it like the other browsers. .button_submit { margin:0; padding:6px 12px 6px 12px; display:inline-block; border:solid 1px rgba(0,0,0,.05); border-radius:2px; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#FFFFFF; text-align:center; text-decoration:none; vertical-align:baseline; cursor:pointer; }
  6. I apologize if this is not the appropriate forum but it being MySQL related I'll post it here. I am interested in attempting to get certified in MySQL and am looking at the beginning test: http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=5001&get_params=p_exam_id:1Z0-870&p_org_id=&lang= Has anyone here taken this exam? I see the exam topics and am wondering how deep and complex it gets or if it's more surface material. Any examples of what to look for? Are questions adaptive? I have no formal training of MySQL but I've been using it daily for the last 5 years so I am just trying to judge if I stand a shot as it is or if I need to do some hard studying / labs. Thanks.
  7. Thanks for your help, I understand now.
  8. I am trying to generate a random 4 character alphanumeric code. For some reason my script is sometimes generating a 3 character code, though most the time it is doing a 4 character. Thanks for your help! <?php function randomCode() { $length = 4; $characters = '2345678ABCDEF'; $code= ''; for ($p = 0; $p < $length; $p++) { $code.= $characters[mt_rand(0, strlen($characters))]; } return $code; } echo randomCode($code); ?>
  9. I guess you could do a couple of approaches. 1. Host the login on your server. Make myproduct.theircompany.com forward to the login page. 2. Host the login on your server, but on myproduct.theircompany.com use an include for the login form. Looks like it is hosted on their server but in reality the form itself is included from your server. 3. Store session information in a database and use a custom session save handler.
  10. Turns out while I had installed Visual C++ Redistributable for Visual Studio 2010 SP1 for Apache, I still had to install Visual C++ Redistributable for Visual Studio 2008 SP1 for PHP. All is well now.
  11. Running: Windows Server 2008 R2 64-bit Apache 2.4.4 32-bit from Apache Lounge PHP 5.4.16 VC9 x86 Apache works fine until I add the following lines at the end of the httpd config file: LoadModule php5_module "c:/php/php5apache2_4.dll" AddHandler application/x-httpd-php .php PHPIniDir "C:/php" The module is located in the path. I have the Microsoft VS2010 Redistributable x86 installed. I have C:\PHP; added to the environmental variables in Windows. Error that occurs when starting the service: Cannot load C:/PHP/php5apache2_4.dll into server: The application has failed to start because its side-by-side configuration is incorrect.
  12. PHP probably has nothing to do with this, but I just want to make sure. I get the hostname of computers in our LAN on many occassions. However, sometimes it is read and displayed differently. I have not been able to determine what causes it. Using code: $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); I will get the hostname displayed as either: JOHNSPC or JOHNSPC.domain.tld It will randomly decide which one to display. I just wanted to make sure there is nothing I can do in PHP configuration to make sure it is consistantly read as one or the other. I know I can make it read only up to the period, which I may end up having to do.
  13. I need to connect to a database that happens to store the users' passwords in plain text. This is simply to authenticate them then the connection is closed. Is there anything that I can do when connecting, besides the usual validation and sanitization, to make it secure? I am thinking about doing SSL if that is possible but I am out of ideas. I do not have the ability to change their policy on plain text passwords.
  • 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.