[PHP] Generating mysql statement from php return an error :-(
Hi, I'm using a table in my session to store my variable to generate later my sql statements. Until now... nothing very weird ! But when I want to generate my sql statement. I've got an error after the first line where I put a comma " ; " to make a difference within my statements. this is a portion of my code : $query.="Insert into product (id_quote,item,description,quantity,unit_price,ext_price,lead) values ('$QUOTE_NUMBER' , '".$TABLE_QUOTE_PRODUCT[$y]["item"]."' , '".$TABLE_QUOTE_PRODUCT[$y]["description"]."', '".$TABLE_QUOTE_PRODUCT[$y]["qty"]."' , '".$TABLE_QUOTE_PRODUCT[$y]["unitprice"]."' , '".$TABLE_QUOTE_PRODUCT[$y]["extprice"]."' , '".$TABLE_QUOTE_PRODUCT[$y]["leadtime"]."');\n"; } $result=mysql_query($query); If I have only one line in my sql and I remove the ; it works. but If I add the ; to separate two sql lines error ! Any idea how I can resolve this problem ? Regards, Jacques -- PHP General 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]
[PHP] Re: HTTP header question.
"Ben Bleything" <[EMAIL PROTECTED]> wrote in message 01c11891$447271c0$0201a8c0@allegro">news:01c11891$447271c0$0201a8c0@allegro... > Hey all, > > I want to craft a header such that it seems to the page that data has > been POST'ed to it... Here's the situation: I'm writing a login page to > my application, and if they log in incorrectly, I want the page to > redisplay, but I want it to throw out an error message. I'm currently > doing it by > > header("Location: login.php?failure=true"); > > but I'd like to make it transparent. Any ideas? > > Thanks, > Ben You cannot send ANY text or html tag (even a space ) before usin header function. If you have to get something displayed. I suggest to use then : echo ""; Regards, Jacques -- PHP General 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]
[PHP] how to access to session variable without
I'm using php4 with session I have a session variable $TABLE[1]=100; $TABLE[2]=150; $TABLE[3]=200; My problem is I have a mysql database where I pull out data and put them into the the session variable With these data, I want to generate a graph. if I access to a different page (or link) through I can see the content of $TABLE. No problem then. whereas if I use , I cannot have $TABLE content. it's empty. Does someone know a way a have the content within the page. Basically, I don't want to send the values of my data in the url such as I will appreciate any help. Thanks a lot, Jacques -- PHP General 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]
[PHP] Re: how to access to session variable without
"Richard Lynch" <[EMAIL PROTECTED]> wrote > What is SID in graph.php? Cuz it should work... This is the main problem. Can find out why it's not working. SID is the session ID -- PHP General 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]
[PHP] who's on-line application - php
I would like to indicate the particulars (from a MySQL database) of all those users that are currently on-line (those whom have successfully signed in). How should I go about achieving this? Does it have something to do with Sessions? I am developing in PHP. Regards Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Undefined function - mysql_connect() - php5?
I have installed PHP5 on IIS. When I try to make a connection the the MySQL database with the following code: $conn = mysql_connect("localhost", "root", "") or die("Unable to connect"); I get the following error in the browser: Undefined function my_sqlconnect(). What can be the problem? I uninstalled PHP5 and installed PHP4 and then I can make a connection without any problems... Please shed some light anyone!! Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with SQL statement
How can I determine which users have signed in and are still on-line during the first minute after they have signed in? My sql statement currently reads: SELECT * FROM tblusers WHERE usignedin = "yes" AND utimesignedin = (time() - 60) Hoe does one indicate seconds in a SQL statement? Can I use the time() function or should I use the now() function rather? Thanks Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Destroying the Session Object
I am developing an application. When the user signs in a Session ID is created (for argument sake: 123). I have a sign out page that has the script session_destroy() on it. This page directs me to the sign in page. When I sign the same or any other user in again I get the same session id (123). However, when I close the browser window and sign in again as any member, the session id changes. How does this work and how can I ensure that a unique session id is allocated to every new user that signs in? Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions and cookies
When a session object is created - where is it store? (Perhaps on the application server - IIS or Appatche?) Or on a cookking on a user's computer? To destroy the session object (widht all session vairables inside the particluar session object) can I use session_destroy(); What is also the default life span of a session object? and can this bechanged? Reagrds Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Formatting e-mail using mail()
Can I format an e-mail message with html tags inside the mail() function? If not, how can I go about it? I would like to format the layout of the e-mail message using tables, colors and perhaps images. Regards - Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Capturing user's IP Address
Which function can I use to capture a user's IP Address when he registers on my site. I would like to store this value in a database. Regards Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Server includes and Absolute URL
Can make use of an absolute URL when using require() or require_once()? Regards Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Identifying a user who previously created a profile
How can I ensure that a user is prevented from creating a second profile after he has registered a second time with different registration details? I thought of capturing his IP Address and checking this value against my users table in my database where I have captured IP Addresses of users who have previously registered. Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session time out
What is the life time of a PHP session object (variable)? Which conditional test can I perform to check if the session object has timed out? Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session time out
Is session time measured in seconds or minutes? Regards Jacques "Jacques" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > What is the life time of a PHP session object (variable)? Which > conditional test can I perform to check if the session object has timed > out? > > Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Drop down list - persistant value
I am using PHP. I have a registration page where the user has to select his country form a drop down list. If the username that the user selected for himself exists in the database I am sending him back to the registration form with all the fields completed with the values he previously entered. This is easy to do for a textfield but how do I indicate on the drop down list which country he originally selected? Please help. Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL statement - date
How should I formulate my sql statement to create a result set of members who registered between now and 7 days ago? I have tried the following and it is obviously incorrect: $sqlnewmembers = "Select uid, uprofilename from tblusers where udatereg between (date() and date() - 7)"; Regards Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL statement - please help
Dear all Please, I realy need your help. I am trying to extract only those records that were entered during the past hour from my MySQL database. The following SQL statement extracts all the records. As soon as I change the INTERVAL to 1 HOUR I see all the records in my database. When I change CURDATE() to CURTIME() no records are extracted from the database. The cgtimeposted field is a time data type. Please advise me as to how I can formulate my SQL statement so that only those records entered within the past hour displays on my page. Here is my current SQL statement - this statement displays all the records: $sql = "Select tblchatglobal.cgid, tblchatglobal.cgdateposted, tblchatglobal.cgtimeposted, tblchatglobal.uid, tblchatglobal.cgmsg, tblusers.uid, tblusers.uusername from tblchatglobal, tblusers where (tblchatglobal.uid = tblusers.uid) and (DATE_SUB(CURDATE(),INTERVAL 1 HOUR) <= tblchatglobal.cgtimeposted) order by tblchatglobal.cgtimeposted desc"; Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Destroying the Session Object
How can I destroy the session object for a particular user when that user leaves my web site without properly signing out? Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] header("Location: page.php target=_parent")?????
How should I formulate the header function to replace the current frameset page with a new one? I have tried a combination of header("Location: page.php target=_parent"); but I get an error message saying the page does not exist. Also, can I save a frameset page with a .php extension? I have tried it out and it seems to work. Maybe perhaps I should not do this as there may be some implications later on??? Regards Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] what are {} used for in php?
I have often seen php code included inside braces. What does this mean or do? Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Connecting to MySQL Sever using PHP5
I have just installed PHP5. I am using Windows XP and have already installed MySQL. When I try and make a connection to a database on MySQL via Dreamweaver I get the following error message: "An unidentified error has occurred". What could be wrong and how can I fix this problem? Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Putting Form Variables / URL Parameters in to an associative array?
How can I grab parameters / key-value-pairs from a query string and put them in to an associative array where each key-value pair inside the array exactly corresponds with the key-value pairs inside the querystring? Regards Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP session_id()
Hi all Is it possible that the PHP engine can generate duplicate session id's for one application? Can one assume that the session id generated and saved in a database will always be unique (never to be repeated)? Regards Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session hanling & session disabled
Hi all, Since the upgrade to php 4.3 I have several issue with my session handling and my URL. First of all I currently use the following code : this allows me to have my URL in this format : http://domain.tld/nav.php/page1/SID/abc123 instead of http://domain.tld/nav.php?page=page1&SID=abc123 Thus, all my link are in this format : Since the upgrade to version 4.3, all my URL and link are in this format : http://domain.tld/nav.php/page1/SID/abc123?PHPSID=abc123 As a result the Session ID becomes : abc123?PHPSID=abc123. the server cannot find variables.related to the current session I would like NOT to use cookies at all, but at soon as I start a session, a cookies is sent to the browser. I tried to change several ini variables (with no result), such as : @ini_set("session.use_trans_sid","0"); @ini_set("session.use_cookies","0"); @ini_set("session.auto_start","0"); @ini_set("session.name","SID"); @ini_set("session.save_handler","files"); Do you have any idea how to force php to write the session information into the session folder ? the only way for me to keep my URL "clean" is to activate cookies. but if cookies are refused by the visitor, the website will be unusable (member section etc) I will appreciate any help from you. Thanks, Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem wih Session and register_globals
Hello, When I try the code below and register_globals=On, its work fine, the counter variable is incremented each time that I load the page, but, when register_globals=Off, its does not work, the counter variable is save just in first time and never more. How can I fix this? With out to turn register_globals=On. Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with Session and register_globals
Hello, When I try the code bellow with register_globals=On, it work was expected, the counter variable is incremented each time that I load the page, but, when I try with register_globals=Off, it doesn´t work, the counter variable is incremented just in the first time, the session variable is not update. How can I fix this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] filesize() error - Can anyone help?
Dear All I am getting the following error message when I open some of the page on my Web Site. What could the problem be and how can I correct it? Warning: filesize() [function.filesize]: Stat failed for ./admin/dbimages/tblProjects/image/776 (errno=2 - No such file or directory) in /data/ns-home/b2b/www.impumelelo.org.za/html/project_detail.php on line 10 Regards Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Mail handler?
Dear All Is there a mail function or object that I can use on my PHP sites that does the same as the CDONTS object in ASP? Where can I find some tutorials on this subject? Regards Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form To Mail script generators for Linux
Take a look at http://php.resourceindex.com/Complete_Scripts/Form_Processing/ Note that not all the scripts there are free though so look at type. By the way, as long as the server can run PHP and there are no specific shell commands in the script, it should run on any operating system. -- Jacques Manukyan Linda Stark wrote: Hi, I am trying to find out if there are any “form to mail” php script generators that run on Linux available - that would generate the script needed to profess web mail forms such as a “contact us” page or a “mail us” page on a web site. There was one in patricular I was looking at that is windows based, called “Forms To Go”, a commercial package, which from what I have gathered is the most popular in it’s class and apparently it generates secure code. Thanks for any info. _ Internet Explorer 8 – Now Available. Faster, safer, easier. http://clk.atdmt.com/MRT/go/141323790/direct/01/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPizabi - Applying php in TPL (smarty template engine)
You have to change the $php_handling variable in Smarty first before you can use {php}{/php} tags inside your template. The default behavior of Smarty is to ignore or echo your code inside {php}{/php} tags in the template. Take a look at http://www.smarty.net/manual/en/variable.php.handling.php -- Jacques Manukyan Luciano Felli wrote: Hi there! Any know how Can I use PHP code into Smarty Temple Engine (TPL files) ? I usued {php} include("text.php"); {/php} but the code don't run simply output the code. What's the problem? Wht don't run? Thankx, Luciano Felli -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php5activescript.dll
The site is under maintenance. You could wait or download it from: http://kromann.info/download.php?strFolder=php5_1-Release_TS&strIndex=PHP5_1 Note that I do not know of the validity of that site so have your antivirus program ready. -- Jacques Manukyan Robert Johnson wrote: I've been trying to locate this file and could not find it in the downloads area and got this message when I tried - http://pecl4win.php.net/ "The pecl4win build box is temporarily out of service. We're preparing a new build system. " Any suggestions? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP firebird driver
Hi, Does anyone know how the firebird (ibase_pconnect) driver handles link failure. From what I can see it automatically reconnects to a firebird database server once the link comes back up without passing back a error that the database which it connects to has gone away like the mysql_pconnect does. Regards --jm -- Jacques Marneweck http://www.powertrip.co.za/ http://www.powertrip.co.za/blog/ #include -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] preg_match_all : not all regular expressions ?
[newbie, please help] I'm trying to extract all URLs mentionning sound files from blocks of texts. I first tried with ereg and the following code works fine : $texte='TEST FIND\net voici un fichier son http://serveur/repertoire/fichier.gig ou ftp://serveur/repertoire/fichier.snd et ftp://serveur/repertoire/fichier.mp3 la suite http://serveur/repertoire/fichier.wav de mon texte'; if (ereg("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]\.(mp3|snd|wav)", $texte, $regs)) { echo $regs[0]."\n"; } else { echo "pas trouvé\n"; } the only problem is that it will only extract the first URL, so I did a small modification to use preg_match_all : if (preg_match_all("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]\.(mp3|snd|wav)", $texte, $matches)) { for ( $i=0 ; $i < count($matches[0]) ; $i++ ) { echo $matches[0][$i]."\n" ; } } else { echo "pas trouvé\n"; } but I have the following error message : *Warning*: Unknown modifier '+' in *e:\program files\easyphp1-7\www\test_ereg.php3* on line *4* where line 4 is the line with the regular expression after preg_match_all What's that ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_FILES empty, trouble with uploading
Hello people. I have some trouble with an upload script. It was working until the last 2 weeks. Whenever I tried to upload a file to a remote server, the $_FILES array is empty. I print global at start of the script there's nothing. Here's the form http://random.server.com/video/upload.php"; method="post" enctype="multipart/form-data"> Title: Description: Category: yada yada2 So it's a basic form, I do have the enctype. the print_r($GLOBALS) return me [_FILES] => Array ( ) PHP Version 5.2.6file_uploads is On post_max_size 200M upload_max_filesize 200M upload_tmp_dir no value (it use /tmp) the /tmp folder is writable by apache (chmod 777) with 197G of space left. So, obviously, I'm lost as why I can't upload file anymore. Anyone had a similar problem ? What could I do to find/fix the problem ? Is it even related to PHP ? Thanks, Karl _ Share photos with friends on Windows Live Messenger http://go.microsoft.com/?linkid=9650734
RE: [PHP] $_FILES empty, trouble with uploading
Thanks to both of you. It seems the problem lies with Apache, actually. I did try the script with my install of lighttpd on the same server, and it goes flawlessly. It's not the first time this apache server give me trouble. So I'll use lighttpd and give one finger to this particular apache server. It's just curious that it stopped working one day. Thanks anyway ! Karl Date: Thu, 5 Mar 2009 21:01:27 +0800 From: sore...@gmail.com To: a...@ashleysheridan.co.uk; sadness...@hotmail.com CC: php-general@lists.php.net Subject: Re: Re: [PHP] $_FILES empty, trouble with uploading yes,I agree with Ash ,you can test it on a local testing server or the other server. if it work ,then you can sure it's environment problem. 2009-03-05 zhoo 发件人: Ashley Sheridan 发送时间: 2009-03-05 04:10:02 收件人: Karl St-Jacques 抄送: php-general 主题: Re: [PHP] $_FILES empty, trouble with uploading On Wed, 2009-03-04 at 09:02 -0500, Karl St-Jacques wrote: > Hello people. > > I have some trouble with an upload script. It was working until the last 2 > weeks. > > Whenever I tried to upload a file to a remote server, the $_FILES array is > empty. I print global at start of the script there's nothing. > > Here's the form > > http://random.server.com/video/upload.php"; method="post" > enctype="multipart/form-data"> > > > > > Title: size="20" maxlenght="30"> > Description: size="20" maxlenght="255"> > Category: > > yada > yada2 > > > > > > So it's a basic form, I do have the enctype. > > the print_r($GLOBALS) return me [_FILES] => Array > ( > ) > > PHP Version 5.2.6file_uploads is On > post_max_size 200M > upload_max_filesize 200M > upload_tmp_dir no value (it use /tmp) > > the /tmp folder is writable by apache (chmod 777) with 197G of space left. > > So, obviously, I'm lost as why I can't upload file anymore. > > Anyone had a similar problem ? What could I do to find/fix the problem ? > Is it even related to PHP ? > > Thanks, > Karl > > > _ > Share photos with friends on Windows Live Messenger > http://go.microsoft.com/?linkid=9650734 Has your php.ini file been changed at all? If the max upload setting and memory settings have been reduced, it will affect uploads. How large is the file you are trying to upload? And lastly, does the script work on a local testing server? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Experience all of the new features, and Reconnect with your life. http://go.microsoft.com/?linkid=9650730
[PHP] trouble uploading more than 500 bytes...
Hello, I have trouble uploading files to a server. Actually I can't upload more than 500 bytes or so. Here's a quick print_r of the $_FILES [_FILES] => Array( [avatar] => Array ([name] => index.html[type] => text/html[tmp_name] => /tmp/phpRbmXK5[error] => 0[size] => 505 )) If I try bigger file (540 bytes or 2mb) it's simply return this. [_FILES] => Array([avatar] => Array( [name] => ajax-loader.gif [type] => [tmp_name] => [error] => 3 [size] => 0) ) error 3 is partial files sended. (By the way, there's no processing, only a print_r(); So here's my setup from the php.ini PHP Version 5.2.4-2ubuntu5.3 max_execution_time 1000 1000 max_input_nesting_level 64 64 max_input_time 1000 1000 memory_limit 999M 999M post_max_size 200M 200M upload_max_filesize 200M 200M upload_tmp_dir no value no value I run Apache/2.2.8 I checked the /tmp folder. it's empty, even if uploading really big file, same for /var/tmp. the permission seems to be ok (chmod 777). So, I'm pretty clueless about that one. Anyone have any insight about this ? Thanks, Karl. _
RE: [PHP] trouble uploading more than 500 bytes...
> > Hello, > > > > I have trouble uploading files to a server. Actually I can't > > upload more than 500 bytes or so.> > > > Here's a quick print_r of the > > $_FILES > > > > [_FILES] => Array( [avatar] => Array ( [name] => index.html > > [type] => text/html [tmp_name] => /tmp/phpRbmXK5 [error] => 0 [size] => 505 > > ))> > If I try bigger file (540 bytes or 2mb) it's simply return this. > > > > > > [_FILES] => Array([avatar] => Array( [name] => ajax-loader.gif [type] > > => [tmp_name] => [error] => 3 [size] => 0)> > )> > > > error 3 is partial > > files sended. (By the way, there's no processing, only a print_r();> > > > > > So here's my setup from the php.ini> > > > PHP Version 5.2.4-2ubuntu5.3> > > > > > max_execution_time 1000 1000 > > max_input_nesting_level 64 64 > > > > max_input_time 1000 1000 > > memory_limit 999M 999M> > post_max_size 200M > > 200M> > upload_max_filesize 200M 200M> > upload_tmp_dir no value no value> > > > > > > > I run Apache/2.2.8> > > > I checked the /tmp folder. it's empty, > > even if uploading really big file, same for /var/tmp. the permission seems > > to be ok (chmod 777).> > > > So, I'm pretty clueless about that one.> > > > Anyone have any insight about this ? > > > > Thanks, > > Karl.> > > > > > _> > > Bit > > of a silly question, but it's bit me in the ass before. Are you sure> > > you're editing the right php.ini file? I was working on a server at work> > > where someone had left 3 php.ini files, all in places that looked like> > > they were meant to be, and the only way to find the real one was through> a > > phpinfo() check. Also, have you restarted the web server (Apache or> IIS) > > since making the changes?> > > Ash> www.ashleysheridan.co.uk> (Do you have rules or code of conduct for reply in this mailing list ?) Yup, the setting I wrote was the setting I took directly from the phpinfo(); And I restarted apache more than enough for the next 2 years (even the server :| ). I'm totally lost about that one ! Thank, Karl _