php-general Digest 28 May 2006 04:53:57 -0000 Issue 4152
Topics (messages 236998 through 237014):
Re: Fatal error: Call to undefined function mysql_create_db()
236998 by: Peter Lauri
236999 by: Duncan Hill
237000 by: Mark Sargent
237001 by: Mark Sargent
237013 by: Daevid Vincent
problems with regex
237002 by: Merlin
237004 by: cajbecu
237005 by: Dave Goodchild
237006 by: Jochem Maas
237007 by: Merlin
Re: Including Functions; one file or many?
237003 by: Jochem Maas
237008 by: tedd
237012 by: Martin Alterisio
Re: Why does this preg_replace function not work?
237009 by: Dave M G
Re: Embedding PHP 5 in a C application
237010 by: Gonzalo Monzón
[NOT PHP] good javascript list?
237011 by: tedd
237014 by: Paul Novitski
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
php-general@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
Have you created a connection to the Server with the correct permissions?
-----Original Message-----
From: Mark Sargent [mailto:[EMAIL PROTECTED]
Sent: Saturday, May 27, 2006 5:03 PM
To: PHP List
Subject: [PHP] Fatal error: Call to undefined function mysql_create_db()
Hi All,
I get the following,
*Fatal error*: Call to undefined function mysql_create_db() in
*/usr/local/apache2/htdocs/createmovie.php* on line 6
for this code,
5 //create the moviesite database
6 mysql_create_db("moviesite") or die(mysql_error());
which is from a tutorial in the book I'm using. Any pointers? Code looks
identical to the book's. Cheers.
P.S. I also tried this,
mysql_create_db("moviesite", $connect) or die(mysql_error());
and
mysql_create_db("moviesite", "$connect") or die(mysql_error());
Mark Sargent.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Sat, May 27, 2006 11:02, Mark Sargent wrote:
> Hi All,
>
>
> I get the following,
>
>
> *Fatal error*: Call to undefined function mysql_create_db() in
> */usr/local/apache2/htdocs/createmovie.php* on line 6
Sounds like you don't have the MySQL component of PHP installed. If
you're using the packaged version for your OS (of PHP), check that you
installed the php-mysql package (your package manager should let you
search for it).
If you're using a self-compiled PHP, sounds like you didn't compile in
MySQL(i) support.
--- End Message ---
--- Begin Message ---
Peter Lauri wrote:
Have you created a connection to the Server with the correct permissions?
Hi All,
sorry, meant to post that too,
1 <?php
2 //connect to MySQL
3 $connect=mysql_connect("localhost", "root", "password omitted") or
die("Hey, check your server connection.");
I get no error for that line. Cheers.
Mark Sargent.
--- End Message ---
--- Begin Message ---
Mark Sargent wrote:
Peter Lauri wrote:
Have you created a connection to the Server with the correct
permissions?
Hi All,
sorry, meant to post that too,
1 <?php
2 //connect to MySQL
3 $connect=mysql_connect("localhost", "root", "password omitted") or
die("Hey, check your server connection.");
I get no error for that line. Cheers.
Hi All,
seems that I was using a deprecated function. Cheers.
Mark Sargent.
--- End Message ---
--- Begin Message ---
//[dv] depricated
//http://us2.php.net/manual/en/function.mysql-create-db.php
//return mysql_create_db($name, $db);
//[dv] this is not a good way to do this, as it doesn't tell you if
it succeeded or not.
//return mysql_query("CREATE DATABASE IF NOT EXISTS ".$name);
//this returns error 1007 if it exists already
return mysql_query("CREATE DATABASE ".$name);
> -----Original Message-----
> From: Mark Sargent [mailto:[EMAIL PROTECTED]
> Sent: Saturday, May 27, 2006 3:03 AM
> To: PHP List
> Subject: [PHP] Fatal error: Call to undefined function
> mysql_create_db()
>
> Hi All,
>
> I get the following,
>
> *Fatal error*: Call to undefined function mysql_create_db() in
> */usr/local/apache2/htdocs/createmovie.php* on line 6
>
> for this code,
>
> 5 //create the moviesite database
> 6 mysql_create_db("moviesite") or die(mysql_error());
>
> which is from a tutorial in the book I'm using. Any pointers?
> Code looks
> identical to the book's. Cheers.
>
> P.S. I also tried this,
>
> mysql_create_db("moviesite", $connect) or die(mysql_error());
>
> and
>
> mysql_create_db("moviesite", "$connect") or die(mysql_error());
>
> Mark Sargent.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Hi there,
I am somehow lost when it comes to regex. I am trying to remove ! and ?
characters from a string. Could somebody please help me to get a working
regex running for that?
I tried: $str = preg_replace('/\!\?\./', ' ', $str);
Thank you for any help,
Merlin
--- End Message ---
--- Begin Message ---
Merlin wrote:
> Hi there,
>
> I am somehow lost when it comes to regex. I am trying to remove ! and ?
> characters from a string. Could somebody please help me to get a working
> regex running for that?
>
> I tried: $str = preg_replace('/\!\?\./', ' ', $str);
>
> Thank you for any help,
>
> Merlin
>
try
$str = str_replace("?"," ",$str);
$str = str_replace("!"," ",$str);
:)
--- End Message ---
--- Begin Message ---
On 27/05/06, Merlin <[EMAIL PROTECTED]> wrote:
Hi there,
I am somehow lost when it comes to regex. I am trying to remove ! and ?
characters from a string. Could somebody please help me to get a working
regex running for that?
I tried: $str = preg_replace('/\!\?\./', ' ', $str);
How about $str = preg_replace('/(\!|\?)+/', $str);
--
http://www.web-buddha.co.uk
dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css)
look out for project karma, our new venture, coming soon!
--- End Message ---
--- Begin Message ---
Merlin wrote:
Hi there,
I am somehow lost when it comes to regex. I am trying to remove ! and ?
characters from a string. Could somebody please help me to get a working
regex running for that?
I tried: $str = preg_replace('/\!\?\./', ' ', $str);
$s = "?!help!?";
echo "--",$s,"--",preg_replace("#[\\!\\?]#", "", $s),"--\n";
notice I use double quotes (because it means I can test the code on the command
line) and therefore I'm escaping the backslashes. basically you need to add
the square brackets around the chars in question in order to say 'any one of
these
chars'....
<quote from="http://php.net/manual/en/reference.pcre.pattern.syntax.php">
[
start character class definition
]
end character class definition
</quote>
Thank you for any help,
Merlin
--- End Message ---
--- Begin Message ---
thank you, that worked excellent!
Merlin
Dave Goodchild schrieb:
On 27/05/06, Merlin <[EMAIL PROTECTED]> wrote:
Hi there,
I am somehow lost when it comes to regex. I am trying to remove ! and ?
characters from a string. Could somebody please help me to get a working
regex running for that?
I tried: $str = preg_replace('/\!\?\./', ' ', $str);
How about $str = preg_replace('/(\!|\?)+/', $str);
--- End Message ---
--- Begin Message ---
tedd wrote:
> Name them .inc.php so that they cannot be opened by a webbrowser, thus
> giving more information to a potential attacker.
As always, there's another side to that augment. If you give them the
.php suffix, then they can be ran via a browser "as-is" , which may not
be something you want. Need to consider if running your includes will do
any harm.
there are 2 strategies I use to combat this potential problem:
1. include files don't contain any code that runs on it's own, which comes down
to constant, variable, function or classes definitions only.
2. any include file that does contain code that runs on inclusion contains
something
like the following as the first line of code:
if (!defined('MY_APP_IS_SETUP')) die('try http://'.$SERVER['SERVER_NAME'].'/');
tedd
--- End Message ---
--- Begin Message ---
At 4:01 PM +0200 5/27/06, Jochem Maas wrote:
tedd wrote:
> Name them .inc.php so that they cannot be opened by a webbrowser, thus
> giving more information to a potential attacker.
As always, there's another side to that augment. If you give them
the .php suffix, then they can be ran via a browser "as-is" , which
may not be something you want. Need to consider if running your
includes will do any harm.
there are 2 strategies I use to combat this potential problem:
1. include files don't contain any code that runs on it's own, which
comes down
to constant, variable, function or classes definitions only.
2. any include file that does contain code that runs on inclusion
contains something
like the following as the first line of code:
if (!defined('MY_APP_IS_SETUP')) die('try
http://'.$SERVER['SERVER_NAME'].'/');
tedd
Jochem:
Good strategies. I usually use number 1, but didn't consider the other.
Thanks.
tedd
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
2006/5/27, Jochem Maas <[EMAIL PROTECTED]>:
2. any include file that does contain code that runs on inclusion contains
something
like the following as the first line of code:
if (!defined('MY_APP_IS_SETUP')) die('try
http://'.$SERVER['SERVER_NAME'].'/');
An enhancement to this strategy could be using an error header to prevent
exposing the internal structure of your site:
if (!defined('MY_APP_IS_SETUP')) {
header("Status: 404 Not Found");
die;
}
--- End Message ---
--- Begin Message ---
Robin, Dan, Rabin,
Thank you all for your advice. You've helped me understand regular
expressions a little better, and cleared some some confusion about arrays.
I'll be adapting all the code you provided for me needs.
Thank you for taking the time to help.
--
Dave M G
--- End Message ---
--- Begin Message ---
Hi,
I think you can start here:
http://wildphp.free.fr/wiki/doku.php?id=howto:embeding_a_php_source_into_a_windows_executable_file
Regards,
Gonzalo
Adam Zey escribió:
D. Dante Lorenso wrote:
All,
Can anybody give me a pointer on where I might start to learn how to
embed Zend2/PHP 5 inside a stand-alone C application?
I realize that by asking a question like this it might imply I am not
prepared enough to do handle the answer, but ignoring that, is there
a document out there?
I guess I could start hacking Apache or something, but I was hoping
for more of a tutorial/hand-holding article on the basics.
Dante
Are you sure that you can't get away with just calling the PHP
executable from your C program to do any PHP related activity?
Regards, Adam Zey.
--- End Message ---
--- Begin Message ---
Hi gang:
I'm looking for a recommendation for a good javascript list like this
list is for php -- does anyone have any recommendations?
Thanks in advance for any replies.
tedd
PS: I know that I can Google "javascript <whatever>", but I'm looking
for recommendations.
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
At 11:37 AM 5/27/2006, tedd wrote:
I'm looking for a recommendation for a good javascript list like
this list is for php -- does anyone have any recommendations?
I've been on the LA Tech javascript list the last few years and find
the quality of discussion usually high (and with much less irrelevant
noise than, say, this list suffers):
https://lists.LaTech.edu/mailman/listinfo/javascript
Paul
--- End Message ---