[PHP] mysql and php questions

2012-09-03 Thread Littlefield, Tyler

Hello all:
I had a few questions.
First, I'm using php-fastcgi with nginx for my primary web server. I was 
wondering what sorts of optimizations exist to make this process a lot 
faster.
Second, I'm setting up a custom application, and it contains an 
authentication module for login/registration. In doing this, I 
discovered PDO (I used to just use the mysql_* functions). According to 
google, it's easier to prevent mysql injection attacks with PDO, so I 
dove in.
Before, I was using $pdo-exec(...);, but I read that I need to call 
quote on the variables I'm passing in. It looks like that all quote does 
is just add '...' on the variables, but I could be wrong.

So, here's my questions:
First, I know that prepared statements are immune to mysql injection 
attacks, if I just use the variables with placeholders in the 
statements. I know that caching these means that the optimization does 
not have to be done every time, but is this the most efficient method 
for adding a single user for registration? Or would a basic query be better.
Also, I had the idea of building up common queries and cacheing them, 
but this isn't really possible since each php script (as far as I'm 
aware) gets it's own process or environment. If I can build the prepared 
statements and cache them, it seems like things would be a lot quicker. 
Is this something commonly done?


--
Take care,
Ty
http://tds-solutions.net
The aspen project: a barebones light-weight mud engine:
http://code.google.com/p/aspenmud
He that will not reason is a bigot; he that cannot reason is a fool; he that 
dares not reason is a slave.


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



[PHP] MySQL and PHP weirdness

2012-02-14 Thread Richard S. Crawford
Bear with me here. I have a problem with PHP and MySQL that's been stumping
me for a couple of days now. I'm not even sure how to describe it, so I'll
just do my best.

There's a row in our bugs database that looks like every other row in the
table, but when it's pulled from the database and displayed in PHP, the
description field -- which is defined as a mediumtext field -- is
displayed as a date field with a value of 12/31/1969. Moreoever, when I use
PHPMyAdmin to look at the row directly, the description field has the
data that I expect it to.

Just for fun, here's the text in question:

Quarterly Course Set Up - Spring 2012 (114)
Section  Course titleCourse Start Date
114MHI214 The Internet and the Future of Patient Care 04/02/2012
114MHI212 Health Information Systems Analysis and Design  04/02/2012
Program administrator 2 users; Laurel Aroner - Susan Catron - Jennifer
Kremer
Instructors;
MHI214; Peter Yellowlees
MHI212; Robert Balch
Per instructions from Rita Smith-Simms - I'm creating this task for myself
and based on instructions given which are that all listed courses are now
to be backed-up and restored sooner (original course set up time-frame was
a month before course starts).
Adding instructions - Follow the 52-step quarterly course set up process
and information from the course matrix; if matrix incomplete, input
information during this set up
As you track your time each day, please include in the notes which courses
(use project code) you worked on and indicate either working on or
completed.
Create and notify by 2/15/2012


I've made sure there are no odd characters that would mess up how PHP is
displaying the text. I've tried changing the field type from mediumtext
to text but this didn't work.

If anyone has any ideas as to why this might be happening -- or if I just
wasn't clear -- please let me know.


-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com) http://www.underpope.com
Twitter: http://twitter.com/underpope
Facebook: http://www.facebook.com/underpope
Google+: http://gplus.to/underpope


[PHP] mysql and php

2006-04-14 Thread benifactor
i was wondering what is the most secure way to use mysql in php.  is there a 
certain way it should be done or a way that is more secure than another?

iv'e seen it done many ways and was wondering if it was just preference or a if 
there was a reason behind it.

if you guys could post some examples of how you do it and why maybe you could 
help me understand or know of an article or tutorial on the subjecti would 
appreciate it.

Re: [PHP] mysql and php

2006-04-14 Thread Rory Browne
Display the different ways in which you've seen php using mysql, and we'll
see if any one of them is any more secure than another.

Most Security issues can be left to MySQL and the MySQL API.

A few pointers -
Store parameters(username/password) outside the DocuementRoot.
Put your server on local host - or create an ssh/ssl tunnel between the PHP
machine, and the DB.
Cast any numbers, and escape any strings. ( mysql_escape_string )

Configure mysql securely - this is outside the scope of an email.

On 4/14/06, benifactor [EMAIL PROTECTED] wrote:

 i was wondering what is the most secure way to use mysql in php.  is there
 a certain way it should be done or a way that is more secure than another?

 iv'e seen it done many ways and was wondering if it was just preference or
 a if there was a reason behind it.

 if you guys could post some examples of how you do it and why maybe you
 could help me understand or know of an article or tutorial on the subjecti
 would appreciate it.



[PHP] mysql with php

2005-05-20 Thread Rittwick Banerjee
Hi friends,
I am Rittwick Banerjee
and i have made a mysql based  user name and password program but I found 
that
what ever I entered in the user name and password feild the php file dose 
not working.

I set this code for user name and password
$sql =  SELECT `User_name` AND `User_pass` FROM `user` WHERE `User_name`= 
'$_POST[user_id]' AND `User_pass` = '$_POST[user_pass]' 

But this code dose not working properly.
This code dosen't checking if the user name and password is correct or 
incorrect

Please help me with some source code.
Thank you.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mysql with php

2005-05-20 Thread eoghan
$sql = select User_name, User_pass from user where User_name = 
'$_POST[user_id]' and User_pass = '$_POST[user_pass]';

assuming user_id isnt an int
Rittwick Banerjee wrote:
Hi friends,
I am Rittwick Banerjee
and i have made a mysql based  user name and password program but I 
found that
what ever I entered in the user name and password feild the php file 
dose not working.

I set this code for user name and password
$sql =  SELECT `User_name` AND `User_pass` FROM `user` WHERE 
`User_name`= '$_POST[user_id]' AND `User_pass` = '$_POST[user_pass]' 

But this code dose not working properly.
This code dosen't checking if the user name and password is correct or 
incorrect

Please help me with some source code.
Thank you.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] mysql with php

2005-05-20 Thread Jim Moseby
 -Original Message-
 From: Rittwick Banerjee [mailto:[EMAIL PROTECTED]
 Sent: Friday, May 20, 2005 3:59 AM
 To: php-general@lists.php.net
 Subject: [PHP] mysql with php
 
 
 Hi friends,
 
 I am Rittwick Banerjee
 
 and i have made a mysql based  user name and password program 
 but I found 
 that
 what ever I entered in the user name and password feild the 
 php file dose 
 not working.
 
 I set this code for user name and password
 
 $sql =  SELECT `User_name` AND `User_pass` FROM `user` WHERE 
 `User_name`= 
 '$_POST[user_id]' AND `User_pass` = '$_POST[user_pass]' 
 
 But this code dose not working properly.
 This code dosen't checking if the user name and password is 
 correct or 
 incorrect
 
 Please help me with some source code.
 
 Thank you.


Your code seems non-sensical to me. There are lots pf considerations to take
into account with passwords and security, but on a very basic level. heres
what I think you're after:

$sql=select User_pass from user where user_name = $_POST[user_id];
$result=mysql_query($sql);
$row=mysql_fetch_array($result);

if($row[user_pass]==$_POST[user_pass]){
  echo Access Granted!
}else{
  echo Access Denied!
}


JM

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



RE: [PHP] mysql with php

2005-05-20 Thread George Pitcher
Noticed that there was still something missing in this:

$sql = select User_name, User_pass from user where User_name = 
'$_POST['user_id']' and User_pass = '$_POST['user_pass']';

Quotes around the POST Args.

George

 -Original Message-
 From: eoghan [mailto:[EMAIL PROTECTED]
 Sent: 20 May 2005 11:21 am
 To: Rittwick Banerjee
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] mysql with php
 
 
 $sql = select User_name, User_pass from user where User_name = 
 '$_POST[user_id]' and User_pass = '$_POST[user_pass]';
 
 assuming user_id isnt an int
 
 Rittwick Banerjee wrote:
  Hi friends,
  
  I am Rittwick Banerjee
  
  and i have made a mysql based  user name and password program but I 
  found that
  what ever I entered in the user name and password feild the php file 
  dose not working.
  
  I set this code for user name and password
  
  $sql =  SELECT `User_name` AND `User_pass` FROM `user` WHERE 
  `User_name`= '$_POST[user_id]' AND `User_pass` = '$_POST[user_pass]' 
  
  But this code dose not working properly.
  This code dosen't checking if the user name and password is correct or 
  incorrect
  
  Please help me with some source code.
  
  Thank you.
  
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP] mysql with php

2005-05-20 Thread [EMAIL PROTECTED]
try this:
$sql = 
   SELECT User_name, User_pass
   FROM `user`
   WHERE User_name= '$_POST[user_id]'
   AND User_pass = '$_POST[user_pass]'
   ;
-afan
Rittwick Banerjee wrote:
Hi friends,
I am Rittwick Banerjee
and i have made a mysql based  user name and password program but I 
found that
what ever I entered in the user name and password feild the php file 
dose not working.

I set this code for user name and password
$sql =  SELECT `User_name` AND `User_pass` FROM `user` WHERE 
`User_name`= '$_POST[user_id]' AND `User_pass` = '$_POST[user_pass]' 

But this code dose not working properly.
This code dosen't checking if the user name and password is correct or 
incorrect

Please help me with some source code.
Thank you.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Mysql 4.1.7 + PHP 4.3.9

2004-11-14 Thread electroteque
Is this a possible combination ? Work is trying to compile PHP4 against 
4.1, I havent even tried it apart from against PHP5. It says in the 
manual that the mysqli driver is the only one compatible with 4.1, 
although I have managed to compile both mysql and mysqli in php5, and 
run my apps ok as i was in php4 using the mysql driver. Is the only 
difference the OLD_PASSWORD stuff ?

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


[PHP] mysql or php timestamp arithmatic

2003-08-26 Thread Christian Calloway
Hey everyone,

I am writing an application to keep track of employee vacation leave. I have
two timestamp(14) database fields, lets call them start and end, signifying
when start and end of a vacation leave, respectively. What I am trying to do
is get the number of hours between start and end, for example if vacation
started at 12pm on wednesday and ended at 5 pm wednesday, then the total
should be 5 hours (Of course the date ranges are going to be alot more
complicated than that). I attempted to solve this problem in the query,
using the following:

FLOOR((end-start)/3600) as hours

but the values that I am getting are wrong. For example, on what should be a
5 hour span, I am getting back the value 13. Any ideas?

Christian

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



[PHP] MySQL query/PHP logic?

2003-07-29 Thread Petre Agenbag
Hi List
 OK, I've posted this on the MySQL list as well, but it seems a bit quiet
there, and arguably it could definately be a PHP rather than mysql question
depending on whether it can be done with one query (then it was/is a mysql
query), or whether it should be done with some structures and multiple
queries ( then it's arguably PHP).

So, here goes.


I'm trying to return from multiple tables, the records that have field
information_sent between two dates.
The tables are all related by means of the id of the entry in the main
table, ie..

main
id  entity_name ...

fof
id_fof  id  information_sent ...

pub
id_pub  id  information_sent ...

etc.

So, I tried the following join

select * from main
left join fof on main.id = fof.id
left join pub on main.id = pub.id
left join gov on main.id = gov.id
left join med on main.id = med.id
left join ngo on main.id = ngo.id
left join own on main.id = own.id
left join sup on main.id = sup.id
left join tra on main.id = tra.id
where (
(fof.information_sent  '$date1' and fof.information_sent  '$date2')
OR
(pub.information_sent  '$date1' and pub.information_sent  '$date2')
OR
(gov.information_sent  '$date1' and gov.information_sent  '$date2')
OR
(med.information_sent  '$date1' and med.information_sent  '$date2')
OR
(ngo.information_sent  '$date1' and ngo.information_sent  '$date2')
OR
(own.information_sent  '$date1' and own.information_sent  '$date2')
OR
(sup.information_sent  '$date1' and sup.information_sent  '$date2')
OR
(tra.information_sent  '$date1' and tra.information_sent  '$date2')
)
order by entity_name


BUT, although it seems to be joining the tables correctly AND only
returning the ones with the correct date criteria, it does NOT return
the id or the information_sent fields correctly ( due to duplication
in the result )

Can this be done in one query without sub-selects, or should it be broken up
(in which case I would still need help with the logic and to minimize the
amount of queries inside loops)


Thanks



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



RE: [PHP] MySQL query/PHP logic?

2003-07-29 Thread Jennifer Goodie
 select * from main
   left join fof on main.id = fof.id
   left join pub on main.id = pub.id
   left join gov on main.id = gov.id
   left join med on main.id = med.id
   left join ngo on main.id = ngo.id
   left join own on main.id = own.id
   left join sup on main.id = sup.id
[snip]
 BUT, although it seems to be joining the tables correctly AND only
 returning the ones with the correct date criteria, it does NOT return
 the id or the information_sent fields correctly ( due to duplication
 in the result )

 Can this be done in one query without sub-selects, or should it
 be broken up
 (in which case I would still need help with the logic and to minimize the
 amount of queries inside loops)


Instead of select * list out the fields you want to select and alias the
duplicates, for example

select fof.id as fof_id, pub.id as pub_id, gov.id as gov_id etc.

Then when you do you mysql_fetch_array the indexes will be the aliases you
gave the columns so nothing will get overwritten.


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



Re: [PHP] MySQL query/PHP logic?

2003-07-29 Thread Nicholas Robinson
Don't know whether it's just because it's late at night here in the UK or 
whether I'm being a bit dim, but wouldn't it be much, much easier to store 
all the data in your non-main tables in a single table and distinguish the 
type of data (i.e. fof, pub, gov, etc) by a field. This would simplify 
your query and no doubt improve performance.


On Tuesday 29 Jul 2003 10:13 pm, Petre Agenbag wrote:
 Hi List
  OK, I've posted this on the MySQL list as well, but it seems a bit quiet
 there, and arguably it could definately be a PHP rather than mysql question
 depending on whether it can be done with one query (then it was/is a mysql
 query), or whether it should be done with some structures and multiple
 queries ( then it's arguably PHP).

 So, here goes.


 I'm trying to return from multiple tables, the records that have field
 information_sent between two dates.
 The tables are all related by means of the id of the entry in the main
 table, ie..

 main
 identity_name ...

 fof
 id_fofid  information_sent ...

 pub
 id_pubid  information_sent ...

 etc.

 So, I tried the following join

 select * from main
   left join fof on main.id = fof.id
   left join pub on main.id = pub.id
   left join gov on main.id = gov.id
   left join med on main.id = med.id
   left join ngo on main.id = ngo.id
   left join own on main.id = own.id
   left join sup on main.id = sup.id
   left join tra on main.id = tra.id
   where (
   (fof.information_sent  '$date1' and fof.information_sent  '$date2')
   OR
   (pub.information_sent  '$date1' and pub.information_sent  '$date2')
   OR
   (gov.information_sent  '$date1' and gov.information_sent  '$date2')
   OR
   (med.information_sent  '$date1' and med.information_sent  '$date2')
   OR
   (ngo.information_sent  '$date1' and ngo.information_sent  '$date2')
   OR
   (own.information_sent  '$date1' and own.information_sent  '$date2')
   OR
   (sup.information_sent  '$date1' and sup.information_sent  '$date2')
   OR
   (tra.information_sent  '$date1' and tra.information_sent  '$date2')
   )
   order by entity_name


 BUT, although it seems to be joining the tables correctly AND only
 returning the ones with the correct date criteria, it does NOT return
 the id or the information_sent fields correctly ( due to duplication
 in the result )

 Can this be done in one query without sub-selects, or should it be broken
 up (in which case I would still need help with the logic and to minimize
 the amount of queries inside loops)


 Thanks


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



Re: [PHP] MySQL query/PHP logic?

2003-07-29 Thread Jim Lucas
Try something like this.

select
  fof.id AS fof_id, fof.information_sent AS fof_info,
  pub.id AS pub_id, pub.information_sent AS pub_info,
  gov.id AS gov_id, gov.information_sent AS gov_info,
  med.id AS med_id, med.information_sent AS med_info,
  ngo.id AS ngo_id, ngo.information_sent AS ngo_info,
  own.id AS own_id, own.information_sent AS own_info,
  sup.id AS sup_id, sup.information_sent AS tup_info,
  tra.id AS tra_id, tra.information_sent AS tra_info,
from main
 left join fof on main.id = fof.id
 left join pub on main.id = pub.id
 left join gov on main.id = gov.id
 left join med on main.id = med.id
 left join ngo on main.id = ngo.id
 left join own on main.id = own.id
 left join sup on main.id = sup.id
 left join tra on main.id = tra.id
where (
 (fof.information_sent  '$date1' and fof.information_sent  '$date2')
 OR
 (pub.information_sent  '$date1' and pub.information_sent  '$date2')
 OR
 (gov.information_sent  '$date1' and gov.information_sent  '$date2')
 OR
 (med.information_sent  '$date1' and med.information_sent  '$date2')
 OR
 (ngo.information_sent  '$date1' and ngo.information_sent  '$date2')
 OR
 (own.information_sent  '$date1' and own.information_sent  '$date2')
 OR
 (sup.information_sent  '$date1' and sup.information_sent  '$date2')
 OR
 (tra.information_sent  '$date1' and tra.information_sent  '$date2')
 )
order by entity_name

then in your loop you will need to look for something like this.

while($row = mysql_fetch_array($results)){
  if(!empty($row['fof_id']))
   echo found;
  if(!empty($row['fof_id']))
   echo found;
  etc...
}

You get my point,  but the big part is the select *  -- part of the sql
call

you have to identify each column that you want back with an alias otherwise
they stomp all over one another.

Jim Lucas

- Original Message -
From: Petre Agenbag [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, July 29, 2003 2:13 PM
Subject: [PHP] MySQL query/PHP logic?


 Hi List
  OK, I've posted this on the MySQL list as well, but it seems a bit quiet
 there, and arguably it could definately be a PHP rather than mysql
question
 depending on whether it can be done with one query (then it was/is a mysql
 query), or whether it should be done with some structures and multiple
 queries ( then it's arguably PHP).

 So, here goes.


 I'm trying to return from multiple tables, the records that have field
 information_sent between two dates.
 The tables are all related by means of the id of the entry in the main
 table, ie..

 main
 id entity_name ...

 fof
 id_fof id information_sent ...

 pub
 id_pub id information_sent ...

 etc.

 So, I tried the following join

 select * from main
 left join fof on main.id = fof.id
 left join pub on main.id = pub.id
 left join gov on main.id = gov.id
 left join med on main.id = med.id
 left join ngo on main.id = ngo.id
 left join own on main.id = own.id
 left join sup on main.id = sup.id
 left join tra on main.id = tra.id
 where (
 (fof.information_sent  '$date1' and fof.information_sent  '$date2')
 OR
 (pub.information_sent  '$date1' and pub.information_sent  '$date2')
 OR
 (gov.information_sent  '$date1' and gov.information_sent  '$date2')
 OR
 (med.information_sent  '$date1' and med.information_sent  '$date2')
 OR
 (ngo.information_sent  '$date1' and ngo.information_sent  '$date2')
 OR
 (own.information_sent  '$date1' and own.information_sent  '$date2')
 OR
 (sup.information_sent  '$date1' and sup.information_sent  '$date2')
 OR
 (tra.information_sent  '$date1' and tra.information_sent  '$date2')
 )
 order by entity_name


 BUT, although it seems to be joining the tables correctly AND only
 returning the ones with the correct date criteria, it does NOT return
 the id or the information_sent fields correctly ( due to duplication
 in the result )

 Can this be done in one query without sub-selects, or should it be broken
up
 (in which case I would still need help with the logic and to minimize the
 amount of queries inside loops)


 Thanks



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




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



[PHP] mysql and php

2003-03-11 Thread Joseph Bannon
How can I have php give me all the data in a table as
I would using the prompt in mysql?

Joseph



__
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com

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



Re: [PHP] mysql and php

2003-03-11 Thread David E.S.V.


great tutorial to do what you want:

http://www.freewebmasterhelp.com/tutorials/phpmysql/4

regards,

David.


On Tue, 11 Mar 2003, Joseph Bannon wrote:

 How can I have php give me all the data in a table as
 I would using the prompt in mysql?
 
 Joseph
 
 
 
 __
 Do you Yahoo!?
 Yahoo! Web Hosting - establish your business online
 http://webhosting.yahoo.com
 
 

-- 

David Elías Sánchez Vásquez
Bachiller en Educación PUCP
[EMAIL PROTECTED]
telf. (51)-1-5255601



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



Re: [PHP] MySQL or PHP question?

2003-03-10 Thread Marek Kilimajer
Should not it be:
$SQL = SELECT * FROM table ORDER BY id asc LIMIT .($autoindex -5). ,5;;
John Taylor-Johnston wrote:

I don't know whether this is a MySQL or PHP quesiton.

$SQL = SELECT * FROM table ORDER BY id asc LIMIT $autoindex -5 ,5;;

I would like to get the autoindex value of my table and use it in my SQL. Can I get the autoindex? :) How?

 



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


[PHP] MySQL and PHP arrays

2003-03-10 Thread {R}ichard Ashton

Is there a generally recommended way of storing an array created by PHP
in a MySQL database field ?

What type of field should it be, and how do you get the whole array 
back in one go without reconstructing it row by row, if that is
possible?

{R} 


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



Re: [PHP] MySQL and PHP arrays

2003-03-10 Thread Jason Wong
On Monday 10 March 2003 22:30, {R}ichard Ashton wrote:
 Is there a generally recommended way of storing an array created by PHP
 in a MySQL database field ?

serialize() and unserialize().

 What type of field should it be, and how do you get the whole array
 back in one go without reconstructing it row by row, if that is
 possible?

Any text field will do, just make sure it's large enough for your data.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
QOTD:
I'm not bald -- I'm hair challenged.

[I thought that was differently haired. Ed.]
*/


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



RE: [PHP] MySQL and PHP arrays

2003-03-10 Thread Messay W Asfaw
Serializing it would be the best way: seralize($myArray) 
then you can get the array back using unseralize($serializedarray)

-Original Message-
From: {R}ichard Ashton [mailto:[EMAIL PROTECTED]
Sent: 10 March 2003 14:31
To: [EMAIL PROTECTED]
Subject: [PHP] MySQL and PHP arrays



Is there a generally recommended way of storing an array created by PHP
in a MySQL database field ?

What type of field should it be, and how do you get the whole array 
back in one go without reconstructing it row by row, if that is
possible?

{R} 


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


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



Re: [PHP] MySQL and PHP arrays

2003-03-10 Thread {R}ichard Ashton
On Mon, 10 Mar 2003 22:34:44 +0800, Jason Wong wrote:

On Monday 10 March 2003 22:30, {R}ichard Ashton wrote:
 Is there a generally recommended way of storing an array created by PHP
 in a MySQL database field ?

serialize() and unserialize().

 What type of field should it be, and how do you get the whole array
 back in one go without reconstructing it row by row, if that is
 possible?

Any text field will do, just make sure it's large enough for your data.

Thanks that now makes much more sense. So when I look at the data in
the database I see
a:142:{i:1;s:52:[52characters];i:2;s:37:[37characters] and so on for
the 142 elements of the array.

But getting it out is not so easy.

$result = mysql_query(  select post from posts where id = '$id' )

Gives $result as a Resource id #6 which is OK but I cant find the PHP
MySQL command to get the whole field back to unserialize it :(

{R}



-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
QOTD:
   I'm not bald -- I'm hair challenged.

   [I thought that was differently haired. Ed.]
*/


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




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



Re: [PHP] MySQL and PHP arrays

2003-03-10 Thread Mike Mannakee
You get at the data through $array = mysql_result($result,0,0);

Mike


{R}Ichard Ashton [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Mon, 10 Mar 2003 22:34:44 +0800, Jason Wong wrote:

 On Monday 10 March 2003 22:30, {R}ichard Ashton wrote:
  Is there a generally recommended way of storing an array created by PHP
  in a MySQL database field ?
 
 serialize() and unserialize().
 
  What type of field should it be, and how do you get the whole array
  back in one go without reconstructing it row by row, if that is
  possible?
 
 Any text field will do, just make sure it's large enough for your data.

 Thanks that now makes much more sense. So when I look at the data in
 the database I see
 a:142:{i:1;s:52:[52characters];i:2;s:37:[37characters] and so on for
 the 142 elements of the array.

 But getting it out is not so easy.

 $result = mysql_query(  select post from posts where id = '$id' )

 Gives $result as a Resource id #6 which is OK but I cant find the PHP
 MySQL command to get the whole field back to unserialize it :(

 {R}



 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 QOTD:
  I'm not bald -- I'm hair challenged.
 
  [I thought that was differently haired. Ed.]
 */
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 





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



RE: [PHP] MySQL and PHP arrays

2003-03-10 Thread Van Andel, Robbert
mysql_fetch_array($result) works too.  It fetches the data from the current row and is 
used in conjunction with a while loop:

while($array=mysql_fetch_array($result))
{
//stuff to do with the current array
}



Robbert van Andel 



-Original Message-
From: Mike Mannakee [mailto:[EMAIL PROTECTED]
Sent: Monday, March 10, 2003 8:45 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] MySQL and PHP arrays


You get at the data through $array = mysql_result($result,0,0);

Mike


{R}Ichard Ashton [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Mon, 10 Mar 2003 22:34:44 +0800, Jason Wong wrote:

 On Monday 10 March 2003 22:30, {R}ichard Ashton wrote:
  Is there a generally recommended way of storing an array created by PHP
  in a MySQL database field ?
 
 serialize() and unserialize().
 
  What type of field should it be, and how do you get the whole array
  back in one go without reconstructing it row by row, if that is
  possible?
 
 Any text field will do, just make sure it's large enough for your data.

 Thanks that now makes much more sense. So when I look at the data in
 the database I see
 a:142:{i:1;s:52:[52characters];i:2;s:37:[37characters] and so on for
 the 142 elements of the array.

 But getting it out is not so easy.

 $result = mysql_query(  select post from posts where id = '$id' )

 Gives $result as a Resource id #6 which is OK but I cant find the PHP
 MySQL command to get the whole field back to unserialize it :(

 {R}



 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 QOTD:
  I'm not bald -- I'm hair challenged.
 
  [I thought that was differently haired. Ed.]
 */
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 





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


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



[PHP] MySQL or PHP question?

2003-03-09 Thread John Taylor-Johnston
I don't know whether this is a MySQL or PHP quesiton.

$SQL = SELECT * FROM table ORDER BY id asc LIMIT $autoindex -5 ,5;;

I would like to get the autoindex value of my table and use it in my SQL. Can I get 
the autoindex? :) How?


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



[PHP] MySQL 4.0 + PHP 4

2003-01-22 Thread Joe Stump
Anyone out there have anything to share as to using PHP4+MySQL4. I've been
hearing good things on the MySQL list about v4.0 and I'm thinking of
upgrading, since I run a rather small server.

Thanks!


--Joe

ps. PHP list responders please respond directly. I'm not currently
subscribed.

--
Joe Stump [EMAIL PROTECTED]
http://www.joestump.net



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




Re: [PHP] MySQL 4.0 + PHP 4

2003-01-22 Thread 1LT John W. Holmes
 Anyone out there have anything to share as to using PHP4+MySQL4. I've been
 hearing good things on the MySQL list about v4.0 and I'm thinking of
 upgrading, since I run a rather small server.

There's really no change from the PHP side. PHP just sends the data and
receives something back The only change in PHP is that mysql_connect() now
supports additional flags to connect over SSL.

---John Holmes...


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




Re: [PHP] MySQL 4.0 + PHP 4

2003-01-22 Thread Georg Richter
On Wednesday 22 January 2003 18:52, 1LT John W. Holmes wrote:

 There's really no change from the PHP side. PHP just sends the data and
 receives something back The only change in PHP is that mysql_connect() now
 supports additional flags to connect over SSL.

Nope, I only forgot to remove a constant. SSL support will be available in 
PHP 5 (new mysql extension).

Regards

Georg



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




RE: [PHP] MySQL 4.0 + PHP 4

2003-01-22 Thread John W. Holmes
 On Wednesday 22 January 2003 18:52, 1LT John W. Holmes wrote:
 
  There's really no change from the PHP side. PHP just sends the data
and
  receives something back The only change in PHP is that
mysql_connect()
 now
  supports additional flags to connect over SSL.
 
 Nope, I only forgot to remove a constant. SSL support will be
available in
 PHP 5 (new mysql extension).
 
 Regards
 
 Georg

Ah, man... Now you made my article in the last issue of PHP|Architect
incorrect! :)

Oh well, I guess we'll have to wait. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




[PHP] MySQL and PHP math problem...

2002-11-08 Thread Peter
I have a database that stores a value of the type double.  I do a SUM()
query on the column and return save the value to a variable called,
'$amount' which I divide into a fixed value (5000) .  The math works out
fine when $amount  1000.  However, when $amount  1000, then the decimal
places are wrong.

   // successful query, now fetch the data.
$row = mysql_fetch_row($result);
if (!$row) {
return (-1);
}
$dollar = $row[0];
$tmp = ($dollar)/((double)5000);
echo $tmp;
return ($dollar);

$amount = 1,104.40

the result of echo, $tmp is displayed as '0.0002'.  What's wrong here?  The
problem only occurs when the value is greater than a 1,000?  Could the ','
messed the computation up somehow?  I did another computation

$a = 1000
$b = 5000
$c = $a/$b;

Thanks,
-Peter
$c does equal '0.2' which is correct.

$amount



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




[PHP] MYSQL and PHP Storing and retrieving images getting corrupted

2002-11-05 Thread Darren McPhee
I have written 2 programs (which are very common PHP
programs) that A) Allows me to upload image files into a MYSQL database
using a simple form.  And B) Allows me to retrieve and display the image
using a PHP script.  This is my problem:-

I can upload the images ok.  I store the binary code, image type, name, and
size within the MYSQL database.  On checking the database directly using
DBTools, I can see that the files have uploaded.  The file sizes reflect
exactly what was originally on the hard disk of my PC (not sure if this is a
correct gauge).

When I run my PHP program to display the images, maybe only 1 out of 10
actually displays correctly.  The rest are broken up or non displayable
images.  One image even made a prompt window appear and somehow now causes
Windows paint to load the image instead of the browser.  God only knows how
that occurred !!

Below are my (designed by others) 2 programs.  The first program is the
upload form.  This seems to work ok.



HTML
HEADTITLEStore binary data into SQL Database/TITLE/HEAD
BODY

?php
// code that will be executed if the form has been submitted:

if ($submit) {

// connect to the database

require_once('../../Connections/TestServer.php');
mysql_select_db($database_TestServer, $TestServer);

$data = addslashes(fread(fopen($form_data, r), filesize($form_data)));

$result=MYSQL_QUERY(INSERT INTO master_products
(image_thumbnail,image_thumbnail_name,image_thumbnail_size,image_thumbnail_t
ype) .
VALUES
('$data','$form_data_name','$form_data_size','$form_data_type'));

$id= mysql_insert_id();
print pThis file has the following Database ID: b$id/b;

MYSQL_CLOSE();

} else {

// else show the form to submit new data:
?

form method=post action=?php echo $PHP_SELF; ?
enctype=multipart/form-data
  INPUT TYPE=hidden name=MAX_FILE_SIZE value=100
brFile to upload/store in database:br
input type=file name=form_data  size=40
pinput type=submit name=submit value=submit
/form

?php

}

?

/BODY
/HTML

Here is the code to display the image:-

?php
if($id) {
require_once('../Connections/TestServer.php');
mysql_select_db($database_TestServer, $TestServer);
$query = select image_thumbnail,image_thumbnail_type from
master_products where item_id=$id;
$result = MYSQL_QUERY($query);
$data = MYSQL_RESULT($result,0,image_thumbnail);
$type = MYSQL_RESULT($result,0,image_thumbnail_type);
Header( Content-type: $type);
echo $data;
};
?

I run the above program in the following way:
http://192.168.0.11/htdocs/displayimage2.php?id=9  The ID is the item_id
primary key field for whichever record I want to display.

I have tried these programs on a test server here in my room to a test
Apache server and MYSQL test database, and also from my ISP to a MYSQL
database at a server at my ISP.  I get exactly the same problem.  When I run
the display image program, the images being displayed are always being
displayed the same.  Which points the problem towards the upload process
(maybe).  If anybody can tell me what the heck is wrong here, I'll give them
a medal !!  There is basically some kind of binary corruption going on (it
looks like)

For added information, below is my database table structure.  At the moment,
the only part I am actually using relates to the image_thumbnail sections.

Darren.



CREATE TABLE master_products (
 item_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
 item_code VARCHAR (10) UNIQUE,
 item_dateadded DATETIME DEFAULT '-00-00 00:00:00',
 item_datemodified DATETIME DEFAULT '-00-00 00:00:00',

 category ENUM (none,single herbs,general
vitality,ageing,arthritis,eyesite,prostate,ahlzheimers,
 weight
loss,menopause,depression,fatigue,headaches,insomnia,colds and
flues,allergies,
 healthy heart,cancer prevention,aphrodisiacs,sexual herbs,for
women,for men,books),

 name VARCHAR (30),
 name_dateadded DATETIME DEFAULT '-00-00 00:00:00',
 name_datemodified DATETIME DEFAULT '-00-00 00:00:00',
 INDEX idx_name (name),

 desc_brief VARCHAR (255),
 desc_brief_dateadded DATETIME DEFAULT '-00-00 00:00:00',
 desc_brief_datemodified DATETIME DEFAULT '-00-00 00:00:00',
 INDEX idx_desc_brief (desc_brief),

 desc_long TEXT,
 desc_long_dateadded DATETIME DEFAULT '-00-00 00:00:00',
 desc_long_datemodified DATETIME DEFAULT '-00-00 00:00:00',

 price DECIMAL (7,2),
 price_dateadded DATETIME DEFAULT '-00-00 00:00:00',
 price_datemodified DATETIME DEFAULT '-00-00 00:00:00',

 image LONGBLOB,
 image_name VARCHAR (50),
 image_size INT UNSIGNED,
 image_type VARCHAR (50),
 image_dateadded DATETIME DEFAULT '-00-00 00:00:00',
 image_datemodified DATETIME DEFAULT '-00-00 00:00:00',

 image_thumbnail LONGBLOB,
 image_thumbnail_name VARCHAR (50),
 image_thumbnail_size INT UNSIGNED,
 image_thumbnail_type VARCHAR (50),
 image_thumbnail_dateadded DATETIME DEFAULT '-00-00 00:00:00',
 image_thumbnail_datemodified DATETIME DEFAULT '-00-00 

Re: [PHP] MYSQL and PHP Storing and retrieving images getting corrupted

2002-11-05 Thread Marek Kilimajer
Try adding header('Content-length: ' .strlen($data)); header

Darren McPhee wrote:


I have written 2 programs (which are very common PHP
programs) that A) Allows me to upload image files into a MYSQL database
using a simple form.  And B) Allows me to retrieve and display the image
using a PHP script.  This is my problem:-

I can upload the images ok.  I store the binary code, image type, name, and
size within the MYSQL database.  On checking the database directly using
DBTools, I can see that the files have uploaded.  The file sizes reflect
exactly what was originally on the hard disk of my PC (not sure if this is a
correct gauge).

When I run my PHP program to display the images, maybe only 1 out of 10
actually displays correctly.  The rest are broken up or non displayable
images.  One image even made a prompt window appear and somehow now causes
Windows paint to load the image instead of the browser.  God only knows how
that occurred !!

Below are my (designed by others) 2 programs.  The first program is the
upload form.  This seems to work ok.



HTML
HEADTITLEStore binary data into SQL Database/TITLE/HEAD
BODY

?php
// code that will be executed if the form has been submitted:

if ($submit) {

   // connect to the database

   require_once('../../Connections/TestServer.php');
   mysql_select_db($database_TestServer, $TestServer);

   $data = addslashes(fread(fopen($form_data, r), filesize($form_data)));

   $result=MYSQL_QUERY(INSERT INTO master_products
(image_thumbnail,image_thumbnail_name,image_thumbnail_size,image_thumbnail_t
ype) .
   VALUES
('$data','$form_data_name','$form_data_size','$form_data_type'));

   $id= mysql_insert_id();
   print pThis file has the following Database ID: b$id/b;

   MYSQL_CLOSE();

} else {

   // else show the form to submit new data:
?

   form method=post action=?php echo $PHP_SELF; ?
enctype=multipart/form-data
 INPUT TYPE=hidden name=MAX_FILE_SIZE value=100
   brFile to upload/store in database:br
   input type=file name=form_data  size=40
   pinput type=submit name=submit value=submit
   /form

?php

}

?

/BODY
/HTML

Here is the code to display the image:-

?php
if($id) {
   require_once('../Connections/TestServer.php');
   mysql_select_db($database_TestServer, $TestServer);
   $query = select image_thumbnail,image_thumbnail_type from
master_products where item_id=$id;
   $result = MYSQL_QUERY($query);
   $data = MYSQL_RESULT($result,0,image_thumbnail);
   $type = MYSQL_RESULT($result,0,image_thumbnail_type);
   Header( Content-type: $type);
   echo $data;
};
?

I run the above program in the following way:
http://192.168.0.11/htdocs/displayimage2.php?id=9  The ID is the item_id
primary key field for whichever record I want to display.

I have tried these programs on a test server here in my room to a test
Apache server and MYSQL test database, and also from my ISP to a MYSQL
database at a server at my ISP.  I get exactly the same problem.  When I run
the display image program, the images being displayed are always being
displayed the same.  Which points the problem towards the upload process
(maybe).  If anybody can tell me what the heck is wrong here, I'll give them
a medal !!  There is basically some kind of binary corruption going on (it
looks like)

For added information, below is my database table structure.  At the moment,
the only part I am actually using relates to the image_thumbnail sections.

Darren.



CREATE TABLE master_products (
item_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
item_code VARCHAR (10) UNIQUE,
item_dateadded DATETIME DEFAULT '-00-00 00:00:00',
item_datemodified DATETIME DEFAULT '-00-00 00:00:00',

category ENUM (none,single herbs,general
vitality,ageing,arthritis,eyesite,prostate,ahlzheimers,
weight
loss,menopause,depression,fatigue,headaches,insomnia,colds and
flues,allergies,
healthy heart,cancer prevention,aphrodisiacs,sexual herbs,for
women,for men,books),

name VARCHAR (30),
name_dateadded DATETIME DEFAULT '-00-00 00:00:00',
name_datemodified DATETIME DEFAULT '-00-00 00:00:00',
INDEX idx_name (name),

desc_brief VARCHAR (255),
desc_brief_dateadded DATETIME DEFAULT '-00-00 00:00:00',
desc_brief_datemodified DATETIME DEFAULT '-00-00 00:00:00',
INDEX idx_desc_brief (desc_brief),

desc_long TEXT,
desc_long_dateadded DATETIME DEFAULT '-00-00 00:00:00',
desc_long_datemodified DATETIME DEFAULT '-00-00 00:00:00',

price DECIMAL (7,2),
price_dateadded DATETIME DEFAULT '-00-00 00:00:00',
price_datemodified DATETIME DEFAULT '-00-00 00:00:00',

image LONGBLOB,
image_name VARCHAR (50),
image_size INT UNSIGNED,
image_type VARCHAR (50),
image_dateadded DATETIME DEFAULT '-00-00 00:00:00',
image_datemodified DATETIME DEFAULT '-00-00 00:00:00',

image_thumbnail LONGBLOB,
image_thumbnail_name VARCHAR (50),
image_thumbnail_size INT UNSIGNED,
image_thumbnail_type VARCHAR (50),
image_thumbnail_dateadded DATETIME DEFAULT '-00-00 00:00:00',
image_thumbnail_datemodified 

Re: [PHP] MYSQL and PHP Storing and retrieving images getting corrupted

2002-11-05 Thread rija
Have you tried out mysql function load_file() to upload directly your file
into the database without passing through php variable ?

Like this:

$result=MYSQL_QUERY(INSERT INTO master_products
(image_thumbnail,image_thumbnail_name,image_thumbnail_size,image_thumbnail_t
ype) VALUES

(load_file('$form_data'),'$form_data_name','$form_data_size','$form_data_typ
e'));

If you are not allowed to upload directly $form_data using mysql
load_file(), move first the file $form_data into another allowed directory
with valid filename and try again.

Finally, storing image or binary file into database is not good, put them
into directory instead.

- Original Message -
From: Darren McPhee [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, November 05, 2002 11:24 PM
Subject: [PHP] MYSQL and PHP Storing and retrieving images getting corrupted


 I have written 2 programs (which are very common PHP
 programs) that A) Allows me to upload image files into a MYSQL database
 using a simple form.  And B) Allows me to retrieve and display the image
 using a PHP script.  This is my problem:-

 I can upload the images ok.  I store the binary code, image type, name,
and
 size within the MYSQL database.  On checking the database directly using
 DBTools, I can see that the files have uploaded.  The file sizes reflect
 exactly what was originally on the hard disk of my PC (not sure if this is
a
 correct gauge).

 When I run my PHP program to display the images, maybe only 1 out of 10
 actually displays correctly.  The rest are broken up or non displayable
 images.  One image even made a prompt window appear and somehow now causes
 Windows paint to load the image instead of the browser.  God only knows
how
 that occurred !!

 Below are my (designed by others) 2 programs.  The first program is the
 upload form.  This seems to work ok.



 HTML
 HEADTITLEStore binary data into SQL Database/TITLE/HEAD
 BODY

 ?php
 // code that will be executed if the form has been submitted:

 if ($submit) {

 // connect to the database

 require_once('../../Connections/TestServer.php');
 mysql_select_db($database_TestServer, $TestServer);

 $data = addslashes(fread(fopen($form_data, r),
filesize($form_data)));

 $result=MYSQL_QUERY(INSERT INTO master_products

(image_thumbnail,image_thumbnail_name,image_thumbnail_size,image_thumbnail_t
 ype) .
 VALUES
 ('$data','$form_data_name','$form_data_size','$form_data_type'));

 $id= mysql_insert_id();
 print pThis file has the following Database ID: b$id/b;

 MYSQL_CLOSE();

 } else {

 // else show the form to submit new data:
 ?

 form method=post action=?php echo $PHP_SELF; ?
 enctype=multipart/form-data
   INPUT TYPE=hidden name=MAX_FILE_SIZE value=100
 brFile to upload/store in database:br
 input type=file name=form_data  size=40
 pinput type=submit name=submit value=submit
 /form

 ?php

 }

 ?

 /BODY
 /HTML

 Here is the code to display the image:-

 ?php
 if($id) {
 require_once('../Connections/TestServer.php');
 mysql_select_db($database_TestServer, $TestServer);
 $query = select image_thumbnail,image_thumbnail_type from
 master_products where item_id=$id;
 $result = @MYSQL_QUERY($query);
 $data = @MYSQL_RESULT($result,0,image_thumbnail);
 $type = @MYSQL_RESULT($result,0,image_thumbnail_type);
 Header( Content-type: $type);
 echo $data;
 };
 ?

 I run the above program in the following way:
 http://192.168.0.11/htdocs/displayimage2.php?id=9  The ID is the item_id
 primary key field for whichever record I want to display.

 I have tried these programs on a test server here in my room to a test
 Apache server and MYSQL test database, and also from my ISP to a MYSQL
 database at a server at my ISP.  I get exactly the same problem.  When I
run
 the display image program, the images being displayed are always being
 displayed the same.  Which points the problem towards the upload process
 (maybe).  If anybody can tell me what the heck is wrong here, I'll give
them
 a medal !!  There is basically some kind of binary corruption going on (it
 looks like)

 For added information, below is my database table structure.  At the
moment,
 the only part I am actually using relates to the image_thumbnail sections.

 Darren.



 CREATE TABLE master_products (
  item_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
  item_code VARCHAR (10) UNIQUE,
  item_dateadded DATETIME DEFAULT '-00-00 00:00:00',
  item_datemodified DATETIME DEFAULT '-00-00 00:00:00',

  category ENUM (none,single herbs,general
 vitality,ageing,arthritis,eyesite,prostate,ahlzheimers,
  weight
 loss,menopause,depression,fatigue,headaches,insomnia,colds and
 flues,allergies,
  healthy heart,cancer prevention,aphrodisiacs,sexual herbs,for
 women,for men,books),

  name VARCHAR (30),
  name_dateadded DATETIME DEFAULT '-00-00 00:00:00',
  name_datemodified DATETIME DEFAULT '-00-00 00:00:00',
  INDEX idx_name (name

Re: [PHP] MySQL and PHP

2002-01-18 Thread DL Neil

Brandon,

Please do some 'homework': Will the native query run from the MySQL command line, or 
in a admin tool? Have you
tried varying the number of fields? What are the column specifications?

In and amongst this you might like to check where you should have spaces (a) for 
legibility (particularly if
you're asking us to read it to help you), and (b) for machine parsing requirements.

=dn


- Original Message -
From: hugh danaher [EMAIL PROTECTED]
To: Brandon Orther [EMAIL PROTECTED]
Cc: Php-General [EMAIL PROTECTED]
Sent: 18 January 2002 01:14
Subject: Re: [PHP] MySQL and PHP


 Brandon,
 Try using single quotes rather than doubles in the values e.g.
 ('something','something else')
 hugh
 - Original Message -
 From: Brandon Orther [EMAIL PROTECTED]
 To: PHP User Group [EMAIL PROTECTED]
 Sent: Thursday, January 17, 2002 2:25 PM
 Subject: [PHP] MySQL and PHP


  Hello,
 
  I am trying to use mysql through php.  When I try to run the following
  query it does nothing.  I am trying to figure out if it is the query or
  php I am having a problem with.  Does anyone see a problem with the
  below query? (Note: This is for mysql)
 
  QUERY:
  INSERT INTO page_properties
  (page_name,open_menu,top_image,title_image,side_images)
  VALUES(30daypolicy,comp_info2,top_aboutus,titlebar_aboutus,30da
  y);
 
  Thanx for your help,
  Brandon
 


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] MySQL and PHP

2002-01-17 Thread Brandon Orther

Hello,
 
I am trying to use mysql through php.  When I try to run the following
query it does nothing.  I am trying to figure out if it is the query or
php I am having a problem with.  Does anyone see a problem with the
below query? (Note: This is for mysql)
 
QUERY: 
INSERT INTO page_properties
(page_name,open_menu,top_image,title_image,side_images)
VALUES(30daypolicy,comp_info2,top_aboutus,titlebar_aboutus,30da
y);
 
Thanx for your help,
Brandon



Re: [PHP] MySQL and PHP

2002-01-17 Thread Sam Masiello


What is the error that you are getting?

--Sam

- Original Message - 
From: Brandon Orther [EMAIL PROTECTED]
To: PHP User Group [EMAIL PROTECTED]
Sent: Thursday, January 17, 2002 5:25 PM
Subject: [PHP] MySQL and PHP


 Hello,
  
 I am trying to use mysql through php.  When I try to run the following
 query it does nothing.  I am trying to figure out if it is the query or
 php I am having a problem with.  Does anyone see a problem with the
 below query? (Note: This is for mysql)
  
 QUERY: 
 INSERT INTO page_properties
 (page_name,open_menu,top_image,title_image,side_images)
 VALUES(30daypolicy,comp_info2,top_aboutus,titlebar_aboutus,30da
 y);
  
 Thanx for your help,
 Brandon
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] MySQL and PHP

2002-01-17 Thread hugh danaher

Brandon,
Try using single quotes rather than doubles in the values e.g.
('something','something else')
hugh
- Original Message -
From: Brandon Orther [EMAIL PROTECTED]
To: PHP User Group [EMAIL PROTECTED]
Sent: Thursday, January 17, 2002 2:25 PM
Subject: [PHP] MySQL and PHP


 Hello,

 I am trying to use mysql through php.  When I try to run the following
 query it does nothing.  I am trying to figure out if it is the query or
 php I am having a problem with.  Does anyone see a problem with the
 below query? (Note: This is for mysql)

 QUERY:
 INSERT INTO page_properties
 (page_name,open_menu,top_image,title_image,side_images)
 VALUES(30daypolicy,comp_info2,top_aboutus,titlebar_aboutus,30da
 y);

 Thanx for your help,
 Brandon



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] MySQL and PHP problem

2001-09-22 Thread Ben Edwards

[Reposting cos left error message out, sorry] Had a fully working 
installation of MySQL 3.23 with PHP 6.0.6.  I then foolishly installed PGP 
which included PGPNet and I cant access my MySQL database from PHP.  When I 
try to connect I get error 'Access denied for user: '@GREEN' to database 
'subvert_cd'
', another strange thing is under MyODBC it says 'Not Found'.  I have 
re-installed both PHP and MySQL (actually installed 3.23.42) after first 
de-installing PHP but still no luck.

Regards,
Ben
--
This Email account is protected by http://www.spamcop.net
ALL spam is reported to ISP and there network provider
*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+
* Ben Edwards [EMAIL PROTECTED]   +352 091 429995 *
* Homepagehttp://www.gifford.co.uk/~bedwards *
* i-Contact Progressive Videohttp://www.videonetwork.org *
* Smashing the Corporate image http://www.subvertise.org *
* Bristol's radical newshttp://www.bristle.co.uk *
* Open Directory Project http://www.dmoz.org *
*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mysql and php

2001-04-05 Thread Christian Reiniger

On Thursday 05 April 2001 02:15, you wrote:
 I'm sending this command to mysql

 UPDATE fusuario u, fgrupos g SET g.cdgrupo=1, u.celular="99823640",
 u.nome="Augusto X", u.sobrenome="Cesar Castoldi",
 u.cidade="Florinpolis", u.emailpessoal="[EMAIL PROTECTED]",
 u.idade="19", u.sexo="M", u.operadora="T", u.email="", u.ddd="048"
 WHERE g.cdgrupo=1 and u.cdusuario=g.cdusuario and u.cdusuario=1 and
 u.celular="99823640" and u.ddd="048" and u.ativo=1 and g.ativo=1

 and I receive this error message:

 Mensagens do MySQL : You have an error in your SQL syntax near 'u,
 fgrupos g SET g.cdgrupo=1, u.celular="99823640", u.nome="Augusto X",
 u.sobren' at line 1

 Why? How can I update with 2 or more tables?

use separate queries

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Error 032: Recursion error - see error 032

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] mysql and php

2001-04-04 Thread Augusto Cesar Castoldi

I'm sending this command to mysql

UPDATE fusuario u, fgrupos g SET g.cdgrupo=1, u.celular="99823640",
u.nome="Augusto X", u.sobrenome="Cesar Castoldi", u.cidade="Florinpolis",
u.emailpessoal="[EMAIL PROTECTED]", u.idade="19", u.sexo="M",
u.operadora="T", u.email="", u.ddd="048" WHERE g.cdgrupo=1 and
u.cdusuario=g.cdusuario and u.cdusuario=1 and u.celular="99823640" and
u.ddd="048" and u.ativo=1 and g.ativo=1

and I receive this error message:

Mensagens do MySQL : You have an error in your SQL syntax near 'u, fgrupos
g SET g.cdgrupo=1, u.celular="99823640", u.nome="Augusto X", u.sobren' at
line 1

Why? How can I update with 2 or more tables?

regards,

Augusto


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] :: MySql and PHP Book

2001-01-11 Thread Philip Olson

Hey Ray,

I would suggest looking for books on SQL.  I have one (and want
more!), it is called "the practical sql handbook" and it's nice.

Seems every PHP book deals with MySQL directly too.

Anyway, my thought on the matter is go generic, go SQL.

Philip


On Thu, 11 Jan 2001, Ray Iftikhar wrote:

   I was looking for a good book that teaches you how to use PHP (mainly 3)
 with MySql. I went to Amazon.com and found "MySql" by Paul Dubois, which was
 supposed to be THE book for mySql programming. However, after reading some
 of the customer reviews, it said that it was "light" in the PHP section.
 Also the fact that the book was published in 1999 made me a little uneasy.
 What are some books that you have used to learn MySql with php?
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] mysql and php possibly causing problem

2001-01-09 Thread James Mclean


list,
ok her is the problem. i have a page taht works fine in one dir, but in a sub
dir, it doesnt even show up. here is my dir structure.
public_html/|
|website/|
||index.php
||admin/|
||  |admin.php
||  |

now what happens, is if the file admin.php is in the admin dir, all i get in
the browser is the tags htmlhead/head/html, but if i put the file
admin.php into the website dir, it works fine. please help!!

using php4.0b3, mysql 3.22.32 apache latest debian 2.2
please help!!

thanks
james mclean


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]