Re: PHP and MySQL help please !
Hello, Try this ? function samp_db_connect() { $hostname = localhost; $username = joe; $password = user; $dbName = test; $link = @mysql_pconnect($hostname, $username, $password); if ($link mysql_select_db($dbName)) return $link; return FALSE; } samp_db_connect() or exit(); ? good luck Andrew Rich wrote: Further to this, I removed the @ symbol and got:- Fatal Error: Call to undefined function: mysql_connect() in /var/www/html/results.php @ $db = mysql_pconnect(localhost, user, password); $db = mysql_pconnect(localhost, user, password); Ideas ? Why is it now a undefined function ? Andrew -Original Message- From: Andrew Rich [mailto:[EMAIL PROTECTED]] Sent: Thursday, 25 April 2002 11:14 AM To: [EMAIL PROTECTED] Subject: PHP and MySQL help please ! + PHP Installed and going - I can write to files, retrieve flatfiles + Apache running servers outpages nop probes Trying to talk to SQL using PHP. -- html body h1Go to SQL now/h1 ? echo looking; @ $db = mysql_pconnect(localhost, user, password); if (!$db); { echo Error: Could not connect to database. Please try again later.; exit; } mysql_select_db(test); $query = select * from logbook ; $result = mysql_query($query); $num_results = mysql_num_rows($result); echo pNumber of books found: .$num_results./p; ? /body /html - What gets me if I can do all this from the mysql prompt:- laptopmysql -u user -p (enterpassword gets me in) mysqluse test; OK mysqlselect * from logbook; OK (shows entries no probs); - What am I doing wrong ? It doesnt get past the @ $db = mysql_pconnect(localhost, user, password); in the code. ?? Andrew --- Andrew Rich Callsign: VK4TEC [EMAIL PROTECTED] www.users.bigpond.com/andrew.rich/vk4tec.htm --- Andrew Rich Callsign: VK4TEC [EMAIL PROTECTED] www.users.bigpond.com/andrew.rich/vk4tec.htm - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Encrpt/Decrypt
Just want to add a few more things here that might spark your brain cells. All in all I agree with the suggestions presented. Use an encrypt function in your code, for something simple I've created a very basic encryption function in perl using Crypt::Blowfish modules and then I have control of the key to encrypt and decrypt it. Then you can process your request over SSL (if possible) just run the script over https if supported and then store the encrypted value in the database as a string. I think you can even run SSL on MySQL so that you can secure your connections further especially if you're replication your database etc. The MD5() function in PHP might also do the trick for you. http://www.php.net/manual/en/function.md5.php Good luck JM Gregory Junker wrote: and it's all-around better to encrypt the password BEFORE you transmit it over an unsecure connection, or even between processes on a potentially unsecure machine. This means using, for example, the MD5() function in PHP... -Original Message- From: Matthew Smith [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 1:51 AM To: mysql Subject: Re: Encrpt/Decrypt Manish Mehta wrote: Hi I can Encrypt password in mysql using password() command. what is the way to decrypt the password. Manish Hi Manish / All Somebody correct me if I'm wrong, but I think that what happens is what's called one-way encryption. This is how stuff is done in the world of Unix (and its clones) and others. Authentication is done by taking the password provided, encrypting it, then comparing against the encrypted key in the database. Cheers M -- Matthew Smith | _ ASCII Ribbon Campaign IT Consultant | ( ) - No HTML/RTF in e-mail Kadina, South Australia | X - No Microsoft docs in e-mail http://www.kbc.net.au | / \ - No vCards Ph: +61 888 212 395 | - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Math Computations
I agree with the suggestion below strip the character and typecast it if necessary. In JSP I think you can convert it to a number and then typecast it. In PHP, I think the principles might be the same. In addition, it might be a good idea to restrict the columns that require computation to a numeric value rather than a string because you can always add the comma later when totalling it for display. It might also be more efficient for sorting and doing sums, totals etc from your select statements.(i.e. select sum() total()) since computers are inherently better at handling numbers than strings (though I could be mistaken) So if its possible for you to redeclare the table definition then that will be great. Good luck [EMAIL PROTECTED] wrote: It could be best to parse and remove ',' from both of them first before calculation... R.B.Roa PhilCom Corporation Tel. No. 858- Mobile No. (63) (919-xxx) -Original Message- From: delz [SMTP:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 1:50 PM To: [EMAIL PROTECTED] Subject:Re: Math Computations Hi All, How do I make calculations in php or mysql if the value has a comma like 2,000 + 32,000 = 34,000. I have a problem calculating if one of my values has a comma. It doesn't display the right output. I'll appreciate anyone who can help me with this. Thanks. Delz. - Original Message - From: Adam Alkins [EMAIL PROTECTED] To: delz [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, April 11, 2002 5:44 PM Subject: Re: Math Computations Something like ? $db = mysql_connect(localhost,database_user,password); mysql_select_db (database_name); $query = SELECT * FROM table_name; $result = mysql_query($query); echo Computers | Department | Price Per PC | Total Amountbr; while ($row = mysql_fetch_row($result)){ $subtotal=$row[0]*$row[2]; $total+=$subtotal; echo $row[0] | $row[1] | $row[2] | $subtotalBR; $comptotal+=$row[0];} } echo $comptotal $total; ? Obviously format it into a table would make sense, e.t.c. Adam - Original Message - From: delz [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 11, 2002 5:29 AM Subject: Math Computations Hi, I have this table that looks like this Computers | Department | Price per PC | TotalAmount | 15 | Marketing | $500.00| | 5 | Purchasing | $ 300.00 | | I want this table to display the total price wherein Computer * Price Per PC = TotalAmount and want to display the total no. of computer and the OverAll TotalAmount. I want the output to look like this Computers | Department | Price per PC | TotalAmount | 15 | Marketing | $500.00| $ 7500.00 | 5 | Purchasing | $ 300.00 | $ 900.00 | - --- 20 $ 8400.00 Can anyone help me how to do this in mysql or php. I will surely appreciate any help I can get. Thanks. Delz - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php
Re: mysql+jdbc+international character support
Hello, Thank you for your immediate reply. What database version have you used these drivers for? Do you have a preference for either? Thanks again. jm TAKAHASHI, Tomohiro wrote: Hi, Both gweMySQL and MM.MYSQL support Unicode-Nativecode conversion. [gweMySQL Driver] http://www.t3-jpn.com/jdbc/jdbcmysql.html i.e. String url = jdbc:mysql://server:3306/dbname?characterEncoding=EUC_JP; [MM.MYSQL Driver] http://mmmysql.sourceforge.net/ Jan-Michael Ong wrote: Greetings, This will be my first post to this mailing list so please bear with me. We need to setup a database that is capable of handling international characters similar to Oracle. We plan to use MySQL and the latest JDBC drivers for MySQL. I've searched Google to see if MySQL has dedicated support for international characters but was less than satisfied with the results. So the question is: What version (if any) does MySQL support international characters? Does the latest JDBC driver support this as well? If it does support it are there resources that perhaps you can recommend that I can read up on? If it does not support international characters are there plans to in the next few releases? Thank you in advance and I look forward to your reply. -- I love Borland. Borland Japan / Consulting Group TAKAHASHI, KEN, Tomohiro - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php