[PHP-DB] Extracting the essence!
Hi ppl!
I want to strip html sites from the tags, only leaving the data from a entity.
The info i would like to insert into a mysql table.
Have tried to use the following code with various $dokument variables, but it dont
preform as expected.
http://localhost/php/index.html";);
$search = array ("']*?>.*?'si",
"']*?>.*?'si",
"'<[\/\!]*?[^<>]*?>'si",
"'([\r\n])[\s]+'",
"'&(quot|#34);'i",
"'&(amp|#38);'i",
"'&(lt|#60);'i",
"'&(gt|#62);'i",
"'&(nbsp|#160);'i",
"'&(iexcl|#161);'i",
"'&(cent|#162);'i",
"'&(pound|#163);'i",
"'&(copy|#169);'i",
"'(\d+);'e");
$replace = array ("",
"",
"\\1",
"\"",
"&",
"<",
">",
" ",
chr(161),
chr(162),
chr(163),
chr(169)
//,chr(\\1)
);
$test= preg_replace ($search, $replace, $dokument);
echo $test;
php?>
The output of this script comes as:
Array
Stan
Re: [PHP-DB] Extracting the essence!
Tanks so far, but if I want don't want to display the 1st and 4th line.
- Original Message -
From: "Lisi" <[EMAIL PROTECTED]>
To: "#Linux" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Sunday, April 14, 2002 10:55 PM
Subject: Re: [PHP-DB] Extracting the essence!
>
> >Try something like the following to extract the contents of the array by
> >looping through it:
>
> >$test= preg_replace ($search, $replace, $dokument);
>
> while (list ($key, $val) = each($test)) {
> echo $key = $val;
> }
>
> HTH
>
> -Lisi
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Extracting the essence!
Hi All.
Thanx Lisi, it worked.
But more to come.
Have modified the code but, cant get the output i want.
$test= preg_replace ($search, $replace, $dokument);
while (list ($key, $val) = each($test)) {
if ($key <= "5" || $key == "6") {
//do nothing
} else {
echo $key = $val[1],$val[2],$val[3],$val[4], " " ,$val[5];
echo " ";
}
}
Want to display the parsed tabel enteries in diferent ways. The table have
dynamic updates and different lengths
so I can't use the $val[x].
eg. one line reads before parsed:
1Dont want this entery to show.
test1test1 want to truncate this to the
5 first letters
test2show this
93 show the sum 9+3
68-33 show the sum 68-33
test3 show this
Regards
Stan
- Original Message -
From: "#Linux" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Lisi" <[EMAIL PROTECTED]>
Sent: Sunday, April 14, 2002 11:24 PM
Subject: Re: [PHP-DB] Extracting the essence!
> Tanks so far, but if I want don't want to display the 1st and 4th line.
>
>
> - Original Message -
> From: "Lisi" <[EMAIL PROTECTED]>
> To: "#Linux" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Sunday, April 14, 2002 10:55 PM
> Subject: Re: [PHP-DB] Extracting the essence!
>
>
> >
> > >Try something like the following to extract the contents of the array
by
> > >looping through it:
> >
> > >$test= preg_replace ($search, $replace, $dokument);
> >
> > while (list ($key, $val) = each($test)) {
> > echo $key = $val;
> > }
> >
> > HTH
> >
> > -Lisi
> >
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Problem with script
Hi all, greetings from Phoenix, Arizona!
I'm having a problem with a PHP script and the database it manages.
I'm having his error message:
Query failed: You have an error in your SQL syntax. Check the manual that
corresponds to your MySQL server version for the right syntax to use near
't read card','1099413551')' at line 1
I don't know what is happening, usually the database works well but
sometimes this strange error appears. I'm sending you the scripts in where
I think the error could be.
Any suggestion or comment will be very appreciated.
Thanks
Renatoquery($query);
$query2 = "SELECT contact_id FROM ".$tbl_prefix."contact WHERE
contact_name = '".$_POST['contacto']."'";
$result2 = $myDB->query($query2);
while ($row = mysql_fetch_assoc($result2))
{
$contact_id = $row['contact_id'];
}
$query3 = "INSERT INTO ".$tbl_prefix."tmp (contact_id, order_brand,
order_model, order_serialnumber, order_identification, order_description, order_date,
session_id) ";
$query3 .= "VALUES
('".$contact_id."','".$_POST['marca']."','".$_POST['modelo']."','".$_POST['nserie']."','".$_POST['identificacion']."','".$_POST['descripcion']."','".time()."','".$_GET['session_id']."')";
$result3 = $myDB->query($query3);
$mylocation = "rma.php?page=form.php&new=yes";
print "\n";
print "window.location=\"".$mylocation."\";\n";
print "\n";
}
elseif ($_GET['new'] == "yes")
{
$query = "SELECT contact_id FROM ".$tbl_prefix."contact WHERE
session_id = '".$_GET['session_id']."'";
$result = $myDB->query($query);
while ($row = mysql_fetch_assoc($result))
{
$contact_id = $row['contact_id'];
}
$query2 = "INSERT INTO ".$tbl_prefix."tmp (contact_id, order_brand,
order_model, order_serialnumber, order_description, order_date, session_id) ";
$query2 .= "VALUES
('".$contact_id."','".$_POST['marca']."','".$_POST['modelo']."','".$_POST['nserie']."','".$_POST['descripcion']."','".time()."','".$_GET['session_id']."')";
$result2 = $myDB->query($query2);
$mylocation = "rma.php?page=form.php&new=yes";
print "\n";
print "window.location=\"".$mylocation."\";\n";
print "\n";
}
?>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Your details
See the attached file for details -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] $db=new mysqli fails while $db=mysqli_connect succeeds in PHP/MySQL 5
From a php-general thread earlier: generates: Fatal error: Call to undefined function new mysqli() in index.php on line 24 while '; ?> generates success: conn good: Object id #1 :very good indeed The book I'm working with (PHP & MySQL Web Dev, Welling/Thompson) specifically defines the 'new mysqli' syntax. So I'm guessing I don't have something configured right? Whil -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] $db=new mysqli fails while $db=mysqli_connect succeeds in PHP/MySQL 5
The book I'm working with (PHP & MySQL Web Dev, Welling/Thompson) specifically defines the 'new mysqli' syntax. So I'm guessing I don't have something configured right? If one works the other should too. Your code here looks fine according to the manual (http://www.php.net/manual/en/function.mysqli-connect.php) - can you send us exactly what you have? OK, here's what I've got, cut and pasted directly out of the script: ' ); ?> 1. If I comment out the $db and echo $db lines, the next two lines, $conn and echo $conn generate the following: Today is... Monday, August 27th 2007. $conn is:Object id #1: 2. If I remove the $db and echo $db comments, I get the following: Today is... Monday, August 27th 2007. Fatal error: Call to undefined function new mysqli() in index_listtest.php on line 17 I'm soo puzzled. :) Whil -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] $db=new mysqli fails while $db=mysqli_connect succeeds in PHP/MySQL 5
Goltsios Theodore wrote: Well if you are in the unix case then you should check if your php supports mysqli :-) . In either case unix or not you could use phpinfo: Oh, sorry, I thought I posted this before. Looks like I didn't. I'm pretty sure it supports mysqli: './configure' '--prefix=/usr/local/php5' '--with-config-file-path=/usr/local/etc/php5/cgi' '--with-xml' '--enable-bcmath' '--enable-calendar' '--with-curl' '--with-dom' '--with-dom-xslt' '--with-dom-exslt' '--enable-exif' '--with-swf=/usr/local/flash' '--enable-ftp' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr' '--with-xpm-dir=/usr/X11R6' '--with-gettext' '--with-imap=/usr/local/imap-2004g' '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-mcrypt' '--with-mhash' '--enable-magic-quotes' '--with-mysqli' '--with-mysql=/usr' '--with-openssl' '--enable-discard-path' '--with-pear' '--with-pspell' '--enable-sockets' '--enable-track-vars' '--with-ttf' '--with-freetype-dir=/usr' '--enable-gd-native-ttf' '--with-zip' '--with-zlib' The 'mysqli_connect(...' call works, just not 'new mysqli(...' If mysqli wasn't supported, then both would fail, right? Whil This will show a lot useful information about what your web server and your php can or cannot do. Linux NG/Lists wrote: The book I'm working with (PHP & MySQL Web Dev, Welling/Thompson) specifically defines the 'new mysqli' syntax. So I'm guessing I don't have something configured right? If one works the other should too. Your code here looks fine according to the manual (http://www.php.net/manual/en/function.mysqli-connect.php) - can you send us exactly what you have? OK, here's what I've got, cut and pasted directly out of the script: ' ); ?> 1. If I comment out the $db and echo $db lines, the next two lines, $conn and echo $conn generate the following: Today is... Monday, August 27th 2007. $conn is:Object id #1: 2. If I remove the $db and echo $db comments, I get the following: Today is... Monday, August 27th 2007. Fatal error: Call to undefined function new mysqli() in index_listtest.php on line 17 I'm soo puzzled. :) Whil -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL ENCRYPT help!
To the PHP Database Mailing-List:
I joined the mailing list for this one question I just can't figure
out. I used the phpMyAdmin to create table. I placed one row in this table, I
used the ENCRYPT function. How do I De-Crypt the data I just encrypted to use
in my PHP code. I encrypted it, for security.
If it's not a bother, can you also give a sniplet of example code, on
just the part of de-crypting it, I know everything about connecting, and
displaying, it's just the de-crypting I am having trouble with.
--
Thanks,
Kevin the Linux User
"Linux! Working together, we build it BETTER!"
-- Quote from book, "The Joy of Linux"/2001
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
