Re: [PHP-DB] Multiple Database Connection Using Prepard Statements

2012-05-19 Thread Peter Lind
On 19 May 2012 20:36, Ron Piggott wrote: > > How do I connect to multiple mySQL databases using Prepared Statements ? > > I have the syntax > > === > $dsh = 'mysql:host=localhost;dbname='.$database3; > $dbh = new PDO($dsh, $username, $password); > === > > I want to connect to $database1 without lo

Re: [PHP-DB] Storing multiple items in one MySQL field?

2012-01-11 Thread Peter Lind
*snip* > > How does set() know the difference between say > the first row (1) + the fifth row (5) and the second row (2) + fouth row (4) > in the bit set? The sum of both are the same. > I am sure I am congfusing something. > Ummm ... if you're asking how set figures out how bitmasks differ, then

Re: [PHP-DB] Storing multiple items in one MySQL field?

2012-01-10 Thread Peter Lind
On Jan 11, 2012 7:13 AM, "Karl DeSaulniers" wrote: > > > On Jan 10, 2012, at 10:49 PM, Karl DeSaulniers wrote: > >> >> On Jan 10, 2012, at 9:30 AM, B. Aerts wrote: >> >>> On 08/01/12 23:35, Karl DeSaulniers wrote: On Jan 8, 2012, at 10:36 AM, Bastien wrote: > > > On

Re: [PHP-DB] Re: php-db foreign key

2011-08-09 Thread Peter Lind
On 9 August 2011 22:38, Chris Stinemetz wrote: >> >> Yes, debug your code and figure out why it's looping twice instead. >> For instance, try the other query in the mysql console. >> > > Thank you! It was the first query. I put a LIMIT 1 on it and now it is > working correctly. I appreciate your h

Re: [PHP-DB] Re: php-db foreign key

2011-08-09 Thread Peter Lind
On 9 August 2011 22:25, Chris Stinemetz wrote: >> >> Your php code had more than one query running (one inside the other). >> It's the outer query that runs twice, not the inner one returning >> double the results >> > > > Thanks Peter, > > Do you have any suggestions on how to fix this? > > Thank

Re: [PHP-DB] Re: php-db foreign key

2011-08-09 Thread Peter Lind
> > When I dump the query and run it in console I get the results I want. Not > sure what I am doing wrong. Your php code had more than one query running (one inside the other). It's the outer query that runs twice, not the inner one returning double the results -- WWW: plphp.dk / plind.dk Link

Re: [PHP-DB] foreign key

2011-08-09 Thread Peter Lind
On 9 August 2011 21:23, Chris Stinemetz wrote: > > > >> > > > > What does your result look like? Hard to say what the problem is > > without seeing the result. > > > > I am echoing the query and printing the get array just for debugging > purposes, but below you can see how it is repeating its' s

Re: [PHP-DB] foreign key

2011-08-09 Thread Peter Lind
On 9 August 2011 20:49, Chris Stinemetz wrote: >> >> Is users.user_id unique? >> > > yes it is. > What does your result look like? Hard to say what the problem is without seeing the result. -- WWW: plphp.dk / plind.dk LinkedIn: plind BeWelcome/Couchsurfing: Fake51 Twitter: kafe15 -- PHP Da

Re: [PHP-DB] foreign key

2011-08-09 Thread Peter Lind
On 9 August 2011 20:31, Chris Stinemetz wrote: > Okay. I am pretty new to mysql so this may seem like a ridiculous > question to some people. > > I am trying to use a LEFT JOIN query, but the results I am finding > unusual. For every record occurrence there is for the query, the > results are dupl

Re: [PHP-DB] Left Join

2011-08-07 Thread Peter Lind
Maybe it's just me, but I can't see anything that would work as foreign key for you to join on - neither table seems to have a foreign key On 7 August 2011 21:53, Chris Stinemetz wrote: > I am tyring to build a query that will take the most recent > "stores.store_date" column then join it with "s

Re: [PHP-DB] mysql_num_rows == 0

2011-05-30 Thread Peter Lind
On 30 May 2011 22:31, Nazish wrote: > Hi all, > > I've run into a little barrier, and I'm wondering whether you have any > insights. I'm entering values into a MySQL database. Before running the > mysql_query, I'm checking if the value already exists (using mysql_num_rows > == 0).  If the value al

Re: [PHP-DB] printf

2010-10-28 Thread Peter Lind
Mysql doesn't have a printf function Regards Den 2010 10 29 00:47 skrev "Ethan Rosenberg" : > Dear List - > > I am afraid that I am missing something in a major way. > > mysql> printf("%b %d %f %s\n", 123, 123, 123, "test"); > ERROR 1064 (42000): You have an error in your SQL syntax; check the

Re: [PHP-DB] products order

2010-09-29 Thread Peter Lind
On 29 September 2010 14:00, Emiliano Boragina wrote: > Hello, > > A client wants to control the order, the position of the products he > load. How do I do this? > You store positional data per product, defaulting to no priority in position. Regards Peter -- WWW: http://plphp.dk / http://plind

Re: [PHP-DB] how to explain such a regular syntax

2010-08-12 Thread Peter Lind
On 13 August 2010 08:47, win.a wrote: > Its was picked from drupal source code and i don't know how does it works. > This is the code : > preg_match('/^\[?(?:[a-z0-9-:\]_]+\.?)+$/', $host); This has got nothing to do with php or php-db - your question is on regular expressions. Try consulting htt

Re: [PHP-DB] Re: Stuck in apostrophe hell

2010-08-03 Thread Peter Lind
On 3 August 2010 15:04, wrote: > Yes, I may have mixed up the input and output from different iterations of > running it. Let me try posting this again although it may not be an issue. > Once again if I enter two sequential apostrophes in the name (O''Brien) > the INSERT passes right through to M

Re: [PHP-DB] Stuck in apostrophe hell

2010-08-02 Thread Peter Lind
On 2 August 2010 22:30, wrote: > Before I send the following SQL to MySQL from PHP I print it to screen. > PHP chokes on it, but I can paste the exact same query from the screen > directly to MySQL and it works just fine. For example: > > Here's the relevant PHP code: > ==

Re: [PHP-DB] Need Help in error msg

2010-05-18 Thread Peter Lind
On 18 May 2010 09:19, nagendra prasad wrote: > Hi All, > > I am getting this error while tried to run a downloaded script in WAMP: > > [1045] dbconn: mysql_connect: Access denied for user 'root'@'localhost' > (using password: YES) > > Dose anyone know what exactly this means. > > Best, > Guru. >

Re: [PHP-DB] Session start

2010-05-14 Thread Peter Lind
On 14 May 2010 18:47, Barry Zimmerman wrote: > I have a problem with my system, not sure how I can fix this one. A user has > a log in page and takes them to different pages, now each of these pages has > a check to make sure they are logged in with the following code: > > session_start(); > if (!

Re: [PHP-DB] grabbing from multiple tables

2010-05-01 Thread Peter Lind
On 1 May 2010 11:00, Karl DeSaulniers wrote: > Thank you Peter... again.. :) > Which would be the source field and which the target field? You place the constraint on the table that has the foreign key. Using your example: Table 1 = products * id = primary key Table 2 = productoptions * product

Re: [PHP-DB] grabbing from multiple tables

2010-05-01 Thread Peter Lind
On 1 May 2010 10:13, Karl DeSaulniers wrote: > What is the SQL query I can use to get an item that has two IDs? > Something to the effect of... > > $q = "SELECT OptID = '$OptID' FROM ".PRODUCT_OPTIONS." WHERE ProdID = > '$ProdID' AND OptGrpID='$OptGrpID'"; Close but no cigar. $q = "SELECT OptID

Re: [PHP-DB] grabbing from multiple tables

2010-05-01 Thread Peter Lind
On 30 April 2010 20:49, Karl DeSaulniers wrote: > No, please confuse me. I need to know this stuff. > > @Peter thanks for that introduction to foreign keys. Since my productoptions > table is based off of items in products, optionGroups and options, would I > use foreign keys for this? If I read

Re: [PHP-DB] grabbing from multiple tables

2010-04-30 Thread Peter Lind
On 30 April 2010 13:41, DZvonko Nikolov wrote: > > Hi, > > don't confuse the guy. Don't talk down to the man. He asked questions and got usable answers including links to where he could find more info. -- WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr:

Re: [PHP-DB] grabbing from multiple tables

2010-04-30 Thread Peter Lind
On 30 April 2010 12:26, Karl DeSaulniers wrote: > Thanks Peter. > So what is the logic behind foreign keys? Why use them? Constraints. When using, for example, the InnoDB engine in MySQL, you can set foreign key fields on tables. These ensure that your record will always be bound to a proper reco

Re: [PHP-DB] grabbing from multiple tables

2010-04-30 Thread Peter Lind
On 30 April 2010 12:02, Karl DeSaulniers wrote: > Hello All, > I have a product database. In that database there are several tables dealing > with individual products. > I am wanting to set up an editProduct and a productInfo page. For the bulk > info, I am fine. > For the product options, I need

Re: [PHP-DB] php mysql comparing two rows in two columns for username and passwort

2010-04-29 Thread Peter Lind
On 29 April 2010 16:44, Alexander Schunk wrote: > Hello, > > i have it now as follows: > > while($dbbenutzer = mysql_fetch_assoc($sqlbenutzername)) >        while($dbpasswort = mysql_fetch_assoc($sqlpasswort)){ You have things very twisted. Check the code posted by Karl - you only need *ONE* row

Re: [PHP-DB] php mysql comparing two rows in two columns for username and passwort

2010-04-29 Thread Peter Lind
On 29 April 2010 15:00, Karl DeSaulniers wrote: > Hi, > Maybe try... > > $benutzername = $_GET['username']; > $pass = $_GET['password']; > > $result = "SELECT * FROM usertable WHERE sqlbenutzername='$benutzername'"; Don't use values from $_GET without sanitizing first. If using mysql_* functions,

Re: [PHP-DB] Fwd: Apache log: database shutdown

2010-04-20 Thread Peter Lind
On 20 April 2010 13:37, Kamil Walas wrote: > I checked. It's looks fine for me, but I paste piece of it relevant to > apache log: > > Centrum    Mon Apr 19 13:57:02 2010 >    INET/inet_error: send errno = 104 > Centrum    Mon Apr 19 13:57:02 2010 >    SERVER/process_packet: broken port, server exi

Re: [PHP-DB] Fwd: Apache log: database shutdown

2010-04-20 Thread Peter Lind
On 20 April 2010 13:20, Kamil Walas wrote: > Since yesterday I have following situation. > > 1) Everything works fine for about one hour. > 2) Site didn't show up and apache log is following: > > [Mon Apr 19 14:07:35 2010] [error] [client 10.0.30.10] PHP Warning: > ibase_query() [function.ibase-qu

Re: [PHP-DB] MySQL vs. Session array

2010-04-07 Thread Peter Lind
On 8 April 2010 00:13, 3dgtech wrote: > Quick question. I have an AJAX component that fires a "like" query for each > "key up" event (since it's a like % query there is no indexing or caching > possible). While everything works fine, I was contemplaining downloading the > ~1500 rows into a session