Re: [PHP-DB] PHP Exercises

2008-10-31 Thread Twaha Uddessy
Yves,
Thank you for the link.I will go through it.
cheers






From: Yves Sucaet <[EMAIL PROTECTED]>
To: php-db@lists.php.net
Sent: Friday, October 31, 2008 3:52:06 PM
Subject: Re: [PHP-DB] PHP Exercises

Hi Twaha,

Have a look at a short-course curriculum that we developed over summer:

http://lab.bcb.iastate.edu/training/webdev/nmsu/

hth,

Yves

- Original Message - From: "Twaha Uddessy" <[EMAIL PROTECTED]>
To: 
Sent: Friday, October 31, 2008 2:19 AM
Subject: [PHP-DB] PHP Exercises


> Hello all,
> Iam new here,trying  hard to study PHP.Can anyone  help me  with a link where 
> I can get PHP exercises and possible solution?.
> Thank you in advance
> 
> 
> 
> 



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


  

Re: [PHP-DB] PHP Exercises

2008-10-31 Thread Twaha Uddessy
Isaak,
Thank you for your  advice.Got one book.
Thank you again





From: Isaak Malik <[EMAIL PROTECTED]>
To: php-db@lists.php.net
Sent: Friday, October 31, 2008 3:13:14 PM
Subject: Re: [PHP-DB] PHP Exercises

In my opinion the best way to learn it is by getting a book from your local
library as reading from the screen can get very exhausting after a while.
The manual is only good to increase your knowledge when you already know the
basics.

-- 
Isaak Malik
Web Developer



  

Re: [PHP-DB] PDO bindValue ORDER BY

2008-10-31 Thread Post TUDBC
Technically, bound parameter is expecting a value, such as
WHERE ID=:id
However, ORDER BY is followed by a field name, such as
   ORRDER BY ID
So I don't think it should work.

If it does work, then it is a sign that the database driver is not
really preparing the statement (as it should for performance reason),
but it is just substituiting values to compose a SQL (just for your
convenience).

On 10/31/08, Matthew Peltzer <[EMAIL PROTECTED]> wrote:
> Are pdo bound parameters within an ORDER BY clause broken in php 5.2.5?
>
>  I find that in php 5.2.6 this works as expected:
>
>$sql = 'SELECT * FROM `table` ORDER BY :sort';
>  $stmt = $pdo->prepare($sql);
>  $stmt->bindValue(':sort', $sort, PDO::PARAM_STR);
>  $stmt->execute();
>  print_r($stmt->fetchAll(PDO::FETCH_ASSOC));
>  ?>
>
>  but under php5.2.5 the ORDER BY clause silently fails.  Also,
>  parameters bound to SELECT or WHERE or LIMIT clauses function
>  correctly, but ORDE BY still has no effect.  If I remove the
>  "$stmt->bindValue(':sort', $sort, PDO::PARAM_STR);" line or the "ORDER
>  BY :sort" I get a "number of bound variables does not match number of
>  tokens" error.
>
>  So it appears the parsing mechanism is funcitoning, but what ever is
>  responsible for binding to ORDER BY is not.
>
>  I've looked in bug reports and the change logs, but did not find a
>  explicit reference to this issue.
>
>
>  --
>  -- Matthew Peltzer
>  -- [EMAIL PROTECTED]
>
>
>  --
>  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: MySQL Conditional Trigger

2008-10-31 Thread Dee Ayy
On Fri, Oct 31, 2008 at 11:09 AM, Dee Ayy <[EMAIL PROTECTED]> wrote:
> ...
> IF OLD.ShipDate != NEW.ShipDate AND NEW.ShipDate IS NOT NULL THEN
> ...

The following seems to work.  Is it correct and not too verbose?
IF (OLD.StatusShipDate IS NULL AND NEW.StatusShipDate IS NOT NULL) OR
(OLD.StatusShipDate != NEW.StatusShipDate AND NEW.StatusShipDate IS
NOT NULL) THEN

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



[PHP-DB] PDO bindValue ORDER BY

2008-10-31 Thread Matthew Peltzer
Are pdo bound parameters within an ORDER BY clause broken in php 5.2.5?

I find that in php 5.2.6 this works as expected:

prepare($sql);
$stmt->bindValue(':sort', $sort, PDO::PARAM_STR);
$stmt->execute();
print_r($stmt->fetchAll(PDO::FETCH_ASSOC));
?>

but under php5.2.5 the ORDER BY clause silently fails.  Also,
parameters bound to SELECT or WHERE or LIMIT clauses function
correctly, but ORDE BY still has no effect.  If I remove the
"$stmt->bindValue(':sort', $sort, PDO::PARAM_STR);" line or the "ORDER
BY :sort" I get a "number of bound variables does not match number of
tokens" error.

So it appears the parsing mechanism is funcitoning, but what ever is
responsible for binding to ORDER BY is not.

I've looked in bug reports and the change logs, but did not find a
explicit reference to this issue.


-- 
-- Matthew Peltzer
-- [EMAIL PROTECTED]

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



[PHP-DB] MySQL Conditional Trigger

2008-10-31 Thread Dee Ayy
I don't think my trigger likes a comparison with a variable which is
NULL.  The docs seem to have a few interesting variations on playing
with NULL and I was hoping someone would just throw me a fish so I
don't have to try every permutation (possibly using CASE, IFNULL,
etc.).

If my ShipDate (which is a date datatype which can be NULL) changes to
a non-null value, I want my IF statement to evaluate to TRUE.
IF NULL changes to aDate : TRUE
IF aDate changes to aDifferentDate : TRUE
IF anyDate changes to NULL : FALSE

In my trigger I have:
...
IF OLD.ShipDate != NEW.ShipDate AND NEW.ShipDate IS NOT NULL THEN
...

Which only works when ShipDate was not NULL to begin with.
I suppose it evaluates the following to FALSE
IF NULL != '2008-10-31' AND '2008-10-31' IS NOT NULL THEN
(not liking the "NULL != '2008-10-31'" part)

Please give me the correct syntax.
TIA

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



Re: [PHP-DB] PHP Exercises

2008-10-31 Thread Yves Sucaet

Hi Twaha,

Have a look at a short-course curriculum that we developed over summer:

http://lab.bcb.iastate.edu/training/webdev/nmsu/

hth,

Yves

- Original Message - 
From: "Twaha Uddessy" <[EMAIL PROTECTED]>

To: 
Sent: Friday, October 31, 2008 2:19 AM
Subject: [PHP-DB] PHP Exercises



Hello all,
Iam new here,trying  hard to study PHP.Can anyone  help me  with a link 
where I can get PHP exercises and possible solution?.

Thank you in advance








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



Re: [PHP-DB] PHP Exercises

2008-10-31 Thread Isaak Malik
In my opinion the best way to learn it is by getting a book from your local
library as reading from the screen can get very exhausting after a while.
The manual is only good to increase your knowledge when you already know the
basics.

-- 
Isaak Malik
Web Developer


Re: [PHP-DB] PHP Exercises

2008-10-31 Thread Twaha Uddessy
Sanjay,
Thanks for your help!.I will go through it.
Twaha





From: Sanjay Mantoor <[EMAIL PROTECTED]>
To: Twaha Uddessy <[EMAIL PROTECTED]>
Cc: php-db@lists.php.net
Sent: Friday, October 31, 2008 11:36:20 AM
Subject: Re: [PHP-DB] PHP Exercises

Twaha,

I found PHP manual is best.
Refer http://www.php.net/manual/en/


On Fri, Oct 31, 2008 at 1:49 PM, Twaha Uddessy <[EMAIL PROTECTED]> wrote:
> Hello all,
> Iam new here,trying  hard to study PHP.Can anyone  help me  with a link where 
> I can get PHP exercises and possible solution?.
> Thank you in advance
>
>
>
>



-- 

Sanjay Mantoor



  

Re: [PHP-DB] PHP Exercises

2008-10-31 Thread Sanjay Mantoor
Twaha,

I found PHP manual is best.
Refer http://www.php.net/manual/en/


On Fri, Oct 31, 2008 at 1:49 PM, Twaha Uddessy <[EMAIL PROTECTED]> wrote:
> Hello all,
> Iam new here,trying  hard to study PHP.Can anyone  help me  with a link where 
> I can get PHP exercises and possible solution?.
> Thank you in advance
>
>
>
>



-- 

Sanjay Mantoor

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



[PHP-DB] PHP Exercises

2008-10-31 Thread Twaha Uddessy
Hello all,
Iam new here,trying  hard to study PHP.Can anyone  help me  with a link where I 
can get PHP exercises and possible solution?.
Thank you in advance



  

Re: [PHP-DB] pagination php mysql

2008-10-31 Thread Thodoris


I am implementing pagination on my php script, pagination is already 
working, the result is displayed as checkboxes for users to check their

choices. my prob is if i have more than 1 page, users should be able to
choose from all 4 pages,



one solution is creating a temporal table, which can be re-created and
dropped when starting and ending the user session (table name can be
an unique_ID). Then, the checkbox selections are inserted, deleted,
etc.. with mysql_functions every time the user change every page.
  


And how do you suggest that the data will be kept when the user goes to 
page 2?


The session will end and the temporary table will be destroyed. So this 
is probably not so wise don't you think ?



Another solution is adding the ID of every selected checkbox to a
cookie or session variable in format 1,5,42,87,412... etc.  Then you
can manage the selections changes by reading the array elements using
a for... when the user change every page:

$foo = array_unique($foo); // checkbox selections
if (count($foo) > 0) {
   // loop through the array of selections
   for ($i=0;$i

  // read and write the session_var to update, delete, etc..
  if (eregi($foo[$i], $session_var)) {  // if exists ...etc

  }
  //...

   }
} 
  


Cookie is a good choice although if the checkboxes are many your cookie 
will grow. Your problem here is how you can maintain data between pages 
in order to keep all the users options. This problem has many solutions: 
cookies, sessions, memcache, database etc.


The problem that you will a mechanism that will control the data.


When the user ends, you will have a temporal table or a session
variable with all his checkboxes selected. 
  


Oh now I get it !! by temporary table you don't really mean a temporary 
table like that:

http://archive.devwebpro.com/devwebpro-39-20010817Temporary-Tables-With-MySQL.html

but a table you will not use permanently. But AFAIK changing schema is 
bad practice. Why not just keep the table and use it for this use?

First method is slower but more secure. Second is speediest but it can
have more failures because are session vars or cookies.  It depends of
your control errors and also the visits profile.

  

I wouldn't bet on that I think it depends on the case.

Hope it helps,


  


--
Thodoris



Re: [PHP-DB] MySQL Query Timeout program in PHP

2008-10-31 Thread Thodoris



Man- when the query is fired through the web interface- it rans on
mysql server

max_execution_time - wont' help evn I stop apache itself...
  


Yes it will. Apache will be instructed to stop execution of any script 
by the mod_php module (assuming you are using mod_php). But mysql 
process probably won't stop running (not 100% sure for that) although 
php script has timed out.

The query runs on mysql server - so I have to kill the PID on server itself...
  


In order to do this you will need (in the unix world) to have rights to 
kill mysql processes. That means that you must become either root or the 
mysql user which is not that simple since everything that apache runs is 
usually running as the apache or the www user who can't kill those 
processes (at least if he can't su exec).


I will have to note here that this is a bad practice of doing things...

Thanks
Piyush

On Thu, Oct 16, 2008 at 7:57 AM, Jack van Zanen <[EMAIL PROTECTED]> wrote:
  

Just put the time out in your PHP.INI file

max_execution_time = 30 ; Maximum execution time of each script, in
seconds




This is probably a solution although you will have to know what to 
expect if you query a table with 3M records. It will be slow and that 
can't change. Try using "LIMIT" when sending queries to stop mass data 
retrieval.



2008/10/16 Piyush Kumar <[EMAIL PROTECTED]>


I'm using http://myclient.polarlava.com/ as web query interface for mysql
server

Now I want to add "Query Timeout" functionality to it
  


Every apache process has a timeout limit you can leave the user wait for 
a page a lifetime.



For that I need to get the PID for last ran mysql query and then using
kill
PID - I can kill the process on MySQL server

  

Sorry but I still can't see why.


Please explain how to do that in PHP Thanks!

Similar to what described @ http://bytes.com/forum/thread156058.html


--
Thanks & Regards,
-Piyush
Mo.: 091-9910904233
Mail: [EMAIL PROTECTED]
Web: http://piyush.me/

-In a world without fences, limits, boundaries and walls, Who needs
Windows and Gates?

  


Although some think that limits are wrong I still have walls around my 
house. Windows are not so bad sometimes everything has its use. Besides 
everyone needs to be annoyed from time to time.

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

  


--
J.A. van Zanen






  


--
Thodoris