Jump to content

dotolee

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dotolee's Achievements

Newbie

Newbie (1/5)

0

Reputation

  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
×
×
  • 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.