Re: [PHP-DB] Echoing a variable within a variable.

2009-01-06 Thread Micah Gersten
If you use preg_replace with the e modifier, you can run eval on the
variables only:
http://us.php.net/preg_replace

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Phpster wrote:
 A couple of options:

 1. Use eval($databaseString); there are risks as it could be used to
 execute arbitrary code should the database be compromised.

 2. If your data string is enclosed in single quote php won't evaluate
 the variables. Consider changing the outside quotes to double quotes.

 Bastien

 Sent from my iPod

 On Jan 6, 2009, at 2:30 PM, Stephen Sunderlin
 stephen.sunder...@verizon.net wrote:

 I'm emailing an html file through phpmailer and the sql look up is
 getting
 the html from a table and setting it into a variable.  Within the
 html from
 the table are also variables that are also being called by the same
 sql that
 is looking up the html variable.  However the variable in the html are
 echoing as $var instead of the assigned value being called from the sql
 look-up

 Not sure what the solution is.  Any thoughts.



 -- 
 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] Move from PHP4 to PHP5 , and to Zend Platform - any gotchas? (MYSQL and SQL SERVER)

2008-12-11 Thread Micah Gersten
That is due to register_globals being on by default in PHP4 and off by
default in PHP5.  It is a security risk and should not be used.  I
believed it is being removed in PHP 6.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com

Gunawan wrote:
 i don't know about the sql.. but i have some story.
 in php4, when type url like this
 localhost/mywork/index.php?myid=1
 i able to print the 'myid' variable easyly.. but when in php5.. i must
 type
 $_GET['myid'] to have myid value.

 Weaver Hickerson wrote:
 Greetings list.  We are planning to move our legacy php4/apache
 system to PHP5 and also move to the Zend Platform.  Wondering if
 anyone has any gotchas/horror stories..  The system interfaces with
 both MySQL and SQL Server.

 Any thoughts appreciated!

 
 Weaver Hickerson, President
 LightSpeed Technology Group
 wdhic...@lightspeedinc.com
 770-787-0880 ext 3011

   



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] php5/oci8/oracle 11g1 insert doesn't work ..updated..sorry

2008-11-23 Thread Micah Gersten
Fred Silsbee wrote:
 The following code doesn't do the insert.

 I've tried the insert statement in a session:

 [EMAIL PROTECTED] log_book]$ sqlplus landon/PW

 SQL*Plus: Release 11.1.0.6.0 - Production on Sat Nov 22 16:01:39 2008

 Copyright (c) 1982, 2007, Oracle.  All rights reserved.


 Connected to:
 Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
 With the Partitioning, OLAP, Data Mining and Real Application Testing options

 SQL select * from log_book where actype='B-17';

 no rows selected

 SQL quit
 Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 
 Production
 With the Partitioning, OLAP, Data Mining and Real Application Testing options


 ?php // File: anyco.php

 require('anyco_ui.inc');

 $db = (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
  (SERVER = DEDICATED)
  (SID = LMKIIIGDNSID)
)
 );
 if ($conn=oci_connect('landon', 'PWD',$db))
 {
 echo Successfully connected to Oracle.\n;

 }
 else
 {
 $err = OCIError();
 echo Oracle Connect Error  . $err['message'];
 }


   $stid = oci_parse($conn, 'insert into log_book values ( 
 TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8);');

   $r = oci_execute($stid );

 oci_commit($conn);
 OCILogoff($conn);
 echo end;
 ?

 produces:  Successfully connected to Oracle.end 


 This is my first php/oci8/oracle insert! What could be simpler! HELP!

 In desperation, I used em to give myself every possible privilege !

 Not good but after it works, I can go back and correct and learn privileges!

 I rebooted and tried this again to no avail.

 I suspected a commit problem but oci_execute has commit as default!

 The table has no primary key defined since no values are unique.

 I have a similar table with a row id!


   

   
One thing that jumps out at me is the insert query.  You have:

$stid = oci_parse($conn, 'insert into log_book values ( 
TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8);');

which will probably not do what you want.  You probably mean to have the
query in double quotes and the values in single quotes.

$stid = oci_parse($conn, insert into log_book values ( 
TO_DATE('08/12/1973','MM/dd/'),'B-17','N5787G',1,1.8););


Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] PHP MySQL Driver Choice -- Fastest?

2008-11-19 Thread Micah Gersten
Which is the fastest driver for this?
ADODB
PDO
mysqli
Anything else?

-- 


Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest?

2008-11-19 Thread Micah Gersten
Chris wrote:
 Micah Gersten wrote:
 Which is the fastest driver for this?
 ADODB
 PDO
 mysqli

 Either mysqli or pdo since they'd deal with the mysql client directly.

 ADODB is a php library, so it's not going to be as fast because you
 have php code overhead.


ADODB is precompiled for PHP5.   Do you know of any tests?

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest?

2008-11-19 Thread Micah Gersten
Chris wrote:
 Micah Gersten wrote:
 Chris wrote:
 Micah Gersten wrote:
 Which is the fastest driver for this?
 ADODB
 PDO
 mysqli
 Either mysqli or pdo since they'd deal with the mysql client directly.

 ADODB is a php library, so it's not going to be as fast because you
 have php code overhead.


 ADODB is precompiled for PHP5.   Do you know of any tests?

 It's a dll or .so file?


On Linux, it's an .so file, yes:
http://packages.debian.org/lenny/i386/php5-adodb/filelist

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] query optimization - DB

2008-09-26 Thread Micah Gersten
MySQL queries use 1 index per table, so to speed the query, we need to
know what indices you have for the 2 tables.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Yves Sucaet wrote:
 Oh, sorry I forgot to mention this. It's a MySQL database.

 - Original Message - From: Micah Gersten [EMAIL PROTECTED]
 To: YVES SUCAET [EMAIL PROTECTED]
 Cc: php-db@lists.php.net
 Sent: Thursday, September 25, 2008 7:55 PM
 Subject: Re: [PHP-DB] query optimization


 Other question is, what DB is this for?

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 YVES SUCAET wrote:
 How could I rewrite the following query so it runs faster:

 select distinct location from blockunit where blockid in (
   select bu.blockid from blockunit bu inner join interactionparts ip on
 (bu.blockid = ip.part)
   where ip.blockid in

 (110936,110937,111641,111642,113140,113141,114925,114926,121161,121162,124087,

  
 124088,124562,124563,133358,133359,133409,133410,135304,135305,136096)
   union
   select bu.blockid from blockunit bu
   where bu.blockid in

 (110936,110937,111641,111642,113140,113141,114925,114926,121161,121162,124087,

  
 124088,124562,124563,133358,133359,133409,133410,135304,135305,136096)
 )

 Thanks in advance,

 Yves









-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] query optimization

2008-09-25 Thread Micah Gersten
What indices do you have?

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



YVES SUCAET wrote:
 How could I rewrite the following query so it runs faster:

 select distinct location from blockunit where blockid in (
   select bu.blockid from blockunit bu inner join interactionparts ip on
 (bu.blockid = ip.part) 
   where ip.blockid in 
  
 (110936,110937,111641,111642,113140,113141,114925,114926,121161,121162,124087,
   124088,124562,124563,133358,133359,133409,133410,135304,135305,136096)
   union 
   select bu.blockid from blockunit bu 
   where bu.blockid in 
  
 (110936,110937,111641,111642,113140,113141,114925,114926,121161,121162,124087,
   124088,124562,124563,133358,133359,133409,133410,135304,135305,136096)
 )

 Thanks in advance,

 Yves



   

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] query optimization

2008-09-25 Thread Micah Gersten
Other question is, what DB is this for?

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



YVES SUCAET wrote:
 How could I rewrite the following query so it runs faster:

 select distinct location from blockunit where blockid in (
   select bu.blockid from blockunit bu inner join interactionparts ip on
 (bu.blockid = ip.part) 
   where ip.blockid in 
  
 (110936,110937,111641,111642,113140,113141,114925,114926,121161,121162,124087,
   124088,124562,124563,133358,133359,133409,133410,135304,135305,136096)
   union 
   select bu.blockid from blockunit bu 
   where bu.blockid in 
  
 (110936,110937,111641,111642,113140,113141,114925,114926,121161,121162,124087,
   124088,124562,124563,133358,133359,133409,133410,135304,135305,136096)
 )

 Thanks in advance,

 Yves



   

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] how is this line a security risk?

2008-09-23 Thread Micah Gersten
Only is register_globals is on can that reset a variable.  You are
correct though, defining directory paths is safer.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Joseph Crawford wrote:
 read up on register_globals.  It is a security risk because if i do
 http://domain.com/file.php?plugins_directory=/directory/

 it can reset your variable.

 the best way to do that is to make PLUGINS_DIR a constant

 define('PLUGINS_DIR', '/directory/');

 Joseph Crawford

 On Sep 23, 2008, at 12:58 PM, michael wrote:

 I get an error stating that this line in my code is a security risk
 when I code it.

 require_once($PLUGINS_DIRECTORY.forum/forum.php);

 here is what the explanation is:

 include() or analogous is used with variable argument this can be
 dangerous since variables are in many cases controlled by remote users.

 the recommended  soloution is to write it this way

 define('SCRIPT_PATH',/htdocs);
 include ('sSCRIPT_PATH./Foo.inc);

 my question is why is the other way safer? im kinda confused..



 -- 
 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: Building WHERE SQL clauses

2008-09-16 Thread Micah Gersten
The USING operator is when the column is being used for the Join.  Here,
the OP just wanted to look up the same values in both tables, not join
the results.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Neil Smith [MVP, Digital media] wrote:

 Message-ID: [EMAIL PROTECTED]
 To: php-db@lists.php.net
 Reply-To: Mike Sullivan [EMAIL PROTECTED]
 From: Mike Sullivan [EMAIL PROTECTED]
 Date: Mon, 15 Sep 2008 11:06:30 -0400
 Subject: Building WHERE SQL clauses

 Hello all.  I'm using PHP to build a query for a database that
 consists of
 multiple tables, all with identical attribues.  A typical syntax try
 looks
 like this:  SELECT * FROM chico, harpo WHERE operator = Bill OR
 operator =
 Jessica

 MySQL responds with this:  Couldn't execute query.Column 'operator'
 in where
 clause is ambiguous


 That's right. There's no way to distinguish between the column names
 where they're identical between 2 tables, so often you would prefix
 those with the table name such as (assuming you want to use harpo as
 the canonical source) :

 SELECT * FROM chico
 LEFT JOIN harpo
 ON `chico`.operator = `harpo`.operator
 WHERE (
 `harpo`.operator = Bill OR
 `harpo`.operator = Jessica
 );

 However SQL also has a `USING` clause which can be used where columns
 really are identical :

 http://dev.mysql.com/doc/refman/5.0/en/join.html
 The USING(column_list) clause names a list of columns that must exist
 in both tables

 So you should also be able to do

 SELECT * FROM chico
 LEFT JOIN harpo USING (operator)
 WHERE (
 `harpo`.operator = Bill OR
 `harpo`.operator = Jessica
 );


 In that case you don't need to explicitly name the tables in the
 USING() clause because the query parser notices that both tables have
 columns named the same

 HTH
 Cheers - Neil



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Question about databases and foreign keys

2008-09-15 Thread Micah Gersten
You'll actually want to have the User Id in the clocking table, not the
other way around.  User Id is the foreign key because it has a many to
one relationship with the time logging.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Philip Thompson wrote:


 I'll throw this out there though. When dealing with foreign keys and
 multiple tables, remember to index appropriately. For example:

 Table `users`:
 user_id int(10) primary key
 -- other fields here --
 clock_id int(10)

 Table `clocking`:
 clock_id int(10) primary key
 clock_in int(10)
 clock_out int(10)

 In table `clocking`, clock_id is already indexed because it's primary.
 Be sure to index clock_id in `users` so that when you join on the two,
 you'll have optimal speed!

 ALTER TABLE `users` ADD INDEX (`clock_id`);

 And an example query...

 SELECT `u`.`user_id`, `c`.`clock_in`, `c`.`clock_out` FROM `users` `u`
 INNER JOIN `clocking` `c` ON `u`.`clock_id` = `c`.`clock_id` WHERE
 (`u`.`user_id` = '$user_id' AND `c`.`clock_in`  'sometime' AND
 `c`.`clock_out`  'someothertime');

 Something along those lines. I always find it useful to have unique
 names throughout the database, so if you reference a name, you know
 where it originated. Because of this, I can just look at `users` and
 determine that `clock_id` is a foreign key.

 Hope that helps a little!

 ~Philip


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] MySQL Reporting Tool

2008-09-04 Thread Micah Gersten
Anyone use one, hopefully written in PHP?

-- 


Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] MySQL Reporting Tool

2008-09-04 Thread Micah Gersten
Anything Open Source?  One of my friends uses SQL Server Reporting
Services and was wondering if there is a similar product for MySQL.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Chris wrote:
 Micah Gersten wrote:
 Anyone use one, hopefully written in PHP?

 To report on what?

 Or you mean something like crystal reports where you can make up your
 own stuff?

 crystal reports supports odbc so will be able to hook into mysql.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Micah Gersten
What does mysql_error return?

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



David DURIEUX wrote:
 Bonjour,


 string(40) SELECT * FROM table WHERE id=107  
 string(3) 107
 string(38) DELETE FROM table WHERE id=107  
 string(3) 107 



 Cordialement,

 David DURIEUX
 Tel : 04.74.04.81.34
 Port : 06.34.99.45.18
 Mail : [EMAIL PROTECTED]
 Site Web : http://www.siprossii.com/

 SIPROSSII
 847 route de Frans (Créacité)
 69400 Villefranche sur Saône



 Le Wed, 3 Sep 2008 11:37:37 +0200
 Evert Lammerts [EMAIL PROTECTED] a écrit:

   
 If that doesn't work then var_dump($sql, $var) and write us the
 result. Also let us know the data type of the ID column.
 


   

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Probleme with MySQL queries

2008-09-03 Thread Micah Gersten
You have to pass mysql_num_rows a $result variable from your query.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



David DURIEUX wrote:
 Bonjour,



 Cordialement,

 David DURIEUX
 Tel : 04.74.04.81.34
 Port : 06.34.99.45.18
 Mail : [EMAIL PROTECTED]
 Site Web : http://www.siprossii.com/

 SIPROSSII
 847 route de Frans (Créacité)
 69400 Villefranche sur Saône

 ID is INT. It's ok before.

 I have errors : 


 Warning: Wrong parameter count for mysql_num_rows()
 in /usr/home/sites/CL01/Web_data/hebergement/pages/sousdomaines.php
 on line 7 string(0)  NULL

 Warning: Wrong parameter count for mysql_num_rows()
 in /usr/home/sites/CL01/Web_data/hebergement/pages/sousdomaines.php
 on line 12 string(0)  NULL

 Warning: Wrong parameter count for mysql_num_rows()
 in /usr/home/sites/CL01/Web_data/hebergement/pages/sousdomaines.php
 on line 16 string(0)  NULL 



 Le Wed, 3 Sep 2008 12:11:00 +0200
 Evert Lammerts [EMAIL PROTECTED] a écrit:

   
 In fact the first return 0 results
   
 So the problem is in your select, and if your select works when you
 manually insert the value for id (iow, without using $var), the
 problem has something to do with $var.

 Is the data type of the ID column INT? Try the following and let us
 know the output:

 $var=107;
 $query = mysql_query(SELECT * FROM table WHERE id={$var};) or
 die(mysql_error()); // make sure to use double quotes
 var_dump(mysql_error(), mysql_num_rows());

 $var=mysql_real_escape_string(107);
 $query = mysql_query(SELECT * FROM table WHERE id={$var};) or
 die(mysql_error()); // make sure to use double quotes
 var_dump(mysql_error(), mysql_num_rows());

 $query = mysql_query(SELECT * FROM table WHERE id=107;) or
 die(mysql_error()); // make sure to use double quotes
 var_dump(mysql_error(), mysql_num_rows());

 


   

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Im new to this but...

2008-09-02 Thread Micah Gersten
In the HTML, you either need to use ?php echo $title; ?  or, if you
have short tags on,  ?= $title ?, not ?php $title ?.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Chris Hale wrote:
 I have:
 Apache 2.0.59
 MySQL 5.0.41
 PHP 4.4.7  5.2.5

 and this is my program:

 ?php
 session_start();
 include(includes/functions_main.php);
 include(Vars.php);
 ?   ?php get_header(); ?
 ?php get_sidebar(); ?
 ?php
$page = '$_GET[page]';
$cxn = mysqli_connect($host, $user,$passwd, $database) or die
 (Can't Connect.);
$sql = SELECT * FROM page WHERE id=$page;
$result = mysqli_query($cxn, $sql);
$row = mysqli_fetch_assoc($result);
extract ($row);
 ?
 div id=column_right
div class=content
h2?php $title ?/h2
?php $content ?
/div
 /div
 ?php get_footer();?


 But i get an error every time. I have read PHP and MySQL for Dummies
 to get me started but none of the things in the book seem to work for
 me. It is very frustrated. I dont know whether it just my lameass host
 provider that hasn't set the mysql properly.

 I would appreciate any help.

 Thanks


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Adding br's

2008-09-01 Thread Micah Gersten
Check this function out for the line breaks:
http://us.php.net/nl2br

Not quite sure what to do for the bold thing.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Ron Piggott wrote:
 I have the following saved in one column of a mySQL table:

 Like
 Overcome
 Vested
 Embrace

 It is an anagram for the word Love

 I am querying the table to display the results.  I am needing help with
 the formatting part of this.

 I have this line of code:

 $anagram=mysql_result($anagram_result,$i,anagram);


 I need help adding br's so each word will be on a new line.  Within
 the table column each word is on a separate line.  It would also be
 really cool if the first letter was in bold (ie bX/b )

 echo stripslashes($anagram)

 Thanks,

 Ron


   

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with updating MySQL table

2008-08-27 Thread Micah Gersten
Putting commands into input containers in HTML is deprecated in the
XHTML specification.  You should use this instead in the input:

readonly=readonly

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Jason Pruim wrote:

 On Aug 27, 2008, at 12:48 PM, Jason Pruim wrote:


 For everyone that has helped me on this thank you! :) the solution was
 changing from: input type=text name=txtFName DISABLED to input
 type=text name=txtFName READONLY Read only fields still get
 passed with POST'ed info where as disabled does not.

 And yes I will be adding some prepared statements to prevent SQL
 injections as I'm hoping this will be a VERY popular feature that will
 be used by my company for quite a long time :)


 -- 

 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 11287 James St
 Holland, MI 49424
 www.raoset.com
 [EMAIL PROTECTED]






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] PHP Self pages

2008-08-12 Thread Micah Gersten
Try this:
http://xajaxproject.org/

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



[EMAIL PROTECTED] wrote:
 I have three PHP pages that post data to each consecutive page.

 I would like the second page, the one with a pull down menu of customer ids, 
 to spawn itself onto the next page so that the person using it would not have 
 to click back to choose the next customer id.

 Currently the first page captures and posts a date to the second page and the 
 second page generates the pull down with values and has a get data submit 
 button to forward to the third page where all the data is displayed.

 How can I merge the second and third page together so that once a value is 
 selected in the pull down and then the get data button is clicked it just 
 populates the data right next to the pull down?

 Script for page 2 and 3 below:

 PAGE2:
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
 head
 titleToday's Customers/title
 meta http-equiv=content-type
 content=text/html; charset=iso-8859-1 /
 /head
 body
 ?php
 $conn = odbc_connect(HOMES, , );
 $billdate = $_POST[ 'billdate' ];
 $query = (SELECT DISTINCT sls_his_cust_id FROM sls_his where 
 sls_his_prchdat_alt = $billdate);
 $result = odbc_exec($conn, $query);

 echo  form method=post action=getcustdata.php;
 echo  SELECT name=sls_his_cust_id;
 while($row = @odbc_fetch_array($result))
 {
 echo  OPTION 
 VALUE=\$row[sls_his_cust_id]\$row[sls_his_cust_id]/OPTION;
 }
 echo  /SELECTINPUT TYPE=submit name=custid VALUE=\Get Data\/FORM;
 ?
 /body
 /html

 PAGE3:
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
 head
 titleCustomer Information/title
 meta http-equiv=content-type
 content=text/html; charset=iso-8859-1 /
 /head
 body background=afi.jpg
 ?php
 $conn = odbc_connect(HOMES, , );
 $sls_his_cust_id = $_POST[ 'sls_his_cust_id' ];
 $query1 = (SELECT DISTINCT sls_his_d2_nam as 'Customer Name',
 cust_phone_no as 'Phone Number 1',
 cust_phone_no_2 as 'Phone Number 2',
 cust_phone_no_3 as 'Phone Number 3'
 FROM sls_his , cust
 where CUST_ID = SLS_HIS_CUST_ID
 and sls_his_cust_id = '$sls_his_cust_id');
 $query2 = (SELECT DISTINCT sls_his_pft_ctr as 'Profit Center',
 UPPER(slm_nam) as 'Sales Person'
 FROM sls_his, slm
 where sls_his_slm_1 = slm
 and sls_his_cust_id = '$sls_his_cust_id');
 $query3 = (SELECT sls_his_item_id as 'Item ID',
 sum(sls_his_qty_sld) as 'Quantity Sold',
 sls_his_prchdat_alt as 'Billed Date'
 FROM sls_his
 where sls_his_cust_id = '$sls_his_cust_id'
 Group by sls_his_item_id, sls_his_prchdat_alt
 Order by sls_his_prchdat_alt);
 $result1 = odbc_exec($conn, $query1);
 $result2 = odbc_exec($conn, $query2);
 $result3 = odbc_exec($conn, $query3);
 odbc_result_all($result1)

 ?
 /BR
 ?php
 odbc_result_all($result2)

 ?
 /BR
 ?php
 odbc_result_all($result3)

 ?
 /body
 /html 

   

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] I want to remove the last comma

2008-08-12 Thread Micah Gersten
Create an Array in the loop and then join with ,\n.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



A. Joseph wrote:
 This the script
 $dir = images;
 $d = opendir($dir);
 $out = 
 var tinyMCEImageList = new Array(\n;
 while(false != ($entry = readdir($d))) {
 if(preg_match(/(.jpg|.gif|.png)$/, $entry) != false) {
 $out .= ['{$entry}', '{$dir}/{$entry}'],\n;
 }

 }
 $out .= );\n;

 This the out put

 var tinyMCEImageList = new Array(
 ['1_h_1.gif', 'images/1_h_1.gif'],
 ['1_h_2.gif', 'images/1_h_2.gif'],
 ['rss_2.jpg', 'images/rss_2.jpg'],
 ['spacer.gif', 'images/spacer.gif'],  #  I want to remove this comma
 );

 if the last element (['spacer.gif', 'images/spacer.gif'],) contain comma,
 javascript will return error, so i want to remove it.

   

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Help to improve MySQL query

2008-08-11 Thread Micah Gersten
Use an appropriate status.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Dee Ayy wrote:
 On Fri, Aug 8, 2008 at 5:25 PM, Micah Gersten [EMAIL PROTECTED] wrote:
   
 How about select Incidents.* from Incidents inner join Calls on
 Incidents.id=Calls.incidentid where Calls.status='Open'?
 
 ...
   
 Dee Ayy wrote:
 
 ...
   
 The status column never has the text Open.
   
 ...
   

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] $_SESSION issues - possible security hole?

2008-08-10 Thread Micah Gersten
There's your answer.  With register_globals on $_SESSION['rights']
becomes $rights  and when you do extract($row) you are overwritting the
$_SESSION variable.  A safer way of  using your code would be:

while ($row = mysql_fetch_array($result1, MYSQL_ASSOC))

{

   ?
option value=?=$row['user']??=$row['fname']? ?=$row['lname']? - 
?=$row['user']?
?


Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Darron Butler wrote:
 Thanks for your thoughts. To answer your first question, I'm using extract()
 because this is a page where admins and super users can edit the permissions
 of others for the site. Therefore, I have to query the database to create a
 listing of all users, and then have the admin/super user select one to
 modify (I was planning to serve the 'rights' informatin from the selected
 user via POST to another page where changes could be made). sometimes the
 user and rights that I get assigned when I hit refresh are another user
 with super rights and sometimes one with less than super rights and then I
 get sent to the 'die' landing page. I'm a real newbie at PHP/MySQL, so if
 there is a better/easier/more efficient way of creating the select list, I'm
 just not aware of how to do it. I just tried removing the extract statement
 and the select list is now empty...

 I'm using a free PHP/MySQL host online so I don't have access to make
 register_global changes, but I did find in the documentation that they have
 it set to on. On a similar note, the variable $_SESSION['rights'] does
 certainly exist, it exists for the admin/super user logged in and accessing
 the administration page.

 What's interesting about this whole thing is that I have changed the query
 to include non session variables I have set and everything works fine. For
 instance (to clarify) since I set $_SESSION['user'] and $_SESSION['rights']
 when the user logs in, if my query to create the selection list is based on
 any other table columns (for instance, fname and lname and NOT user or
 rights) then the weird behavior does not show up. Having gone thru
 that...somehow, someway, the query of all user info seems to change the
 session variables. I appreciate your brain power thinking thru this! Any new
 thoughts? drb
 On Sun, Aug 10, 2008 at 2:33 PM, Evert Lammerts [EMAIL PROTECTED]wrote:

   
 Why use extract()? Try commenting it out... apart from it being
   
 If you use 'register globals' there's a good chance that a variable
 $rights exists because it's a key in your $_SESSION array (don't shoot
 me if I'm wrong, I've never worked with 'register globals'). By using
 extract() without the $type parameter (so with EXTR_OVERWRITE set),
 the $type variable is overwritten.

 So do try commenting it out.

 

   

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Help to improve MySQL query

2008-08-08 Thread Micah Gersten
How about select Incidents.* from Incidents inner join Calls on
Incidents.id=Calls.incidentid where Calls.status='Open'?

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Dee Ayy wrote:
 A database was designed with the following tables:

 Incidents
 _
 id (auto incremented int)
 ...

 Calls
 _
 id (auto incremented int)
 incidentId (foreign key)
 status (varchar 32)
 ...

 The status of the last Call is the status of the related Incident.
 Statuses can be Not started through various states up to Completed.
 The status column never has the text Open.
 If the last Call for the related Incident is not Completed, then it
 is considered to be Open.

 My task is to getIncidentsWithStatus(Open) using PHP.

 The existing inefficient method is in the PHP function
 getIncidentsWithStatus($status = Open), made worse by mingling with
 PHP and then another MySQL query.  It first finds
 $theHugeListOfIncidentIds of the last Calls OF ALL INCIDENTS, then
 uses Calls.id IN ($theHugeListOfIncidentIds) AND Calls.status NOT LIKE
 'Completed'.  The reason this was done was that if Calls.status NOT
 LIKE 'Completed' was used first, then the result would include all
 Incidents.

 A) What would be an efficient MySQL query with the database in the
 present state to getIncidentsWithStatus(Open)?

 I can think of two alternatives, which require the database to be modified:
 1a) Add a trigger to update a new column named statusFromCall in the
 Incidents table when the Calls.status is updated.
 1b) Add PHP code to update the new column named statusFromCall in
 the Incidents table when the Calls.status is updated.
 2) Then just query for Incidents WHERE statusFromCall NOT LIKE 'Completed'.

 B) What would be the MySQL query to create such a trigger in 1a?

 Thanks.

   

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Anyone use FileMaker

2008-08-07 Thread Micah Gersten
I'm wondering if anyone here has experience integrating FileMaker with
PHP using either ODBC or JDBC.

-- 


Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com




-- 


Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] PHP5 and Multiple Database Connections

2008-08-05 Thread Micah Gersten
Have you tested the DSN outside of PHP?  Openoffice.org Database has
facilities to test ODBC connections.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com


[EMAIL PROTECTED] wrote:
 Hello Everyone!

 I am currently writing a sequence of php pages to help me retrieve data from 
 a Pervasive 9.5 database, display that data in my web browser with a form 
 built in to collect more data, and then will push the retrieved Pervasive 
 data and the input data to MySQL.

 I am having problems getting PHP to retrieve the data from Pervasive. I know 
 the query is sound as I run it all the time on the Control Center, but I 
 cannot get the ODBC connector to work in the page itself.

 I am also concerned that I will not be able to get the page to push the data 
 to MySQL once I do get it to retrieve.

 Is this possible?

   

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] PHP5 and Multiple Database Connections

2008-08-05 Thread Micah Gersten
What does the connector return to you when you connect in PHP?

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



[EMAIL PROTECTED] wrote:
 Yes I am sure the ODBC works as it is installed on my laptop and I use Excel 
 to import many various queries of data.
  -- Original message --
 From: Micah Gersten [EMAIL PROTECTED]
   
 Have you tested the DSN outside of PHP?  Openoffice.org Database has
 facilities to test ODBC connections.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com


 [EMAIL PROTECTED] wrote:
 
 Hello Everyone!

 I am currently writing a sequence of php pages to help me retrieve data 
 from a 
   
 Pervasive 9.5 database, display that data in my web browser with a form 
 built in 
 to collect more data, and then will push the retrieved Pervasive data and 
 the 
 input data to MySQL.
 
 I am having problems getting PHP to retrieve the data from Pervasive. I 
 know 
   
 the query is sound as I run it all the time on the Control Center, but I 
 cannot 
 get the ODBC connector to work in the page itself.
 
 I am also concerned that I will not be able to get the page to push the 
 data 
   
 to MySQL once I do get it to retrieve.
 
 Is this possible?

   
   
 -- 
 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] PHP5 and Multiple Database Connections

2008-08-05 Thread Micah Gersten
Is it set up as a system DSN or User DSN.  Try testing an app as the
same user as the webserver and see if you can connect to the DSN.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



[EMAIL PROTECTED] wrote:
 Here are the messages that are currently displayed and my current script:

 Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC 
 Driver Manager] Data source name not found and no default driver specified, 
 SQL state IM002 in SQLConnect in D:\xampp\htdocs\test2.php on line 11

 Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in 
 D:\xampp\htdocs\test2.php on line 17

 Warning: odbc_result_all(): supplied argument is not a valid ODBC result 
 resource in D:\xampp\htdocs\test2.php on line 19

 Warning: odbc_close(): supplied argument is not a valid ODBC-Link resource in 
 D:\xampp\htdocs\test2.php on line 21


 // BEGIN SCRIPT //

 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
 head
 titleToday's Customers/title
 meta http-equiv=content-type
 content=text/html; charset=iso-8859-1 /
 /head
 body
 ?php

 $conn = odbc_connect(HOMES, , );

 $query = (SELECT sls_his_cust_id FROM CUST where sls_his_prchdat_alt = 
 20080801);

 $result = odbc_exec($conn, $query);

 odbc_result_all($result);

 odbc_close($conn);
 ?
 /body
 /html

 // END SCRIPT //

 HOMES is created on the local server as a DSN using the Pervasive ODBC 
 connector and I know it works because I have used it with SQLyog to migrate 
 data unto MySQL


  -- Original message --
 From: Micah Gersten [EMAIL PROTECTED]
   
 What does the connector return to you when you connect in PHP?

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 [EMAIL PROTECTED] wrote:
 
 Yes I am sure the ODBC works as it is installed on my laptop and I use 
 Excel 
   
 to import many various queries of data.
 
  -- Original message --
 From: Micah Gersten [EMAIL PROTECTED]
   
   
 Have you tested the DSN outside of PHP?  Openoffice.org Database has
 facilities to test ODBC connections.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com


 [EMAIL PROTECTED] wrote:
 
 
 Hello Everyone!

 I am currently writing a sequence of php pages to help me retrieve data 
 from 
   
 a 
 
   
   
 Pervasive 9.5 database, display that data in my web browser with a form 
 built 
 
 in 
 
 to collect more data, and then will push the retrieved Pervasive data and 
 the 
 input data to MySQL.
 
 
 I am having problems getting PHP to retrieve the data from Pervasive. I 
 know 
   
   
 the query is sound as I run it all the time on the Control Center, but I 
 
 cannot 
 
 get the ODBC connector to work in the page itself.
 
 
 I am also concerned that I will not be able to get the page to push the 
 data 
   
   
 to MySQL once I do get it to retrieve.
 
 
 Is this possible?

   
   
   
 -- 
 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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] How to import data from Oracle 10g to MySQL 5.0

2008-07-30 Thread Micah Gersten
Have you looked into PHPMyAdmin?
http://www.phpmyadmin.net/home_page/index.php

There's an option for importing an oracle sql file.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



santoso berkah wrote:
 Dear friends,

 I would ask to you about the tools or references for importing data 
 from Oracle 10g to MySQL 5.

 Thank you for your kindness.

 Regards,
 im_id


   

   

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Run SQL query when click on OK button of warning message

2008-07-27 Thread Micah Gersten
While sempsteen is correct, you can achieve the correct effect in this
simple scenario by checking the return value of the confirm button.

input type=submit value=Delete Record onsubmit=return confirm ('Are you 
sure you want to delete this record!!'); /


And then check for the submit...
This is prone to a lot of problems though if this is your only security measure.

You might want to check out this library if you want to do this type of thing 
often and have useful interaction:
http://xajaxproject.org/

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



sempsteen wrote:
 It seems you've a long way to go. Here is what i can say for you.
 First of all PHP and JavaScript are two different programming
 languages, running in different environments. JavaScript is a
 client-side language which your browser interprets it with the page is
 loaded. PHP is a server-side language which gets your source code,
 interprets it and sends to the browser. There is no any connection
 with these two languages. So you cannot write a PHP code and bind it
 to a JavaScript code.
 You can only make an HTTP request to PHP page by either redirecting or
 you can make AJAX requests.
 Good luck.

 On Sun, Jul 27, 2008 at 10:03 PM, Nasreen Laghari
 [EMAIL PROTECTED] wrote:
   
 Hi All,

 I am printing a java script warning message. On pressing OK button, I want
 to run an sql query. Below is the way I have tried but sql query is running
 either press OK or Cancel button on warning message or even refresh the page
 (F5). Also redirection, when press OK, also not working.


 Am I using the right approach? Could any 1 please help me to sort this
 problem.


 Regards,

 Nasreen



 trtd
 input type=button onClick=var answer = confirm ('Are you sure you want
 to delete this record!!')
  if (answer)
  {
   ?php

$sqldel = DELETE FROM artist where aid = '$id';
mysql_query($sqldel) or die(mysql_error());
//header(Location: artist.php);
//window.location=http://www.yahoo.com/;
   ?
  }
  else
  {
   window.location='index.php'
   } value=DELETE
 /td/tr

 

   

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Mysql logs

2008-07-23 Thread Micah Gersten
You have to edit your my.cnf file.  Here's a link to the docs:
http://dev.mysql.com/doc/refman/5.0/en/log-files.html

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Manoj Singh wrote:
 Hi All,

 Please help me to set the logging on in mysql. I am using the following
 command when starting mysql:

 service mysqld start --log=/usr/local/


 But logging is not maintained through this command.

 Best Regards,
 Manoj Kumar Singh

   

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php