Hi All
I need a little help with regular expressions. So far I have managed to
split the text/number value such as "url1" into its two components "url"
and "1" using the following code (fieldname is gathered from a previous
page which is "url$id")
<?php
// create a string
$string = $_GET['fieldname'];
// match any character that is not a number between 0 and 9
preg_match_all("/[^0-9]/", $string, $text);
preg_match_all("/[^a-z]/", $string, $number);
// loop through the matches with foreach
foreach($text[0] as $tvalue)
{
echo $tvalue;
}
foreach($number[0] as $nvalue)
{
echo $nvalue;
}
?>
I now get the info echoed onto the page, so all seems fine. basically my
problem lies when trying to update a database with this info.
I need to update a table row that is called "url" where the id is "$id".
I know the ID from the regex. i have tried a few connotations of the
regex, not echoing the info and just storing them in a variable, but the
script fails to update the DB
can anyone help point me in the right direction?
TIA
Mark Mckee