Jump to content

dotolee

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Everything posted by dotolee

  1. ChristianF - Thanks for the response. I just want to say that I realize it might be frustrating to reply to folks who don't do their homework. Having said that, I did take your suggestion and I read up on the function as I mentioned in my post. I reviewed their telephone example and had additional questions. Sometimes, its not that people are being lazy by just asking questions. They may have actually tried to do their homework but need an additional explanation, and hence decide to post a question.
  2. I chnaged the code to read: echo 'starting regex test<BR>'; $data = "c799 1 000ffe-fcc811 1 000ffe-fcc86f 1 000ffe-fcc898 1 000ffe-fcc92d 1 000ffe-fcc934 1 000ffe-fcc965 1 000ffe-fcc96b"; $pattern="/([a-f0-9]){6}-([a-fa-f0-9]){6}$/i"; echo "the pattern we are using is:".$pattern."<BR>"; if (preg_match_all($pattern,$data,$matches, PREG_SET_ORDER)) { //echo 'Matches we found:'. print_r($matches, true); print_r($matches[0][0]); echo"<BR>"; print_r($matches[0][1]); } else { echo "No, the mac address is wrong"; } And this is the output i'm seeing on the webpage: starting regex test the pattern we are using is:/([a-f0-9]){6}-([a-fa-f0-9]){6}$/i 000ffe-fcc96b e I guess i don't understand why it's printing the "e"? I've tried reviewing the documentation found here: http://ca2.php.net/manual/en/function.preg-match-all.php and i do understand the results i get with their telephone example... Is there any way i can get a count of the number of matches it found? Thanks
  3. Hi there. I have the following php code: <?php echo 'starting regex test<BR>'; $data = "c799 1 000ffe-fcc811 1 000ffe-fcc86f 1 000ffe-fcc898 1 000ffe-fcc92d 1 000ffe-fcc934 1 000ffe-fcc965 1 000ffe-fcc96b"; $pattern="/([a-fA-F0-9]){6}-([a-fa-fA-F0-9]){6}$/i"; echo "the pattern we are using is:".$pattern."<BR>"; if (preg_match($pattern,$data)) { $matches = preg_match($pattern,$data, $matches); echo 'Matches we found:'. print_r($matches, true); } else { echo "No, the mac address is wrong"; } ?> I'm just wondering why it only finds one match.... also, what is the proper way to define a hex value in regular expressions? thank you.
  4. You don't As per usual w3schools have published a terrible example of PHP. Javascript adds elements directly to the DOM. You won't see it in a normal "view source". Use a more robust tool like Firebug or Chrome's dev tools. so what is the proper way to send a response back to the calling page? or do you just write straight html as you normally would..
  5. hi there. i'm following an example found here: http://www.w3schools.com/php/php_ajax_database.asp in their example, the page that gets the new data from the database returns a table. so here are my questions. why do we need to "echo" the results back? also, when i do a view source on my main page, i don't see the latest values that get gnereated by the ajax code. i see the table values that initially display when i open the main page. is this correct? again, is this because the echo?
  6. hi there. can someone tell me how to get this to print out the real minutes instead of the month? echo date("M-d-Y H:m:s", mktime()); i've read http://www.sqlite.org/lang_datefunc.html but i can't seem to get it to work.
  7. ok i will double check when i get a chance. thanks.
  8. i stepped out of the office so i don't have access to the code. but i can tell you that i think i am passing more than just one string from the database because from the caller, the first thing i do is take a count of the number of elements in the array, and it always matches the count from the database. and then the foreach loop prints the last item in the array 235 times (the count(myarray); value)
  9. hi there. i have a class that queries my db, creates an array objects representing a collection of the items returned. when i pass the array back to the caller and then try to loop through the array, it keeps displaying the same record - i think it's the last record that is displayed however, when i try the same code in the class, it prints out each unique record. i tried doing a reset(myarray); on the caller but that dind't work either. any suggestions? here's the code to loop through the array: if ( count( $myarray ) > 0 ) { //reset($lineItem_array); foreach ( $myarray as $lineitem ) { echo($lineitem->getName()."~"); echo($lineItem->getOId()."~"); echo($lineItem->getProduct()."~"); echo($lineItem->getPIP()."~"); echo($lineItem->getQuantity()."~"); } } } }
  10. definitions page includes variable declarations such as the one in question: define('LOG_ERRORS', true);
  11. Hi. I can't figure out why I'm getting a bunch of notices about using undefined constants when i try to load my login page. Here's one of the error messages: ( ! ) Notice: Use of undefined constant LOG_ERRORS - assumed 'LOG_ERRORS' in C:\wamp\www\pr\ssys\Errors.php on line 90 Line 90 in errors.php looks like: if (LOG_ERRORS) { $error_log = 'Date :'.date('Y-m-d H:i:s'); In my login page, the includes look like this: include_once (BASE_PATH.'includes/definitions.php'); As a test, I've included an echo statement at the end of my include to see if it prints. It does, but only after a few "notices" about undefined constants. can someone point me in the right direction? this is a web site that is working in production as is... i'm just tyring to set it up in my local environment to work on some additional code.
  12. oh.. one other question... so is it the "?" embedded in the middle that separates these two lines of code? what is this "?" called? i'd like to do some more reading on it if possible. thanks.
  13. Hey! Thank you very much for the quick reply. So basically, it sounds like the "second" part of the line of code is just initializing the variable to false to start. Thanks for the example of the "ms" variable. That part I do understand - I guess I just didn't use the right lingo. but i do understand that it's a var saved /passed in the querystring. Thanks again.
  14. Hi there. I'm a newbie to PHP. I've run across a line of code that I don't quite understand. Hopefully this is a remedial question. Here's the line of code: $mymess = isset($_GET['ms'])?$_GET['ms']:false; it looks it's trying to get a string from the querystring / URL called "ms" and save it to a new variable called mymess IF it's not null. But i don't quite get the "second" part of the line from the "?" on. Does it save a "false" value to the mymess if isset is false? I'm using the PHP manual i downloaded from the php site but I haven't been able to find the answer .. thanks.
  15. Contents of the include: (just HTML) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <head> <title>test</title> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" /> </head> <BODY bgcolor="#FFFFFF" text="#404040" link="#0000FF" vlink="#990099" MARGINWIDTH="1" MARGINHEIGHT="1" TOPMARGIN="1" LEFTMARGIN="1" RIGHTMARGIN="1"> <link type="text/css" href="style/menu.css" rel="stylesheet"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td><img src="images/logo.jpg" width="400" height="200" align="left"></td> <!--<td> </td>--> <td COLSPAN="2"> </td> </tr> <tr bgcolor="#738EAD" height="2%"> <!--#336699; 006699 --> <td colspan="3" valign="middle" align="right" valign="center"> <div class="toc"><font color="#E0E0E0"> <A HREF="For_ResearchersStudents.php"><font color="#FFFFFF">For Researchers & Students</font></A> | <A HREF="aboutus.php"><font color="#FFFFFF">About Us</font></A> | </div> </td> </tr> <tr><td colspan="2" align="center"> </td></tr> </table> <!-- style sheets --> <link href="css/gencontent.css" rel="stylesheet" type="text/css" /> <link href="css/layoutmap.css" rel="stylesheet" type="text/css" /> <link href="css/menu.css" rel="stylesheet" type="text/css" /> The includes are in the same folder and the calling page. thx
  16. Hi there. i've created a simple test page that only has the following; <? include 'header.inc'; ?> <p> This is a default site template.</p> <? include 'footer.inc'; ?> This file has been named as simple.php. when I navigate to it, the stuff in the main page shows, but the header is ignored. can you tell me where I'm going wrong? thanks.
  17. So i started to follow some step by step configuration tutorial online and i managed to mess things up. now when i navigate to "http://localhost" it doesn't display my treasured "it works" message. (so sad) The error message I'm getting is that I'm not authorized to view the page. As a test, i tried using 127.0.0.1 instead but I get the same message. When I run httpd.exe, this is the output i get: C:\Program Files\Apache Software Foundation\Apache2.2\bin>httpd Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host.phub.net.cable.rogers.com] does not exist Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.phub.net.cable.rogers.com] does not exist httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName [Wed Apr 30 08:52:43 2008] [warn] _default_ VirtualHost overlap on port 80, the first has precedence [Wed Apr 30 08:52:43 2008] [warn] NameVirtualHost *:80 has no VirtualHosts (OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0 :80 no listening sockets available, shutting down Unable to open logs When I initially installed apache, it detected my ISP provider (rogers) and my IP settings etc and I just accepted all defaults. I don't really need to connect directly from my box to the LIVE production URL ... I just need localhost to work. What I'm trying to accomplish is the following: create a development environment on my box where i can create HTML / PHP files with server side includes. Once the site is working, i will manually copy the files over to a server that has already been set up for me by the IT folks in the office. Thanks for the help.
  18. So i started to follow some step by step configuration tutorial online and i managed to mess things up. now when i navigate to "http://localhost" it doesn't display my treasured "it works" message. (so sad) The error message I'm getting is that I'm not authorized to view the page. As a test, i tried using 127.0.0.1 instead but I get the same message. When I run httpd.exe, this is the output i get: C:\Program Files\Apache Software Foundation\Apache2.2\bin>httpd Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host.phub.net.cable.rogers.com] does not exist Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.phub.net.cable.rogers.com] does not exist httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName [Wed Apr 30 08:52:43 2008] [warn] _default_ VirtualHost overlap on port 80, the first has precedence [Wed Apr 30 08:52:43 2008] [warn] NameVirtualHost *:80 has no VirtualHosts (OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0 :80 no listening sockets available, shutting down Unable to open logs When I initially installed apache, it detected my ISP provider (rogers) and my IP settings etc and I just accepted all defaults. I don't really need to connect directly from my box to the LIVE production URL ... I just need localhost to work. What I'm trying to accomplish is the following: create a development environment on my box where i can create HTML / PHP files with server side includes. Once the site is working, i will manually copy the files over to a server that has already been set up for me by the IT folks in the office. Since installing apache initially, I've added a directory listing to my httpd.conf file, which may also be the cause of the problem. My changes include: <directory "c:/webprojects/*/"> allowoverride none addtype text/html .shtml options followsymlinks +includes order allow,deny allow from all addoutputfilter INCLUDES;DEFLATE shtml </directory> I also changed the directory index to include .shtml and .php by modifying my <IfModule dir_module> section to look like: <IfModule dir_module> directoryIndex index.html index.shtml index.php </IfModule> Finally in the <IfModule mime_module>, I uncommented the last two lines : addtype text/html .shtml AddOutputFilter INCLUDES .shtml Sorry for being so verbose. Just want to provide as much background information as possible to save time. Cheers.
  19. Hi there. I'm a newbie to apache... I just installed the web server and it seems to work in that when I run the test : http://localhost/ i get the page that displays: 'It works!" what I'm wondering is how the directory structure works. with iis, using the GUI, I can create new virtual folders and drop in HTML / ASP pages and I'm off. But I can't find where this "It works!" page is coming from. Also, can you recommend a good web site that has tutorials for me? 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.