[PHP-DB] Join on single table
I have a table which contains the following: id (primary key, auto incrementing) app_id (integer, foreign key) resource_id (integer, foreign key) word score (This is a search index.) I want to find all resource_ids from one app_id that match resource_ids in another app_id by word. I have created a temporary table 'tmp1' that contains all resource_ids from the second app_id (the one whose resources I wish to retrieve). I am then looping through all resource_ids in the main table with the first app_id, and doing the following: * Creating a temporary table tmp2 with a single column 'word' populated by the words associated with resource_id in the main table * Selecting all distinct resource_ids from tmp1 INNER JOIN'd on tmp2 on the word field The issues I'm running into are that (1) each resource_id cycle takes a good amount of time, and (2) I seem to be getting either too many resource_ids or not enough. (1) may be something I just have to deal with. As it is, I'm planning on running the full indexing once, and then doing incremental updates, so it may not be that big of an issue (unless it takes too much time to create the initial index). As for (2), unfortunately, I'm not sur ehow to really trouble shoot the issue. I know, for instance, that in once case, I have a list of 343 words that generates a list of ~12,000 resource_ids (of a possible 18,000) -- but I don't quite know how to spot check 300 values to be certain that this is reasonable. In a previous incarnation of the script, I was looping through each word of each resource_id and then selecting out of tmp1 based on the single word value. The results were very different (very few matches), and, again, the script ran long. Any ideas? -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:[EMAIL PROTECTED] | http://vermontbotanical.org -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Reg Exp to change c:\dir\dir\pic.jpg to dir/pic.jpg - to upload image path
now if you must have the local path of your file here's a rough code to give you an idea using javascript, then just have it php control it on the server side. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Reg Exp to change c:\dir\dir\pic.jpg to dir/pic.jpg-to upload image path
ioannes wrote: OK. Makes sense, since I needed to change the form tag to upload files. Clearly, then it was not uploading the path. Thanks If by local, in your example, you mean it gives you "pic1.jpg" - then I will agree. No browser I've ever seen sends "C:\pics\subdir\pic1.jpg". It will *display* that to the user, but it doesn't submit the local path, it just uploads the file and gives the filename. No problem. In the future, unless you have a specific reason to take a mailing off-list, please leave it so others can reply to it or find the answers / solutions / clarification when searching archives and the likes. It's just polite :) (this is part of why I try to always set the reply-to to the list) Cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Cannot connect to local server
Novice, This is rather complicated code. In addition you are making it over complicated by taking constants and just renaming them as other contants. This accomplished nothing. You would be better of just placing the information in the correct place. Otherwise you can make the arguments into variable such as: $usr = 'masud'; Then, mysqli_connect ($host, $usr, $pwd, $db) In this case you could have a form which would allow users to access their own database and projects. You do not need that if the statement unless you need an error or die message. (Which is standard and a good idea). Google has alot of these answers jzf Novice Learner wrote: Make sure that: localhost is actually "localhost" username is the actual authorized username of the database the password is the actual password you have given for the user the database is the actual database name you have given. I am an absolute beginner and I have a file like this and works perfectly, although I had a lot of problems in the beginning, I use the following code: // Set the database access information as constants. define ('DB_USER', 'masud');//This is the actual user name define ('DB_PASSWORD', 'mylove'); //This is the password define ('DB_HOST', 'localhost'); //This is the localhost define ('DB_NAME', 'masud'); //This is the actual database name if ($dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD)) { // Make the connnection. Just my two cents. Denis Gerasimov <[EMAIL PROTECTED]> wrote: Hello, I am trying to connect to MySQL using $mysqli = new mysqli("example.com", "user", "pass", "db"); And access is ALWAYS denied (I played around changing user name/pass/host - didn't help me at all) The thing is that I CAN connect to the db server using this user name and password with my DB administration tool. Some background 1. MySQL and Apache + PHP are running on the same machine. 2. The user is allowed to connect from '%' (everywhere) 3. Connecting to localhost fails too (saying "cannot connect to socket...") What is going on? Best regards, Denis Gerasimov Outsourcing Services Manager, VEKOS, Ltd. www.vekos.ru -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Cannot connect to local server
Make sure that: localhost is actually "localhost" username is the actual authorized username of the database the password is the actual password you have given for the user the database is the actual database name you have given. I am an absolute beginner and I have a file like this and works perfectly, although I had a lot of problems in the beginning, I use the following code: // Set the database access information as constants. define ('DB_USER', 'masud');//This is the actual user name define ('DB_PASSWORD', 'mylove'); //This is the password define ('DB_HOST', 'localhost'); //This is the localhost define ('DB_NAME', 'masud'); //This is the actual database name if ($dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD)) { // Make the connnection. Just my two cents. Denis Gerasimov <[EMAIL PROTECTED]> wrote: Hello, I am trying to connect to MySQL using $mysqli = new mysqli("example.com", "user", "pass", "db"); And access is ALWAYS denied (I played around changing user name/pass/host - didn't help me at all) The thing is that I CAN connect to the db server using this user name and password with my DB administration tool. Some background 1. MySQL and Apache + PHP are running on the same machine. 2. The user is allowed to connect from '%' (everywhere) 3. Connecting to localhost fails too (saying "cannot connect to socket...") What is going on? Best regards, Denis Gerasimov Outsourcing Services Manager, VEKOS, Ltd. www.vekos.ru -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do you Yahoo!? Yahoo! Search presents - Jib Jab's 'Second Term'
Re: [PHP-DB] Reg Exp to change c:\dir\dir\pic.jpg to dir/pic.jpg- to upload image path
ioannes wrote: I am trying to upload images - in fact an image path - from a PC. I use the tag: which nicely gives an input textfield and Browse button! This gives me, in the input box, eg: c:\pics\subdir\pic1.jpg a web browser doesn't even give you this information! The input tag does give the local path. [snip] * I apologize on my last message, I didn't change the field to a reply-to and it was a Cc - though I think the mailing list was kind enough to only post it once * If by local, in your example, you mean it gives you "pic1.jpg" - then I will agree. No browser I've ever seen sends "C:\pics\subdir\pic1.jpg". It will *display* that to the user, but it doesn't submit the local path, it just uploads the file and gives the filename. Cheers, -- - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Cannot connect to local server
have you tied using $link = mysqli_connect("$host","$usernam","$password","$database") I have never used the code you are trying to use. But i am also noob. hope this works jzf Miles Thompson wrote: New version of MySQL, old PHP? possible password encryption mis-match? Check out: http://dev.mysql.com/doc/mysql/en/old-client.html Regards - Miles At 06:33 AM 2/10/2005, Denis Gerasimov wrote: Hello, I am trying to connect to MySQL using $mysqli = new mysqli("example.com", "user", "pass", "db"); And access is ALWAYS denied (I played around changing user name/pass/host - didn't help me at all) The thing is that I CAN connect to the db server using this user name and password with my DB administration tool. Some background 1. MySQL and Apache + PHP are running on the same machine. 2. The user is allowed to connect from '%' (everywhere) 3. Connecting to localhost fails too (saying "cannot connect to socket...") What is going on? Best regards, Denis Gerasimov Outsourcing Services Manager, VEKOS, Ltd. www.vekos.ru -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Reg Exp to change c:\dir\dir\pic.jpg to dir/pic.jpg - to upload image path
ioannes wrote: I am trying to upload images - in fact an image path - from a PC. I use the tag: which nicely gives an input textfield and Browse button! This gives me, in the input box, eg: c:\pics\subdir\pic1.jpg The relative path on the server is something like: subdir/pics1.jpg thus I need to transform the string: c:\subdir\pics\pics1.jpg into: pics/pics1.jpg I can use str_replace() to change "\" into "/". I am looking for an expression from some clever person to get rid of "c:\subdir\" given that I don't know the exact 'subdir' or name of the image. Maybe it's just early, and I haven't had my caffeine yet - but it seems to me something fairly basic is being overlooked... a web browser doesn't even give you this information! if you really need it, for whatever reason, you're going to have to pull the information out of the file input through javascript. IIRC you can read from a file input, but I know for a fact you can't change it (at least, not without perhaps an exploit or some horrible activex why_would_this_ever_be_enabled_microsoft_you_fools() function calls.) You're better off providing keywords, categories, folders or labels to go along with the images for your users, instead of trying to match their organization with yours. Cheers, -- - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Is there anything non commercial pdf lib to create PDF file from PHP ?
www.fpdf.org bastien From: santoso berkah <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: [PHP-DB] Is there anything non commercial pdf lib to create PDF file from PHP ? Date: Wed, 9 Feb 2005 21:23:20 -0800 (PST) Dear Friends, Is there anything non commercial pdf library (stable release) to create PDF file from PHP except PHPlib.com ? I've browsed this site and it costed Euro 450. Can you help me please ? Best regards, [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Cannot connect to local server
New version of MySQL, old PHP? possible password encryption mis-match? Check out: http://dev.mysql.com/doc/mysql/en/old-client.html Regards - Miles At 06:33 AM 2/10/2005, Denis Gerasimov wrote: Hello, I am trying to connect to MySQL using $mysqli = new mysqli("example.com", "user", "pass", "db"); And access is ALWAYS denied (I played around changing user name/pass/host - didn't help me at all) The thing is that I CAN connect to the db server using this user name and password with my DB administration tool. Some background 1. MySQL and Apache + PHP are running on the same machine. 2. The user is allowed to connect from '%' (everywhere) 3. Connecting to localhost fails too (saying "cannot connect to socket...") What is going on? Best regards, Denis Gerasimov Outsourcing Services Manager, VEKOS, Ltd. www.vekos.ru -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Is there anything non commercial pdf lib to crea te PDF file from PHP ?
Or ezPDF http://www.ros.co.nz/pdf/ I've used it and it's easy to use as advertised. Rich -Original Message- From: Stefan Reimers [mailto:[EMAIL PROTECTED] Sent: Thursday, February 10, 2005 5:26 AM To: php-db@lists.php.net Subject: [PHP-DB] Re: Is there anything non commercial pdf lib to create PDF file from PHP ? Try FPDF on http://www.fpdf.org/ Stefan Santoso Berkah wrote: > Dear Friends, > > Is there anything non commercial pdf library (stable > release) to create PDF file from PHP except PHPlib.com > ? > I've browsed this site and it costed Euro 450. > > Can you help me please ? > > Best regards, > > [EMAIL PROTECTED] > > __ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Cannot connect to local server
Denis, try executing the following statement in your mysql client. grant all privileges on db.* to [EMAIL PROTECTED] identified by 'pass'; I didn't check the documentation but it seems that localhost is not in the set {%}. HTH. . . Dusty Denis Gerasimov wrote: Hello, I am trying to connect to MySQL using $mysqli = new mysqli("example.com", "user", "pass", "db"); And access is ALWAYS denied (I played around changing user name/pass/host - didn't help me at all) The thing is that I CAN connect to the db server using this user name and password with my DB administration tool. Some background 1. MySQL and Apache + PHP are running on the same machine. 2. The user is allowed to connect from '%' (everywhere) 3. Connecting to localhost fails too (saying "cannot connect to socket...") What is going on? Best regards, Denis Gerasimov Outsourcing Services Manager, VEKOS, Ltd. www.vekos.ru -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Cannot connect to local server
Hello, I am trying to connect to MySQL using $mysqli = new mysqli("example.com", "user", "pass", "db"); And access is ALWAYS denied (I played around changing user name/pass/host - didn't help me at all) The thing is that I CAN connect to the db server using this user name and password with my DB administration tool. Some background 1. MySQL and Apache + PHP are running on the same machine. 2. The user is allowed to connect from '%' (everywhere) 3. Connecting to localhost fails too (saying "cannot connect to socket...") What is going on? Best regards, Denis Gerasimov Outsourcing Services Manager, VEKOS, Ltd. www.vekos.ru -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Is there anything non commercial pdf lib to create PDF file from PHP ?
Try FPDF on http://www.fpdf.org/ Stefan Santoso Berkah wrote: Dear Friends, Is there anything non commercial pdf library (stable release) to create PDF file from PHP except PHPlib.com ? I've browsed this site and it costed Euro 450. Can you help me please ? Best regards, [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php