[PHP-DB] Erratic isset()
Hi Can anyone shed some light on this problem? The DB update only happens when I change the if(isset($submit)) to read if(!isset($submit)). Yes, I am using PHP 4.0.6 but have also tried with PHP 4.2.2, same problem. Code snippet: //HTML body ?php if(isset($Sumbit)): /* Connecting, selecting database */ $link = mysql_connect(192.168.0.100, sff_user, sff98) or die(Could not connect); print Connected successfully.br; mysql_select_db(sff) or die(Could not select database); $doit1 = INSERT INTO members VALUES(NULL,'$first_name','$last_name','$addr1', '$addr2','$postnummer','$postort','$land','$tel','$mob','$email','$memb_date ','$comments'); mysql_query($doit1); //put the data in members table printf (bDatabase updated./b Enter a new member?); /* Closing connection */ mysql_close($link); endif; ? //print HTML form etc... Simon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] transactions and persitent connections
I'm a little confused/worried about database transactions, persistent connections and PHP. I am worried that if I use persistent connections it might be possible for more than one PHP script to be inside the same transaction at the same time. For example: 1- page1.php is a script that opens a persistent connection to a DB and starts a transaction. 2- User 1 goes to page1.php 3- User 2 goes to page1.php My questions: 1- is it possible that user 2 will be using the same connection as user 1? So if user 1's transaction fails so will user 2's? 2- If user 1's hits the stop button on his browser, what happens to his transaction? I assume it is stopped. But what about the connection? If user 2 gets the same connection, will his transaction fail? Thanks, Jc -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] How to pass multiple checkbox values thru form??
I'm working on the same problem but I need to read the code, not write it:, here are a few links and my code if you might help me in return: http://www.experts-exchange.com/Web/Web_Languages/PHP/Q_20117420.html my code: mysql_db(); # connects to mysql for($i = 0; $i sizeof($check); $i++) { # echo $i; # echo 'p'; # $data = $check[$i]; $sql = (SELECT * FROM kodak_user_pictures WHERE ID = '$check[$i]'); $result = mysql_query($sql); $row = mysql_fetch_array($result); # $row = mysql_fetch_array($db_data); $db_ID = $row[ID]; $db_picture_name = $row[picture_name]; echo $db_ID; echo 'p'; echo $db_picture_name; echo 'p'; echo $ID; echo 'p'; echo $picture_name; echo 'p'; echo $result; } so many echoes because I'm trying to figure out what works and what doesn't. - Victor www.argilent.com -Original Message- From: Smita Manohar [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 12:19 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] How to pass multiple checkbox values thru form?? hii i have one form in which i print records from mysql database. while displyaing those records i display one checkbox with each record. i want the user should select the checkbox corresponding to the record which s/he wants to delete. i display those records after running one query. hence each time no.of records are diff. so its difficult to hard code names for check boxes. for name attribute in input type=checkbox tag, i define one array. having same name as the key field in the table. and value for which is also set dynamically. FORM NAME = act_qmd_subj_frm METHOD = POST ACTION = confirm_delete.php while ($row = mysql_fetch_array($result)) { .. echo tr; //call function to display the contents of $row in table print_entry($row,subj_id,subj_name,subj_desc); print td valign=top align=centerinput type=checkbox name=\subj_id[]\ value=\.$row[subj_id].\ Yes, delete entry #.$row[subj_id]./td\n; ... } INPUT TYPE=submit NAME=del_but VALUE=Delete nbsp nbsp INPUT TYPE=submit NAME=modify_but VALUE=Modify nbsp nbsp INPUT TYPE=reset NAME=clear_but VALUE=Clear nbsp nbsp /FORM when i submit the form to confirm_delete.php i run one code there to print the array subj_id[] which is supposed to contain values of the checkboxes which are selected to delete or to modify. but the array subj_id[] contains no value at all. echo count($subj_id) gives 0. is there any other way to pass multiple checkbox values from the form??? i got the above trick from the book MySQL/PHP Database Applications (By, Jay Grrenspan and Brad Bulger) in one script they have passed checkbox value thru array by this way, and its working fine. can anyone PLS figure out what wrong im doing??? thnx and regds, smita. _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Post your ad for free now! http://personals.yahoo.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ereg_replace
Could somebody explain to me how the ereg_replace function works? For as for as I understand it replaces strings by a different string (as explained on the php site) but what I don't understand is how the following line creates real links: $Content = ereg_replace([[:alpha:]]+://[^[:space:]]+[[:alnum:]/], a href=\\\0\ target=\_blank\\\0/a, $Content); How does this work? Where is the alpha, space, alnum and \\0 stuff come from? The main reason why I ask this is because I want to search in a string for strings like [QUOTE] and/or [/QUOTE] and replace these with html tags but for some reason it starts doing realy weird stuff :-) Cheers Prodoc -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] transactions and persitent connections
At 17:46 +0900 8/31/02, Jean-Christian Imbeault wrote: I'm a little confused/worried about database transactions, persistent connections and PHP. I am worried that if I use persistent connections it might be possible for more than one PHP script to be inside the same transaction at the same time. Not at the *same* time, because although a persistent connect might be used by more than one script, this will be serially rather than simultaneously. That does mean it's possible for a transaction to be started by one script and then either committed or rolled back by the next if they share a connection. This can happen if the first script fails to issue a COMMIT or ROLLBACK, perhaps by exiting early due to an error. If the second script comes along and commits or rolls back, that affects the queries issued by the first script. For example: 1- page1.php is a script that opens a persistent connection to a DB and starts a transaction. 2- User 1 goes to page1.php 3- User 2 goes to page1.php My questions: 1- is it possible that user 2 will be using the same connection as user 1? So if user 1's transaction fails so will user 2's? 2- If user 1's hits the stop button on his browser, what happens to his transaction? I assume it is stopped. But what about the connection? If user 2 No, the script won't have any idea the stop button has been pressed. It should have executed and completed its transaction regardless of what the user does. Perhaps you are thinking that user 1 visits the page and begins a transaction, and then visits it again to complete the transaction? That doesn't work. You have no guarantee that user 1 will get the same connection both times. (That is, don't try to spread a transaction out over multiple visits by a user.) gets the same connection, will his transaction fail? Thanks, Jc -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] newest entry in db
How can I use php to get the newest entry from mysql database? Ie, if I make a timestamp and then I want to retrieve the last timestamp I made how do I go about doing it? Any php or mysql documentation? - Victor www.argilent.com __ Post your ad for free now! http://personals.yahoo.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] newest entry in db
There might be a better way, but you can always do: Select * from table order by timestampfield desc limit 1 HTH, Jed On the threshold of genius, Victor wrote: How can I use php to get the newest entry from mysql database? Ie, if I make a timestamp and then I want to retrieve the last timestamp I made how do I go about doing it? Any php or mysql documentation? - Victor www.argilent.com __ Post your ad for free now! http://personals.yahoo.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] why do i get this error please tell me?
for($i = 0; $i sizeof($check); $i++) { # start repating query # turn pictures in order delete capability off mysql_query(UPDATE kodak_user_pictures SET order=1 WHERE ID='$check[$i]') # turn off pictures or die ('Unable to turn bit off '.mysql_error()); } # end repeat You have an error in your SQL syntax near 'order=1 WHERE ID='2'' at line 2 - Victor www.argilent.com __ Post your ad for free now! http://personals.yahoo.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: [PHP] why do i get this error please tell me?
Yep, figured it just now, thanks anyway, ahhh.. You'd thing they put reserved names right besides the damn mysql command in the manual. Alas it shall not be so. - Victor www.argilent.com -Original Message- From: Chris Knipe [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 31, 2002 1:30 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] why do i get this error please tell me? You have an error in your SQL syntax near 'order=1 WHERE ID='2'' at line 2 ORDER is a reserved word in MySQL. Change the query and escape order aswell 'order'='1' WHERE ID='2' Or, rename the order column to something else. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Post your free ad now! http://personals.yahoo.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: [PHP] why do i get this error please tell me?
Ahem. Why not check out the MySQL docs for reserved words (they _are_ right there ...): http://www.mysql.com/doc/en/Reserved_words.html PHP Docs are for PHP. MySQL Docs are for MySQL. PHP != MySQL. -Original Message- From: victor [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 31, 2002 1:35 PM To: 'Chris Knipe'; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] why do i get this error please tell me? Yep, figured it just now, thanks anyway, ahhh.. You'd thing they put reserved names right besides the damn mysql command in the manual. Alas it shall not be so. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] RE: [PHP] why do i get this error please tell me?
I meant besides the UPDATE or SELECT or any filed that those words might interfere with... - Victor www.argilent.com -Original Message- From: Mark Charette [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 31, 2002 2:18 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-DB] RE: [PHP] why do i get this error please tell me? Ahem. Why not check out the MySQL docs for reserved words (they _are_ right there ...): http://www.mysql.com/doc/en/Reserved_words.html PHP Docs are for PHP. MySQL Docs are for MySQL. PHP != MySQL. -Original Message- From: victor [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 31, 2002 1:35 PM To: 'Chris Knipe'; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] why do i get this error please tell me? Yep, figured it just now, thanks anyway, ahhh.. You'd thing they put reserved names right besides the damn mysql command in the manual. Alas it shall not be so. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Post your ad for free now! http://personals.yahoo.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: [PHP] RE: [PHP-DB] RE: [PHP] why do i get this error please tell me?
Then check the MySQL manual using the URL I posted! PHP doesn't care about the hundred or so reserved MySQL words. MySQL does. Perhaps you're confusing the two. Please check what I said: PHP != MySQL The documentation for each is separate. PHP has convenience functions for talking to a MySQL database. It does not parse or check your SQL statements for correctness - it just passes them along and lets the MySQL library do its work. PHP does this for a great number of products: cURL, GD functions, various ODBC interfaces, etc. It's up to you to read the support docs for those products to use them fully. The docs for PHP don't need to be cluttered with deep and detailed explanations of every supported interface, not would I expect them to. -Original Message- From: victor [mailto:[EMAIL PROTECTED]] I meant besides the UPDATE or SELECT or any filed that those words might interfere with... - Victor www.argilent.com -Original Message- From: Mark Charette [mailto:[EMAIL PROTECTED]] hem. Why not check out the MySQL docs for reserved words (they _are_ right there ...): http://www.mysql.com/doc/en/Reserved_words.html PHP Docs are for PHP. MySQL Docs are for MySQL. PHP != MySQL. -Original Message- From: victor [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 31, 2002 1:35 PM To: 'Chris Knipe'; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] why do i get this error please tell me? Yep, figured it just now, thanks anyway, ahhh.. You'd thing they put reserved names right besides the damn mysql command in the manual. Alas it shall not be so. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Wrapping problems
Hi, I've tried the solution you gave to be able to see the line breaks of a blob field of MySQL and it doesn't work. Sorry, I'm a newbie to PHP MySQL. Can you imagine why it's not formatting (eg. line breaks) the text? Thanks in advance. Jorge Ray Black III [EMAIL PROTECTED] escreveu na mensagem news:009c01bfcfce$1036c260$[EMAIL PROTECTED]... By the text's formatting I guess you mean line breaks? I can't imagine what else there is to format in straight text... Anyway, easy solution to this: echo nl2br($str); http://www.php.net/manual/function.nl2br.php -r3- - Original Message - From: Paul O' Connor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 06, 2000 11:33 AM Subject: [PHP-DB] Wrapping problems Hi, I'm using PHP and MySQL to develop a knowledge base at work. I'm kind of new to PHP. I have a problem in that users are asked to enter in a full description to the knowledge base via a textarea on a form. This info is then stored in a field of type text. My problem is in displaying this text field. The text that will be entered will be formatted, e.g. 1. Step 1 2. Step 2 3. Step 3 However, when I display the description (in a table) - the text looses it's formatting giving 1. Step 1 2. Step 2 3. Step3. I've tried to use the PRE tag in the table generated by my PHP code but that results in the table growing as wide as the longest line of text instead of wrapping within the confines of the table. I've tried specifing a % width on my generated table but this doesn't work either. Any clues? Paul O' Connor. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.384 / Virus Database: 216 - Release Date: 21-08-2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] transactions and persitent connections
Paul Dubois wrote: I am worried that if I use persistent connections it might be possible for more than one PHP script to be inside the same transaction at the same time. Not at the *same* time, because although a persistent connect might be used by more than one script, this will be serially rather than simultaneously. That does mean it's possible for a transaction to be started by one script and then either committed or rolled back by the next if they share a connection. That's exactly what I meant and feared. In a sense User 2 who is re-using User 1's connection would be in User 1's un-completed transaction. And the result of User 2's transaction (commit or rollback) would affect the first transaction. Yuck ... 2- If user 1's hits the stop button on his browser, what happens to his transaction? I assume it is stopped. But what about the connection? If user 2 No, the script won't have any idea the stop button has been pressed. It should have executed and completed its transaction regardless of what the user does. Really? I don't exactly know how PHP script execute but I though that is that the user goes to a page that starts a script and then closes the browser that causes the script to end prematurely. Am I wrong? Does the script go from start to finish even though the connection to the browser has been severed. I.e. The script will run complete even if there is output to the browser as the script is running? If the script goes from start to finish regardless of what the user does that would be nice. That way I am sure a transaction will go from start to finish, and if I make sure to either commit or rollback the transaction at the end of the script then I don't have to worry. Maybe the safest thing to do is not use persistent connections at all? Or in your opinion is there a safe way to use persistent connections and transactions? Jc PS Great book! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Configuring www.phpmyadmin/config.inc.php
Here is the code in config.inc.php $cfgServers[$i]['host'] = 'mydomain.com'; // MySQL hostname $cfgServers[$i]['port'] = ''; // MySQL port - leave blank for default port $cfgServers[$i]['socket']= ''; // Path to the socket - leave blank for default socket $cfgServers[$i]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket') $cfgServers[$i]['controluser'] = 'username'; // MySQL control user settings // (this user must have read-only $cfgServers[$i]['controlpass'] = 'password'; // access to the mysql/user // and mysql/db tables) $cfgServers[$i]['auth_type'] = 'config';// Authentication method (config, http or cookie based)? $cfgServers[$i]['user'] = ''; // MySQL user $cfgServers[$i]['password'] = ''; // MySQL password (only needed // with 'config' auth_type) $cfgServers[$i]['only_db'] = 'database_name'; // If set to a db-name, only // this db is displayed // at left frame Is controluser and control password the username and password of the domain? (ftp user/pass???) Is user and password the user and password of the Mysql database_name? Should config.inc.php be chmod 666 Russell Griechen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php