Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. i guess without strrev and strstr, this will work <?php #$subject = "http://www.server.com/dir/dir2/dir3/file.html"; $subject = "myname@domain.com"; $result = eregi_replace('(.*@).*', '\\1', $subject); $result = eregi_replace('(.*\\/)(.*)[^\\/]+$', '\\1', $result); echo "$result<br />"; ?> Please note i am still learning eregi so am use them when i can, so this was kinda pratice for me
  2. i did attempt to but am getting no where, infact some of my selects still fails..
  3. Not sure if it can be done, but i thought i'll check.. OK RegEx can be used with SELECT Statments on MySQL but Can i use it to UPDATE (something like PREG_REPLACE) i have searched around and don't think its supported but i am not 100% sure.. OK my System Config: PHP Version 5.2.1 MySQL Client API version 4.1.22 posix Revision $Revision: 1.70.2.3.2.12 $ If anymore System Info is needed just ask.. any info will help Thanks in advance --MadTechie
  4. erm... OK try @$this->conn =& @MDB2::connect($dsn, $upc); :-\
  5. Solved is on the bottom left, if its not their i won't worry (if its not you find you can't edit your first post either!
  6. Can you please click solved
  7. trying to call a function that doesn't exist can you post session.php ?
  8. i don't know what cart.php or bulkview.php are! i assume if ($_POST['submit5']) { $_SESSION['test']="abc"; } else { $_SESSION['test']="222"; } is in cart.php! in which case you should of changed it to print_r($_POST); if ($_POST['submit5']) { $_SESSION['test']="abc"; } else { $_SESSION['test']="222"; }
  9. just before the if ($_POST['submit5']) { it should say Array(), then click the submit button whats it say now ?
  10. Same same..
  11. whats the results of print_r($_POST);
  12. {$_POST[$k]['quantity']}
  13. <?php foreach($_POST['Product'] as $k => $p) ?> $_POST['Product'] = array $k = Key $p = value is if $_POST['Product'] = array(0 => "123", 1 => "234", 2 => "345") then on the first loop $k = 0 $p = "123" 2nd loop $k=1 $p= "234" etc
  14. Ahh messed up their i read it as If it has "NSC" anywhere in the string "$metar" then do blar blar .. thanxs for point that out paul2463 Ok revised code <?php #$subject = "METAR = EGSC 230850Z 22008KT 150V260 8000 NSC 13/10 Q1019"; //test1 #$subject = "METAR = EGSC 230850Z 22008KT 150V260 8000 NSC M13/10 Q1019"; //test2 #$subject = "METAR = EGSC 230850Z 22008KT 150V260 8000 13/10 Q1019"; //test3 $subject = "METAR = EGSC 230850Z 22008KT 150V260 8000 03/10 Q1019"; //test4 if (strpos($subject, 'NSC')) { $display = "Clear Skies<br />"; } if (preg_match('/(\\w+)\/.*Q(\\w+)/', $subject, $regs)) { $temp = preg_replace("/[Mm]/","-",(int)$regs[1]."C"); $display .= "avg. temperature $temp<br />pressure {$regs[2]} millibars"; } else { $display = "nothing found"; } echo $display; ?> of couse i am using the / to find them but without more example this is the best i can do.. as a note i could just use a word delimitor but this works just as well
  15. or thorpe could write one in 0.2 of a second for you
  16. your welcome good luck and happy coding
  17. i have created my own script which does basically what i think your after if you paste it into its own file and test it you might be able to use parts, as a note i used an array instead of a SQL statement <?php if( isset($_POST['submit']) ) { $body = ""; foreach($_POST['Product'] as $k => $p) { $body .= "$p | {$_POST['quantity'][$k]}\n"; } echo nl2br($body); // of course don't use nl2br on the mail }else{ ?> <form method="post"> <?php $item = array("fish", "chips", "Beans", "i missed lunch"); $q = array("1", "65", "1002", "lol"); foreach($item as $k => $p) { ?> <input type="text" value="<?php echo $p ?>" name="Product[]"><br /> <input type="text" size="4" maxlength="4" value="<?php echo $q[$k] ?>" name="quantity[]"><br /> <br /> <?php } ?> <input name="submit" type="submit" value="SendMail" /> </form> <?php } ?>
  18. please post your form code
  19. please use [ code] tags <?php $row = mysql_fetch_array($result) or die(mysql_error()); ?> is correct but you need to set the $first_name & $last_name so for example just say the field name of the first name is first and the field name for the last name is last change <?php $row = mysql_fetch_array($result) or die(mysql_error()); $_SESSION['username'] = $username; $_SESSION['fName'] = $first_name; $_SESSION['lName'] = $last_name; ?> to <?php $row = mysql_fetch_array($result) or die(mysql_error()); $_SESSION['username'] = $username; $_SESSION['fName'] = $row['first']; $_SESSION['lName'] = $row['last']; ?> *note doesn't it look nicer and easier to read in code tags
  20. its a bit of a mess, why don't you search the quickcode ?
  21. why won't this work ? <?php foreach ($_POST['quantity'] as $k => $q) { echo "{$_POST['quantity'][$k]} | $q<br>"; } ?> <input type="text" size="10" maxlength="10" value="mice" name="product[]"> <input type="text" size="4" maxlength="4" value="1" name="quantity[]">
  22. erm.. the echo is always hello so i am confused.. maybe a switch.. ???
  23. with forms if your using the same field more than once use this <input type="text" size="4" maxlength="4" value="1" name="quantity[]"> then <?php foreach ($_POST['quantity'] as $q) { echo "$q<br>"; } ?> hope that helps EDIT: Ahhh Frost!!! beat me
  24. $_SESSION['username'] = $username; should work as for $_SESSION['fName'] = $first_name; $_SESSION['lName'] = $last_name; you need to fetch the data from the database
  25. as a entension to thorpe post and the mycorpserver.net accepts mail from other domails (if php isn't on the same domain)
×
×
  • 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.