[PHP] Image Problem
I have just upgraded php from 4.0.6 to 4.2.3. Everything works OK apart from the line below - echo 'td colspan=2 rowspan=2 align=centerimg alt=No Image to display. src=thumbnail.php?image=00042.jpg valign=top//td'; The thumbnail.php script uses php functions imagecreate, imagecreatefromjpeg, imagecopyresized. The script created a thumbnail OK before the upgrade and now I get no image. Is this because php has to be configured with the GD Library? If so, can I add this in without having to reinstall php? I am running on a Red Hat 7.2 box. This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Informix Connection
I have php 4.1.2 running on a linux 7.2 box. I want to make a connection to an Informix 7.2SE database running on a HP-UX 10.2 box. My issues are as follows - 1) Do I need informix software of any description running on the linux web server? 2) Can I configure the php informix modules into and up and running php build that doesn't currently have these modules. 3) Is there a step by step or guide on this type of connection anywhere? This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DATE_FORMAT (MySQL function)
I'm not sure if this is a php or mysql issue but I run the following query from a php script - $query = select d1.code, d1.type, d1.descr, d1.grouptype, d1.cusref, d1.stock, d1.minstock, d1.appmeth, d1.supplier, d1.suppref, d1.leadtime, d1.price, d1.reorder, d1.code1, d1.code2, d1.notes, d1.usr, d1.usr, d1.cusname, d1.colours, d1.stitchcount, d1.height, d1.width, DATE_FORMAT(d1.created, '%d-%m-%Y'), DATE_FORMAT(d1.amended, '%d-%m-%Y'), d2.extdescr from decheader as d1, decextdescr as d2 where d1.code = d2.code and d1.code = '00042' ; The problem I am having is with the DATE_FORMAT. Running the above query returns the following for the width column. 94.40 DATE_FORMAT(d1.created, '%d-%m-%Y'): NULL DATE_FORMAT(d1.amended, '%d-%m-%Y'): 03-10-2002 The width column should only return 94.40. Why does this query put 3 columns into one? This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mail problem
The script below works on my development web server which sits on our company LAN. When I transfer the script to our isp hosted webserver, the script does not work. I changed 192.168.10.9/iarnaweb/ to read localhost/ for the isp webserver version (I have also tried replacing localhost with the actual ip address). On my development server, the email is sent and the redirection happens but on the production server neither of these happens. Any ideas? ?PHP $toaddress = [EMAIL PROTECTED]; $subject = Enquiry via Web Site.; $mailcontent = Customer Name: .$name.\n .Position: .$position.\n .Company Name: .$company.\n .Address: .$address.\n .E-mail: .$email.\n .Tel No: .$telno.\n .Customer Comments: .$enquiry.\n; mail($toaddress, $subject, $mailcontent); header(Location: http://192.168.10.9/iarnaweb/contactack.html;); ? This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Mail problem
Manuel, My development platform is linux 7.2 and php4.0.6. The production server is also linux (I think 7.2) but the php version 4.1.1. On your second point, do you mean I should say something like this - header(Location: http://ccmltdcouk.site.securepod.com/test.php;) This is our temporary domain name. I hope this helps. The mail function mail fail for many reasons but you are not checking its return value. Possibly it is just PHP configuration issue on your server. Which platform do you use? Another point is that the Location: header is meant to be interpreted by the user browser, not your server. So, it should include the real server domain because localhost for each user is their own machine, not your server. -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Mail problem
I have some more information that may be relevant to my problem. I compared the phpinfo() from both servers and there is a difference. The sendmail_from variable in the php.ini on my server is set to [EMAIL PROTECTED] The same variable on my isp's ini file is set to 'no value'. Would this stop my emails from being sent and if so can I change this value from within my script or would it have to be directly amended in the php.ini file? This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Mail problem
Still not resolved. I checked my local php.ini and the sendmail_path variable is commented out. If I do a phpinfo() on the same server, sendmail_path has a value of /usr/sbin/sendmail -t -i ? I don't know where it pick up this value from but I can send emails from this server. The production server that is situated with my isp also has the sendmail_path set to /usr/sbin/sendmail -t -i but this won't send emails. Both web servers are on linux 7.2 boxes. Am I correct in assuming that the SMTP and sendmail_from variables are only relevant for webservers on windows hosts and all I need to be concerned with is sendmail_path? I have searched various places for an answer as to why I can't mail from my production server without much success. This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Mail problem
Erwin, sendmail on my local server does indeed reside in /usr/lib/sendmail although phpinfo shows sendmail_path = /usr/sbin/sendmail -t -i it still sends the mail? Why is this the case and would you suggest anything to enable me to get my mail working with my isp. I do not have direct access to php.ini with my isp. Mark -Original Message- From: Erwin [mailto:[EMAIL PROTECTED]] Sent: 30 August 2002 14:27 To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Mail problem Am I correct in assuming that the SMTP and sendmail_from variables are only relevant for webservers on windows hosts and all I need to be concerned with is sendmail_path? Yes, that is correct. Did you check for existence of /usr/sbin/sendmail? Sendmail often resides in /usr/lib/sendmail, so you could check that. Try file_exists, or open a pipe with popen. Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Mail problem
I have this set on both boxes. Here are the settings - local box (which does send mail)isp box (does not send mail) sendmail_from melocalhost.com 'no value' sendmail_path /usr/sbin/sendmail -t -i/usr/sbin/sendmail -t -i SMTPlocalhost localhost I actually had to set the SMTP setting to localhost on our solaris boxes to get this to work. I discovered this because we have a few older machines without php.ini files altogether, and the default is to have this set (the older machines worked). This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] About html
Use the tabindex - td width=100 valign=topinput name=telno type=text size=60 maxlength=60 value= tabindex=1//td -Original Message- From: kale [mailto:[EMAIL PROTECTED]] Sent: 30 August 2002 08:45 To: [EMAIL PROTECTED] Subject: [PHP] About html Hy, I have one question about html. 1. I have a form with 8 textbox. How can I put the tab order? When I press tab I want to jump from first textbox to textbox number 4 not to number 2. Thanks for answer. kale -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] StripSlashes Problem
I use the following php code to build a dynamic table retrieving values from a MySQL databases that have been inserted with slashes added - echo td width='100'input name='descr' type='text' size='45' maxlength='20' readonly value='.StripSlashes(mysql_result($badgedetails, $i, 'descr')).' tabindex='1'//td; The problem is, if the value to be displayed is for example O'Neill, then the output will look something like - td width='100'input name='descr' type='text' size='45' maxlength='20' readonly value='O'Neill' tabindex='1'//td Quite correctly, when this page is rendered, all that will be displayed is O as the apostrophe after the O will be treated as a closing parenthesis. I understand AddSlashes and StripSlashes but how can I utilise them to resolve this issue. This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] StripSlashes Problem
John, Thank you for your reply. My magic_quotes_runtime is set to 'Off'. As you said, I shouldn't have to use StripSlashes but would I still need to use AddSlashes when inserting/updating? I can see the slashes in the database when I look at the tables but I am fairly sure that I do not add slashes twice? Are they being added automatically somewhere as a result of a setting in the php.ini file? With regards to my use of mysql_result as opposed to mysql_fetch_* functions, I was ignorant of the performance hit and I will now re think around my database code. This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] StripSlashes Problem
John, Thank you. This solves the problem. Petre, Thank you for your reply. I wasn't aware of the difference and will bear this in mind. This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Installation Problem
Thanks all. I have now resolved. For future reference, the problem was as you said, I didn't have php configured for mysql support. I traced this back to the installation of the operating system, Red Hat 7.2. Through the graphical installation, all php modules apart from mysql support and odbc support are installed by default. These two have to be specifically chosen, which I didn't do. Anyway problem now resolved This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Installation Problem
I have a development web server php 4.0.6 apache and mysql and everything works OK. I installed the same software onto a new server that will be the production server but I hit problems when my scripts try and hit the db on the new server. Comparing the phpinfo details for both, the new server does not have a mysql section it. I copied the original php.ini onto the new server and restarted apache after the installation. Where have I missed this in the installation process and how should I resolve it? As an aside question, is there any glaring issues I may encounter if I upgrade php to 4.2.2 from 4.0.6? This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Upload File Problem
I have a simple script that attempts to upload a file and save it on the server. When I click send file I get this error message 'Warning: Unable to open '' for reading: No such file or directory in /var/www/html/upload.php on line 5 Couldn't copy the file!'. The file is being uploaded from a Win 2000 machine and the php script live on an apache web server on a linux box. I have chmod 777 the 'image' directory. Any ideas? Here's the code - -- upload.html -- html head titleUpload a File/title /head body h1Upload a File/h1 form enctype=multipart/form-data method=post action=upload.php pstrongFile to Upload:/strongbr input type=file name=img1 size=30/p Pinput type=submit name=submit value=Upload File/p /form /body /html -- upload.php -- ?php if ('img1' != ) { copy($img1_tmp_name, images/.$img1_name) or die(Couldn't copy the file!); } else { die(No input file specified); } ? This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Upload File Problem
Joakim, Thank you for your reply. I tried your example and get 'Possible file upload attack: filename.' meaning that 'if (is_uploaded_file($_FILES['img1']['tmp_name']))' returns false. I put a couple of echo statements in before the if statement to check '$img1_name' '$img1_size and '$img1_type' and these all returned the correct values. I have my upload_tmp_dir in php.ini set to /var/www/html/img and this folder has 777 permissions. Do you think the file is not getting to temp directory and if so any idea why? This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Upload File Problem
Joakim, Thanks again. $HTTP_POST did the trick. I did look through the archives before posting but didn't come across this solution. I obviously didn't look hard enough! This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms problem?
I have a php script that queries a mysql db and build a form on a page for each row returned. Each form has four fields and a thumbnail of a JPEG. Below the image is a link to view the full image in a new window by using a javascript function. (No javascript jibes before I go any further, it was the only way I knew how). When I enter a query and say 10 records are returned (10 forms are created with the same name), the data and appropriate thumbnails are displayed correctly. When I click on the link the full image is only displayed for the first six links. After this clicking on the link has no effect. In the example above, the first five images were the same and the last five were also the same. I should also mention that when I load this page, I get an IE error 'unterminated string constant' but the page does load correctly. I have checked my code for closing quotes etc but they seem OK. Is there a max number of forms that can be created on a page or do I have to name them all different or is there some other explanation as to why the images won't display. Any ideas would be helpful and I can post more code if required. The call to the function is: echo td width='200' colspan='2' align='center' class=labelsa href='javascript:void(0)' onclick='ViewFullImage(\$img_code\)'View full size/a/td; The function is: function ViewFullImage(strCode) { msg=window.open(,msg,height=400,width=750,left=20,top=80,scrollbars=yes ,resizable=yes); msg.document.write(htmltitleDecoration Image/title); msg.document.write(body bgcolor='white' onblur=window.close()); msg.document.write(centerimg src=images/ + strCode + .jpg align=center valign=center/center); msg.document.write(/body/htmlp); } This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Displaying Database Results
I have a php script that queries a MySQL database and I loop through the results displaying them as follows: echo td width='100'input name='description' type='text' size='45' maxlength='20' value=.StripSlashes(mysql_result($badgedetails, $i, 'descr')). tabindex='1'//td; The problem is that as per the example above, the text displayed is Name but it should be Name Badge. With all my fields, the text is displayed OK until it hits a space. Why does this occur? This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Image Functions
I have a directory of jpegs that I want to display thumbnails of and have a link to the original jpeg. I would rather not create separate thumbnails images preferring to create them in memory to display them. I have installed GD v.1.8.4. The code below outputs jumbled text to the browser (possibly the jpeg stream?). Code is as follows: /tr tdimg alt=text src=?php echo CreateThumbnail(); ? valign=top //td /tr ?php function CreateThumbnail() { $x = 130; $y = 100; $quality = 75; $thumbnail = imagecreate($x, $y); $originalimage = imagecreatefromjpeg('test.jpg'); imagecopyresized($thumbnail, $originalimage, 0, 0, 0, 0, $x, $y, ImageSX($originalimage),ImageSY($originalimage)); header(Content-Type: image/jpeg); imagejpeg($thumbnail,'test.jpg',$quality); imagedestroy($thumbnail); } ? Why will this not work? This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Image Functions
Thanks for your reply. Its a bit further forward but still not working. I have split the files and the output now shows the text part of 'img alt=text src=...' ie it won't recognise the image. Anything else you can think of? This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Image Functions
That's the winner!! Everything working good now. Thanks again. This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Button can't see form!
I use the following line in some of my php scripts to navigate between pages: td align=left width=40pxinput type='button' class='bginput' value='New' onClick=this.form.action='newproduct.php?mode=new'; this.form.submit()/td The problem I have is with a page I build dynamically. The whole page is encased in form/form tags. In between these tags there are sections echoed as a result of a databasse query. Each of these sections is a form. After all of the sections have been created, there is a button at the bottom of the page that is similar to that above. The button is outwith the form tags of the sections but within the form tags of the whole page i.e. form name=addproduct table !-- loop round result set creating a form for each row -- form name=detail dynamic content /form form dynamic content /form form dynamic content /form /table td align=left width=40pxinput type='button' class='bginput' value='New' onClick=this.form.action='newproduct.php?mode=new'; this.form.submit()/td /form Clicking on the button has no effect. On all my other pages this button behaves as it should. Why? This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Submitting Form Data
I have a php script that performs a query and then dynamically builds a section of a page for every row returned. Each section has some fields and three submit buttons. My problem is this. If I make a change to one particular section, how can I submit the form passing only the relevant section data? This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql_num_rows always returns 1?
The function below works when I pass in a valid username and password and returns '1'. When I pass a username and password that is not in the database it still returns '1'. I have put some echo statements in for debugging and the value of $numresult is always '1'. Does mysql_num_rows retain results in memory or something like that or am I completely going down the wrong road? function VerifyLogin($user, $pass) { $conn = $this-DB_Connect(); $query = select count(*) from users where .username = '$user' and .password = '$pass'; $result = mysql_query($query); if(!$result) { echo 'Cannot run query.'; echo 'user = ' .$user; echo 'pass = ' .$pass; echo 'query = ' .$query; echo 'result = ' .$result; $numresult = mysql_num_rows($result); echo 'numresult = ' .$numresult; exit; } else { $numresult = mysql_num_rows($result); echo 'numresult = ' .$numresult; } //if a row exists we have a correct username/password if (mysql_num_rows($result) == 1) { return 1; } // else username and/or password is wrong { return 0; } } Thanks in advance Mark This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php