Re: [PHP] Questions from a Newbie
Am Sonntag, den 17.10.2010, 01:00 -0400 schrieb Ethan Rosenberg: Dear List - Here are some questions, which I am sure are trivial, but I am a newbie, and cannot find the answers online I cannot get the following to work. In my Firefox [Iceweasel] browser, I enter the following URL: [w/ the http] localhost/CreateNew.php All I get is a blank browser screen. The code contained in the file CreateNew.php is: /* * Create Database test22 */ htmlbody ?php $cxn = mysqli_connect($host,$user,$password); echoCreate database test22; echoCreate table Names2 ( RecordNum Int(11) Primary Key Not null default=1 auto_increment, FirstName varchar(10), LastName varchar(10), Height decimal(4,1), Weight0 decimal(4,1), BMI decimal(3,1) Date0 date ); echo Create table Visit2 ( Indx Int(7) Primary Key Not null auto_increment, Weight decimal(4,1) not null, StudyDate date not null, RecordNum Int(11) ); $sql= SHOW DATABASES; ? /body/html If I search for test22 or Visit2, nothing is found. I would also like to be able to add data to a table, using PHP, which I can do in MySQL as: load data infile '/home/ethan/Databases/tester21.dat.' replace into table Names fields escaped by '\\' terminated by '\t' lines terminated by '\n' ; Thanks in advance. Ethan === Using Debian(sid) Hi, maybe you also want to take a look at PDO - http://php.net/pdo Regards Christian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using mysqli_stmt_bind_param in a class - with variable parameters?
Hi all, I would like to ask you if anyone of you ever did something like that or might tell me how to do this. I am currently switching from PHP4 to PHP5 and mySQL4 to mySQL5. On account of this, I would like to use the improvements of ext/mysqli instead of the old ext/mysql. So I need to do a rewrite on my database class and as of this, I would like to add new functions such as prepared statements, which are obviously supported by mysqli. In fact, I would like to write a method within my class like this: public function bindParam($str_types, $var_variable) { // Code $mysqli_stmt-bind_param($str_types, $var_variable); } This method is supposed to be called like this ($result is an object of that class) $result-bindParam(s, $username); $username = username; That does work out already, but I would like to add more parameters like this: $result-bind_param(, $username, $email, $me, $you); As I don't want to write a method with 50 optional parameters (I needed to add one if I were to use 51 variables), I would like to solve this problem dynamically. In fact, I tried to recall the bind_param method of mysqli_stmt several times, but I have to call it only once as PHP requires me to do this. (I get an error otherwise that the number of variables isn't fitting to the prepared statement) So I have to pass all parameters in one call. I also tried eval() but that didn't really work out, either. Now, my question is: What can I do to solve this problem? Is there any elegant way of doing this? Thanks in advance for any inspiration (and I hope I could make myself clear). Yours sincerely Christian Heinrich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Manual contradiction concerning string access?
Dear list, today, I read in a german PHP forum about a problem with accessing an offset of a string. For example, if you have a variable like $string = this is my string; and you want to access the third character at once, I would suggest to use $string{2} so this will return the i. The (german!) manual says about that: (http://de.php.net/manual/de/language.types.string.php#language.types.string.substr) *Anmerkung: * Für Abwärtskompatibilität können Sie für den selben Zweck immer noch die Array-Klammern verwenden. Diese Syntax wird jedoch seit PHP 4 missbilligt. (Translation:) *Note: *For downwards compatibility you may use the array brackets as well. But as of PHP 4, this syntax is deprecated. The english manual says: (Link: http://de.php.net/manual/en/language.types.string.php#language.types.string.substr ) *Note: * They may also be accessed using braces like $str{42} for the same purpose. However, using square array-brackets is preferred because the {braces} style is deprecated as of PHP 6. I'm a little bit confused by now. Which style should I pick? I use PHP 4 and 5. Is there any other difference? It would be great if someone could solve that contradiction within the manual, too. Thanks in advance. Sincere regards Christian Heinrich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ChangeLog PHP 5.2.0 - Fileupload
Hey all, I've just examined the latest Change-Log for Version 5.2.0 (see http://www.php.net/ChangeLog-5.php for details). Seems to be fine, but I couldn't figure out one point. The changelog talks about Added RFC1867 fileupload processing hook. (Stefan E.) and I actually don't know what is meant by that. I've looked up that RFC but it appears to me to be about multipart/form-data only. I confess that I haven't read it completly, but it didn't really seem to be talking about what I wanted to know. So, could anyone be so kind to explain me what is meant by that and what its used for? Thanks in advance. Greetings from Germany Yours sincerely Christian Heinrich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] User question for PHP
try suPHP :-) Is it possible to have a PHP script execute as the user of the domain instead of the webserver? So when I upload files through a PHP script they are owned by me and not wwwrun or nobody? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail and hotmail
Hi Peter, RFC 2156 (http://www.faqs.org/rfcs/rfc2156.html) defines the importance header as following: importance = low / normal / high Which means that you can either use the values low, normal or high HTH, Christian The only one I do not know what to set it to is Importance. What values are possible there? Is it the same as for X-priority? Regards, Peter -Original Message- From: Angelo Zanetti [mailto:[EMAIL PROTECTED] Sent: Thursday, May 04, 2006 5:53 PM To: Peter Lauri Cc: php-general@lists.php.net Subject: Re: [PHP] Mail and hotmail Peter Lauri wrote: Best group member, I am sending email to a hotmail thru PHP. When I send it like this it arrives (in the junk mail, but it arrives): mail('[EMAIL PROTECTED]', 'A nice subject', 'Some text'); It works well, but I want to change the FROM header so I do this: mail('[EMAIL PROTECTED]', 'A nice subject', 'Some text', 'From: Peter Lauri [EMAIL PROTECTED]'); This email does not arrive to the Hotmail inbox. If I send to a regular email, like Google Email (gmail) or a regular POP3 it arrives without problems. Anyone who has experienced this problem with sending emails to Hotmail? And how do you solve it? Best regards, Peter Lauri you need to set your mail headers for the mail to be assumed valid, namely: X-Sender From Date Subject Delivered-to MIME-Version Reply-To Content-type X-Priority Importance Return-Path X-Mailer HTH Angelo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] security while building online store
Hi, most probably, things like XSS (Cross-Site-Scripting) and SQL-Injections might lead to a successfull hacking-attempt. If you try to write your own online store, make sure that you do NOT use register_globals! Try to google for XSS and SQL-Injections, there might be plenty of information on the web. Good night-wishes from Germany Christian Hi, I was checking on several php/mysql based on line store, free and commercial, but didn't find any that fits the best for us. Looks like, it would be the best to develop one. To make a online store that works fine - it shouldn't be such a big problem. To make a SECURE ad SAFE online store - that's the tough one form me. Before I even start building the store, can somebody point usual traps and problems, and security problems that usually happen, some advices, any advices? Thanks for any help! -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using require
Hi, this depends on which connection-function you've used. If you've decided to use pg_pconnect(), there is just one connection. If you use pg_connect, everytime a new connection is established (and after finishing the script, it's closed though) HTH Christian hi all, i have my web site working something like this: in every php script i have require(auth.php). this auth.php has my connection to my postgresql server and database along with some other stuff i need for the user to be authenticated to my web site. when i log on, this auth.php connects to the dbserver and checks if my username and password are stored and then i go to a home page. my connection is stored in $dbh. what happens when i start moving through all these web pages (php scripts), each requires auth.php, with respect to the connection? is a new connection established for every web page i go into that uses my $dbh for querying purposes or is it the same connection i originally made when i first logged into the web site? any info will be highly appreciated!! thanx. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] NEWBIE: Can't Get My Loop Going. . .
Hello Jack, you simply forgot an echo. ?php echo join(); ? Also, have a look at print_r, which is very very useful for debugging. Greetings from Germany, Christian Jackson Linux schrieb: Hello all, I am a newbie trying to build a set of links to content in a db. I am connecting with the db and seeing the proper number of rows. if I echo out the values of $id and $sidebar I see that they take on the id# and text of the last entry in the database. I'm trying to make the script get each of the rows, until there are no more, and echo out the info I need for each row. Please can someone tell me where I'm going wrong? (the variables spelling out the db connection information are in a prepend file, and work.) Thanks in advance, Jack ?php $conn = mysql_connect($dbserver, $dbusername, $dbpassword); if (!$conn) { echo Unable to connect to DB: . mysql_error(); exit; } if (!mysql_select_db($dbname)) { echo Unable to select mydbname: . mysql_error(); exit; } $sql = SELECT * FROM sidebar ; $sidebar = array(); $result = mysql_query($sql); if (!empty($result)) { while ($sidebar = mysql_fetch_assoc($result)) { $id = $sidebar['sidebar_id']; $linktext = $sidebar['headline']; /* Build sidebar.*/ $left_sidebar[] = li class='menu-item'- a class='sidebar-link' href='{$_SERVER['PHP_SELF']}?s={$id}' title=\{$linktext}\{$linktext}/a/li; } } else {} mysql_free_result($result); ? htmlbody ul?php join(\n\n, $left_sidebar); ?/ul /body/html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best Server OS
I prefer Debian 3.1 .. Everyones taste is quite different, so I suggest to install some test-installations of those different OS - and you have the choice. Christian Phil Neeb schrieb: I'm lookin for some opinions on this one ... What do you think the best OS is for running a server with PHP and MySQL? If you're going to say Linux, please, which Linux OS, there are so many. Gracias, Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql query update two table in one?
Tyler Replogle schrieb: Can you update two tables in one mysql query i've got these two queries $db-query(update `dbn_members_counters` set views =(views +1) where id = '$this-id' ); $db-query(update `dbn_members` set lastaction = $conf-site_time, page = '$this-page' where id = '$this-id' ); and i was wonder if i could get them into one because there are right next two each other and i'm trying to lower my query count. Yes, you can do that. BUT you need mySQL 4.0 for this! Use a JOIN. Have a look at: http://dev.mysql.com/doc/mysql/en/update.html Best regards, Christian From: K Karthik [EMAIL PROTECTED] To: php-general@lists.php.net Subject: [PHP] php-help Date: Thu, 10 Mar 2005 12:31:35 +0530 MIME-Version: 1.0 Received: from mc7-f40.hotmail.com ([65.54.253.47]) by IMC3-S26.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 9 Mar 2005 22:59:41 -0800 Received: from lists.php.net ([216.92.131.4]) by mc7-f40.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 9 Mar 2005 22:59:41 -0800 Received: from ([216.92.131.4:25901] helo=lists.php.net)by pb1.pair.com (ecelerity HEAD r(5124)) with SMTPid E8/F4-53294-F40FF224 for [EMAIL PROTECTED]; Thu, 10 Mar 2005 01:59:30 -0500 Received: (qmail 17042 invoked by uid 1010); 10 Mar 2005 06:58:09 - Received: (qmail 17024 invoked by uid 1010); 10 Mar 2005 06:58:09 - X-Message-Info: JGTYoYF78jFevGptXBXjGwKBSvHljkD+bF1qvT/FEkQ= Return-Path: [EMAIL PROTECTED] X-Host-Fingerprint: 216.92.131.4 lists.php.net Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Precedence: bulk list-help: mailto:[EMAIL PROTECTED] list-unsubscribe: mailto:[EMAIL PROTECTED] list-post: mailto:php-general@lists.php.net Delivered-To: mailing list php-general@lists.php.net Delivered-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] X-Host-Fingerprint: 203.193.155.110 alps.manageengine.org Linux 2.4/2.6 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913 X-Accept-Language: en-us, en X-OriginalArrivalTime: 10 Mar 2005 06:59:41.0597 (UTC) FILETIME=[BBA044D0:01C5253E] sir, i'll explain my problem.and if anyone could help me i'll be thankful. i am displaying a content read from a file into a text area of a form. when i make changes andretrieve back in the text area, i encounter a problem.. i.e., when i enter text=please enter i have an outputas text= / please enter/ thanks, kkarthik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php