Re: [PHP-DB] Waiting for localhost

2015-03-15 Thread Jason Pruim
It could be a bad variable, or lack of access to an include file possibly? Put 
some echo statements in right before and right after some major blocks of 
code... It will help narrow down the problem since it will show you where it's 
holding up. The. You can concentrate on fixing just that part instead of the 
entire site. 



Jason Pruim
352.359.0002




> On Mar 15, 2015, at 2:40 PM, Ethan Rosenberg 
>  wrote:
> 
>> On 03/15/2015 09:44 AM, Jason Pruim wrote:
>> If you load up handleweight.php outside of the script does it load normally? 
>> Trying to pin down where the actual problem is.
>> 
>> Jason Pruim
>> 352.359.0002
>> 
>> 
>> 
>> 
>>>> On Mar 14, 2015, at 10:17 PM, Ethan Rosenberg 
>>>>  wrote:
>>>> 
>>>>> On 03/09/2015 08:27 AM, Ethan Rosenberg, PhD wrote:
>>>>> On 03/09/2015 06:55 AM, Karl DeSaulniers wrote:
>>>>> Don't know what to tell you bub.
>>>>> Time for the books?
>>>>> 
>>>>> I "think" that it has to do with php parsing or not parsing the echo 
>>>>> because its echoing a script.
>>>>> Can't remember off the top, but along those lines I would search.
>>>>> 
>>>>> GL,
>>>>> 
>>>>> Best,
>>>>> 
>>>>> Karl DeSaulniers
>>>>> Design Drumm
>>>>> http://designdrumm.com
>>>>> 
>>>>> 
>>>>> 
>>>>>>> On Mar 8, 2015, at 10:11 PM, Ethan Rosenberg 
>>>>>>>  wrote:
>>>>>>> 
>>>>>>> On 03/08/2015 09:30 PM, Karl DeSaulniers wrote:
>>>>>>> Try...
>>>>>>> window.location.href = "HandleWeight.php";
>>>>>>> 
>>>>>>> Sent from losPhone
>>>>>>> 
>>>>>>>>> On Mar 8, 2015, at 7:13 PM, Ethan Rosenberg 
>>>>>>>>>  wrote:
>>>>>>>>> 
>>>>>>>>> On 03/08/2015 07:00 PM, Karl DeSaulniers wrote:
>>>>>>>>> Sorry, missed a parenthesis.
>>>>>>>>> 
>>>>>>>>> if($row7[0] === 1)
>>>>>>>>> {
>>>>>>>>> echo('window.location = 
>>>>>>>>> "HandleWeight.php";');
>>>>>>>>> }
>>>>>>>>> 
>>>>>>>>> Best,
>>>>>>>>> 
>>>>>>>>> Karl DeSaulniers
>>>>>>>>> Design Drumm
>>>>>>>>> http://designdrumm.com <http://designdrumm.com/>
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Begin forwarded message:
>>>>>>>>> 
>>>>>>>>>> *From: *Karl DeSaulniers >>>>>>>>> <mailto:k...@designdrumm.com>>
>>>>>>>>>> *Subject: **Re: [PHP-DB] Waiting for localhost*
>>>>>>>>>> *Date: *March 8, 2015 5:58:29 PM CDT
>>>>>>>>>> *To: *erosenb...@hygeiabiomedical.com 
>>>>>>>>>> <mailto:erosenb...@hygeiabiomedical.com>
>>>>>>>>>> 
>>>>>>>>>> Try...
>>>>>>>>>> 
>>>>>>>>>> if($row7[0] === 1)
>>>>>>>>>> {
>>>>>>>>>> echo('window.location = 
>>>>>>>>>> "HandleWeight.php";';
>>>>>>>>>> }
>>>>>>>>>> 
>>>>>>>>>> Best,
>>>>>>>>>> 
>>>>>>>>>> Karl DeSaulniers
>>>>>>>>>> Design Drumm
>>>>>>>>>> http://designdrumm.com
>>>>>>>> Karl -
>>>>>>>> 
>>>>>>>> Thanks.
>>>>>>>> 
>>>>>>>> The === avoids the infinite loop, but the call to the script is never 
>>>>>>>> executed.
>>>>>>>> 
>>>>>>>> TIA
>>>>>>>> 
>>>>>>>> Ethan
>>>>>> 
>>>>>> Karl -
>>>>>> 
>>&g

Re: [PHP-DB] Waiting for localhost

2015-03-15 Thread Jason Pruim
If you load up handleweight.php outside of the script does it load normally? 
Trying to pin down where the actual problem is. 

Jason Pruim
352.359.0002




> On Mar 14, 2015, at 10:17 PM, Ethan Rosenberg 
>  wrote:
> 
>> On 03/09/2015 08:27 AM, Ethan Rosenberg, PhD wrote:
>>> On 03/09/2015 06:55 AM, Karl DeSaulniers wrote:
>>> Don't know what to tell you bub.
>>> Time for the books?
>>> 
>>> I "think" that it has to do with php parsing or not parsing the echo 
>>> because its echoing a script.
>>> Can't remember off the top, but along those lines I would search.
>>> 
>>> GL,
>>> 
>>> Best,
>>> 
>>> Karl DeSaulniers
>>> Design Drumm
>>> http://designdrumm.com
>>> 
>>> 
>>> 
>>>> On Mar 8, 2015, at 10:11 PM, Ethan Rosenberg 
>>>>  wrote:
>>>> 
>>>>> On 03/08/2015 09:30 PM, Karl DeSaulniers wrote:
>>>>> Try...
>>>>> window.location.href = "HandleWeight.php";
>>>>> 
>>>>> Sent from losPhone
>>>>> 
>>>>>>> On Mar 8, 2015, at 7:13 PM, Ethan Rosenberg 
>>>>>>>  wrote:
>>>>>>> 
>>>>>>> On 03/08/2015 07:00 PM, Karl DeSaulniers wrote:
>>>>>>> Sorry, missed a parenthesis.
>>>>>>> 
>>>>>>> if($row7[0] === 1)
>>>>>>> {
>>>>>>> echo('window.location = 
>>>>>>> "HandleWeight.php";');
>>>>>>> }
>>>>>>> 
>>>>>>> Best,
>>>>>>> 
>>>>>>> Karl DeSaulniers
>>>>>>> Design Drumm
>>>>>>> http://designdrumm.com <http://designdrumm.com/>
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> Begin forwarded message:
>>>>>>> 
>>>>>>>> *From: *Karl DeSaulniers >>>>>>> <mailto:k...@designdrumm.com>>
>>>>>>>> *Subject: **Re: [PHP-DB] Waiting for localhost*
>>>>>>>> *Date: *March 8, 2015 5:58:29 PM CDT
>>>>>>>> *To: *erosenb...@hygeiabiomedical.com 
>>>>>>>> <mailto:erosenb...@hygeiabiomedical.com>
>>>>>>>> 
>>>>>>>> Try...
>>>>>>>> 
>>>>>>>> if($row7[0] === 1)
>>>>>>>> {
>>>>>>>> echo('window.location = 
>>>>>>>> "HandleWeight.php";';
>>>>>>>> }
>>>>>>>> 
>>>>>>>> Best,
>>>>>>>> 
>>>>>>>> Karl DeSaulniers
>>>>>>>> Design Drumm
>>>>>>>> http://designdrumm.com
>>>>>> Karl -
>>>>>> 
>>>>>> Thanks.
>>>>>> 
>>>>>> The === avoids the infinite loop, but the call to the script is never 
>>>>>> executed.
>>>>>> 
>>>>>> TIA
>>>>>> 
>>>>>> Ethan
>>>> 
>>>> Karl -
>>>> 
>>>> Thanks.
>>>> 
>>>> No improvement.
>>>> 
>>>> TIA
>>>> 
>>>> Ethan
>> -
>> Karl -
>> 
>> Thanks.
>> 
>> We all run up against brick walls.
>> 
>> Anybody else have ideas?
>> 
>> TIA.
>> 
>> Ethan
> Karl -
> 
> Thanks.
> 
> Here are some debug info.  Hope it helps.
> 
> root@meow:/home/ethan/BluBev# apache2 -S
> [Fri Mar 13 00:19:23.651029 2015] [core:warn] [pid 21435] AH00111: Config 
> variable ${APACHE_LOCK_DIR} is not defined
> [Fri Mar 13 00:19:23.651100 2015] [core:warn] [pid 21435] AH00111: Config 
> variable ${APACHE_PID_FILE} is not defined
> [Fri Mar 13 00:19:23.651117 2015] [core:warn] [pid 21435] AH00111: Config 
> variable ${APACHE_RUN_USER} is not defined
> [Fri Mar 13 00:19:23.651124 2015] [core:warn] [pid 21435] AH00111: Config 
> variable ${APACHE_RUN_GROUP} is not defined
> [Fri Mar 13 00:19:23.651142 2015] [core:warn] [pid 21435] AH00111: Config 
> variable ${APACHE_LOG_DIR} is not defined
> [Fri Mar 13 00:19:23.667273 2015] [core:warn] [pid 21435] AH00111: Config 
> variable ${APACHE_LOG_DIR} is not defined
> [Fri Mar 13 00:19:23.667416

Re: [PHP-DB] Problem with mysql and php

2011-11-29 Thread Jason Pruim
Jim,

Similar yes... But this was specifically about replacing distinct with 
something since it was taking WAY to long... 

But it did evolve into a very similar conversation :)


Jason Pruim
pru...@gmail.com


On Nov 29, 2011, at 6:25 PM, Jim Giner wrote:

> Didn't the OP begin this very same subject a month ago? 
> 
> 
> 
> -- 
> 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] Problem with mysql and php

2011-11-28 Thread Jason Pruim

Jason Pruim
pru...@gmail.com


On Nov 28, 2011, at 8:58 PM, Phil Dobbin wrote:

> On 29/11/11 01:38, "Jason Pruim"  wrote:
> 
>> Given the following 2 queries:
>> 
>> "SELECT DISTINCT areacode FROM main WHERE state = '{$query_exploded[0]}'";
>> 
>> "SELECT DISTINCT areacode FROM main";
>> 
>> The second displays ALOT faster Like by minutes... the first one is what 
>> I
>> really want though Currently working with a dataset of 89 million 
>> records,
>> will be expanding that to many many more times that... To the tune of 
>> possibly
>> a couple billion records...
>> 
>> Any ideas? :)
> 
> PostgreSQL?
> 
> ;-)...

In all seriousness... Would it help or change it in anyway? :)

I am free to use what I want (I believe) on this project... 




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



[PHP-DB] Problem with mysql and php

2011-11-28 Thread Jason Pruim
Given the following 2 queries:

"SELECT DISTINCT areacode FROM main WHERE state = '{$query_exploded[0]}'";

"SELECT DISTINCT areacode FROM main";

The second displays ALOT faster Like by minutes... the first one is what I 
really want though Currently working with a dataset of 89 million records, 
will be expanding that to many many more times that... To the tune of possibly 
a couple billion records...

Any ideas? :)


Jason Pruim
li...@pruimphotography.com





[PHP-DB] Odd MySQL Problem...

2011-10-13 Thread Jason Pruim
Hey everyone,Have a weird issue that I can't seem to figure out...Using PHP to insert phone numbers into the site... I have the Area Code, & Exchange, and then dynamically create the last 4 digits... Once it's inserted it's dropping the leading zero's... Here's some samples:Copied from phpMySQL: Edit Inline Edit Copy Delete2122000681 Edit Inline Edit Copy Delete2122001682 Edit Inline Edit Copy Delete2122002683 Edit Inline Edit Copy Delete2122003684 Edit Inline Edit Copy Delete2122004echoed output from PHP:SQL: INSERT INTO phonesite (areacode, exchange, subscriber) VALUES(212, 200, 0001) SQL: INSERT INTO phonesite (areacode, exchange, subscriber) VALUES(212, 200, 0002) Actual PHP code://    ini_set('display_errors', 1);//error_log(-1);set_time_limit(0);//set_time_limit("120");include "includes.php";include "databaseabstraction.php";include "authentication.php";dbconnect("localhost", "XX", "XX", "XX")or die("Unable to connect: " . mysql_error());function number_pad($number,$n) {return str_pad((int) $number,$n,"0",STR_PAD_LEFT);}if (($handle = fopen("newyorktest.csv", "r")) !== FALSE) {    while (($data = "" 1000, ",")) !== FALSE) {print_r($data);        foreach( range(0, ) AS $n) {        //echo "DATA: " . $data[2] . "";             $padded_number = number_pad($n, "4");             $sql = "INSERT INTO phonesite (areacode, exchange, subscriber) ";             $sql .= "VALUES({$data[1]}, {$data[2]}, {$padded_number}) ";             //mysql_query($sql) or die("Didn't insert you dumb ass FIX IT NOW CLOWN " . mysql_error());echo "SQL: " . $sql . "";             }    }    echo "File Bitches!";    fclose($handle);}?>Any ideas on what I'm missing?Thanks everyone!
Jason Pruimli...@pruimphotography.com




Re: [PHP-DB] Working with large datasets

2011-10-10 Thread Jason Pruim

Jason Pruim
li...@pruimphotography.com



On Oct 10, 2011, at 5:27 PM, Thompson, Jimi wrote:

> I really think that you should try running it from the command line and see 
> what the issues are.  Get both Apache and php out of the way.  I've seen some 
> PHP scripts use up all the file handles (OS limit) even on a 64 bit server 
> when they start doing complex things with data sets.  
> 
> If it works ok without PHP/Apache then you can start lookig at PHP and 
> APache.  
> 
> ISOLATE the issue not complicate it
> 
> My 2 cents,

Hi Jimi,

I've done it from the command line a few times, first time I run a simple: 
SELECT * FROM Main WHERE state="test"; it takes:  2 rows in set (1 min 44.20 
sec)
 after that initial run it's pretty responsive, usually around 0.01 seconds. 

If I do a select based on the new-york state, which is all of my almost 9 
million records after the initial run, it returns it all VERY quickly:  25000 
rows in set (0.02 sec)

So commandline is running fine after the initial...  I'm leaning towards either 
a problem with web server, PHP setup, or my PHP code... I've used the code many 
times before but never on such a large dataset...

When I pull the pagination out completely It's pretty much the same 
result... fetching the info for new-york works just fine but not "test"

One thing I am noticing right now though is the fact that when I switch over to 
using the test state Right now it's not displaying anything... Not even 
able to view the source...

Okay... Enough rambling right now... Need to do some more checking before I can 
come to a conclusion :)


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



Re: [PHP-DB] Working with large datasets

2011-10-10 Thread Jason Pruim

Jason Pruim
pru...@gmail.com


On Oct 10, 2011, at 2:42 PM, Jim Giner wrote:

> I don't do command line stuff so I may not be right in my thinking.  If you 
> are running a php query from a client, does the query get executed on the 
> database server, or does all the data have to come down to you to be 
> queried?

When you do it from the commandline it gets executed directly on the machine. 
When you do it from PHP (Or something else) It gets executed first on the 
server and then pipped down to you.

Basically commandline should be faster by a long shot since it's being executed 
directly.

But when you run from a web browser, you have to throw in the overhead for 
apache, or what ever web server you're using.


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



Re: [PHP-DB] Working with large datasets

2011-10-10 Thread Jason Pruim

Jason Pruim
pru...@gmail.com


On Oct 10, 2011, at 2:20 PM, Jim Giner wrote:

> 
> ""Toby Hart Dyke""  wrote in message 
> news:00da01cc8768$ca9e9200$5fdbb600$@hartdyke.com...
>> 
>> It sounds as though you don't have an index on the right field. 8 million
>> records should be no problem if you have the right indexes applied, and
>> you're not trying to do anything too complicated.
>> 
>> Toby
> 
> I doubt that the State field is a primary index, or that it would be used as 
> one, which means that it could be a secondary one.  If it is - that would be 
> a pretty long record itself and could be the problem therein.  With 
> virtually all the records tied to one secondary key it is mostly a worthless 
> secondary index.  I'd try removing it and seeing what happens. 

Actually it will be in the end if they keep going with the site... It's a 
"Report who called you and why" type of site. So for SEO purposes I'm changing 
the links from: index.php?phone=X&state=NY to: /new-york/XX 

RIght now though I only have 1 state inputed to work with though. I may need to 
just increase the max execution time as well... But it still runs too slowly 
... Even from the commandline searching for a simple: SELECT * from Table WHERE 
state="test"; takes 56.96 seconds to search and returns only 2 records with 4 
columns... Could this just be a hardware problem?

Here is the structure of the table Im working with:

++-+--+-+-++
| Field  | Type| Null | Key | Default | Extra  |
++-+--+-+-++
| ID| int(11)| NO   | PRI | NULL| auto_increment |
| phone| text  | NO   | MUL | NULL||
| config | text  | NO   |   | NULL||
| state   | text  | YES || NULL||
++-+--+-+-++


I'm starting to lean more towards it being a problem with hardware though...

I'm going to try and get the specs of the machine it's running on... (Not my 
host :))


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



[PHP-DB] Working with large datasets

2011-10-10 Thread Jason Pruim
Hey everyone,


I am working with a database that has close to 8 million records in it and it 
will be growing. I have a state field in the data, and I am attempting to test 
some query's on it, all but 2 records right now have the same state.

My test info won't get pulled up... I believe it keeps timing out the 
connection.

Is there any advice for working with large datasets? I'm wanting this to be 
able to load quickly.

Thanks in advance! 


Jason Pruim
li...@pruimphotography.com




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



Re: [PHP-DB] Parsing Tab Delimited file

2010-10-24 Thread Jason Pruim


On Oct 24, 2010, at 2:46 PM, Ethan Rosenberg wrote:


Dear list -

Thanks for all your help.

I have a tab delimited file which I wish to import into a data  
base.  In MySQL I can use the LOAD DATA command.  As far as I know,  
that command cannot be used in PHP as a mysqli_query.  As I  
understand, I have to parse the file and use the INSERT command.


How do I do it?  Code samples, please.

Thanks.


http://tinyurl.com/2fnm48f



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



[PHP-DB] always the logic that messes me up.... Database fun!

2010-07-18 Thread Jason Pruim

Hi everyone!

I'm trying to put together a completely database driven site so I can  
learn how to do it...


I've gone to the extent of creating apache rewrite rules to redirect  
all non-existent files/folders to my script to see if it exists which  
works perfectly.


Where I'm running into trouble, is if I store the entire page inside  
the database, and inside that page I'm grabbing info from another part  
of the database how do I include that?


Such as:

pseudo -code:

//Display current page info
Grab current rate plans and prices from database
finish displaying page.

Now... It sounds easy enough but what I end up with on my page is:

echo <<
hosting info hosting info host info hosting info hosting info hosting  
info host info hosting info



Current Plans

HTML;
include "hostingprices.php";

echo <<
More info about hosting

HTML;



The only thing I changed was the actual text cause I didn't want to  
spam the list with my hosting schpeal :)


So how do I make that work? Any points in a direction? :)

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



Re: [PHP-DB] session variable in select query showing picture from database

2009-02-12 Thread Jason Pruim


On Feb 12, 2009, at 6:07 AM, Mika Jaaksi wrote:


I'm trying to show picture from database. Everything works until I add
variable into where part of the query.

It works with plain number. example ...WHERE id=11... ...picture is  
shown on

the page.

Here's the code that retrieves the picture. show_pic.php

mysql_connect($host, $user, $password) or die('I cannot connect to  
db: ' .

mysql_error());
mysql_select_db($db);
}
db_connect();
$band_id = $_SESSION['session_var'];
$query="SELECT * FROM pic_upload WHERE band_id=$band_id";
$result=mysql_query($query);
while($row = mysql_fetch_array($result))
{
$bytes = $row['pic_content'];
}
header("Content-type: image/jpeg");
print $bytes;


exit ();
mysql_close();
?>


other page that shows the picture

";
?>

Any help would be appreciated...


I'm not positive... But I believe you need to  enclose $band_id like  
this:


$query = "SELECT * FROM pic_upload WHERE band_id='{$band_id}'";

Give that a shot, and if it doesn't work, post back and we'll take it  
from there.





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



[PHP-DB] When does using multiple tables make sense?

2008-10-20 Thread Jason Pruim

Good morning everyone!

Hope you all have your coffee in hand when reading this :)

In case it makes a difference, It will be written in PHP 5.2.6 and  
using mysql 5.0.51a-community with apache 2.2.9.


I am in the planning stages of a project that will turn into a  
customer relation management system.  I know there are quiet a few out  
there, but I may need to be able to tie it into some accounting  
software that we use here so I need to write my own... Besides, I get  
paid to do it :)


Now... the meat of the question... When does it make sense to use  
multiple tables? I am going to have the name/contact info for the  
business, codes for when we contacted them last and how (Phone, e- 
mail, postal mail, etc. etc), I also want to track the history of  
changes made to each record.


Right now, I am thinking 3 tables, 1 with the name, address, phone,  
etc. on it. a second with the contact codes, and a date. And the third  
for keeping track of the changes.


I started thinking about it though... and I could have at least 6  
tables, Address/contact info. Contact codes. Changes. Customer  
History. Sales Rep Info. Access Control...


Right now the organization is small, only 9 full time employees  
including production, so it's not a huge deal, but I'm hoping this  
will be something that will help grow the company and we will have  
sales people all over the world :)


So my question is... When is it best to use more tables? All the info  
will be related to each other, so I think I would be looking at either  
a many-to-many relationship, or a many-to-one relationship (still  
figuring that out).


I am also considering writing it as a module system so that I can just  
plug things in as needed, I could also then get it up and running  
faster I think..


Was anyone able to determine what I am really asking in this long mess  
of words? :)


--

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] re:php debugging skills

2008-09-26 Thread Jason Pruim


On Sep 26, 2008, at 1:17 PM, muhsin wrote:


Jason Pruim wrote:


On Sep 26, 2008, at 11:22 AM, muhsin wrote:

Could you guys share your development setup, like what kinds of  
software (IDE's/Editors) you are using for developing php scripts?
It might sound silly but I am just curios, as I just got started  
in php programming en i have firefox + kate/bluefish + LAMP built  
with gentoo.
Im mostly thinking that with only firefox and some logs left /var/ 
log or so, its not enough for me..Im looking for something like an  
IDE which can allow me to debug code in steps in central manner  
approach (ide), simplicity and efficiency...u know what i mean? :-D


Just kiddin bout simplicity ;-)




this has been discussed quite a bit over the years, but I just  
thought I'd pipe up since I was in your spot a little over a year  
ago...  What I did then, and still do when I can't figure it out  
from the error log is just a lot of echo "N"; through the  
application. That way, when I see it makes it to 5 but not 6 I  
check the code between 5 and 6 and I can usually spot the problem  
now.


If nothing else, it'll help you narrow down the problem before  
asking questions here which most people are more then happy to do :)


Also... If you are dealing with databases (Since this is the DB  
list :)) I'd recommend to echo out your db statements to make sure  
you are doing what you think you are doing... Can't tell you how  
many times that screwed me up...


Just my experience, take it or leave it :)


--

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






Thanks Jason,

Actually its a Db/mysql-5.0.60-r1 issue which makes me wonder about  
debugging techniques php.
Im stuck with this on my early scripts that im experimenting.These  
are the echo of the SQL part:


INSERT INTO movietype (movietype_id, movietype_label) VALUE (1, 'Sci  
Fi'), (2, 'Drama'), (3, 'Adventure'), (4, 'Comedy'), (5, 'Horror'),  
(6, 'Action'), (7, 'Kids')


INSTERT INTO people (people_id, people_fullname, people_isactor,  
people_isdirector) VALUE (1, 'Jim Carrey', 1, 0), (2, 'Tom Shadyac',  
0, 1), (3, 'Lawrence Kasdan', 0,1), (4, 'Kevin Kline', 1, 0), (5,  
'Ron Livingston', 1, 0), (6, 'Mike Judge', 0, 1)
You have an error in your SQL syntax; check the manual that  
corresponds to your MySQL server version for the right syntax to use  
near 'INSTERT INTO people (people_id, people_fullname,  
people_isactor, people_isdirect' at line 1


Followed by:
Duplicate entry '1' for key 1

And i just can narrow down whats hapenning on that part, which one  
of my early scripts ...any idea?
The error is probably related the 2nd dB statement , but i cant  
figure out whats making it throwing error :-




Looking at it the first thing that stands out to me is the way you are  
breaking up the values... If I was doing it, my insert would look  
like: INSERT INTO people (people_id, people_fullname, people_isactor,  
people_isdirector) VALUES ("1", "Jim Carrey", "1", "0");


Notice also that I used the keyword VALUES (The S on the end) and a  
semi colon on the end of the line, it may be there, but it didn't come  
through :)


One other thing to try is to try and submit that directly to the  
database... See if that gives you any other errors which occasionally  
happens.



--

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] re:php debugging skills

2008-09-26 Thread Jason Pruim


On Sep 26, 2008, at 11:22 AM, muhsin wrote:

Could you guys share your development setup, like what kinds of  
software (IDE's/Editors) you are using for developing php scripts?
It might sound silly but I am just curios, as I just got started in  
php programming en i have firefox + kate/bluefish + LAMP built with  
gentoo.
Im mostly thinking that with only firefox and some logs left /var/ 
log or so, its not enough for me..Im looking for something like an  
IDE which can allow me to debug code in steps in central manner  
approach (ide), simplicity and efficiency...u know what i mean? :-D


Just kiddin bout simplicity ;-)




this has been discussed quite a bit over the years, but I just thought  
I'd pipe up since I was in your spot a little over a year ago...  What  
I did then, and still do when I can't figure it out from the error log  
is just a lot of echo "N"; through the application. That way, when I  
see it makes it to 5 but not 6 I check the code between 5 and 6 and I  
can usually spot the problem now.


If nothing else, it'll help you narrow down the problem before asking  
questions here which most people are more then happy to do :)


Also... If you are dealing with databases (Since this is the DB  
list :)) I'd recommend to echo out your db statements to make sure you  
are doing what you think you are doing... Can't tell you how many  
times that screwed me up...


Just my experience, take it or leave it :)


--

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] Question about databases and foreign keys

2008-09-15 Thread Jason Pruim


On Sep 15, 2008, at 10:59 AM, Micah Gersten wrote:


Use 2 tables.  You never know what the app might grow into and you
should do it right the first time.


That's what I was thinking too... Just wanted to hear it from someone  
else... NOW I get to learn about foreign keys and how to update things  
with them!


So if anyone knows of a good resource I'd appreciate it... Until then,  
I'm off to search the web and figure this stuff out!



--

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



[PHP-DB] Question about databases and foreign keys

2008-09-15 Thread Jason Pruim

Hi everyone,

I just wanted to make sure that I am not making something more  
complicated then it has to be.


I am working on a time clock application to use at my company, and so  
far, I have a login table, and with a foreign key that links to the  
time table. The thinking being, that when someone logs in, they get  
assigned there employee number, and then it adds a new record for that  
employee ID.


All I will be doing with the info, is grabbing the total amount of  
time they were clocked in for each day, and then totaling for the week.


I'm planning on using timestamps to store the actual time, hopefully  
making the math part easier :)


Do I need the foreign key and the 2 tables? Or should I just add the  
column's into the database since it will be for a small company?


Ideas? Suggestions?

Thanks!


--

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] solution reqd for summation of vertical columns in PHP

2008-09-13 Thread Jason Pruim


On Sep 13, 2008, at 10:05 PM, Vaibhav Informatics wrote:

Please let me know if there is a simple method to total up the  
column values

in Mysql database tables using php as in excel.


I believe what you are looking for is count(fieldname)



--
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 Jason Pruim


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:  to 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] Kesalahan posting?

2008-08-27 Thread Jason Pruim
I get the same 2 you do :) at least the autoresponder from david seems  
to be smart enough to only do 1 per day :)



On Aug 27, 2008, at 12:40 PM, Fergus Gibson wrote:


Every time I post I get this e-mail:

"Halo [EMAIL PROTECTED],

Kami mengirim email ini untuk menyampaikan bahwa grup yang Anda coba  
hubungi (donkomo) tidak ada atau Anda tidak memiliki izin untuk  
mengirim pesan ke grup itu. Ada beberapa kemungkinan mengapa hal ini  
terjadi:

[etc.]"

I have no idea what this means or what language it is in.  I don't  
want to receive an unintelligible (to me) message every time I  
post.  What gives?  Thanks.


I also think it would be awesome if people didn't set vacation auto- 
responders on e-mail accounts that are subscribed to the list (I'm  
looking at you [EMAIL PROTECTED]).  If you need to put an  
away auto-responder, unsubscribe 'til you get back.  Thanks.


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




--

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] Problem with updating MySQL table

2008-08-27 Thread Jason Pruim


On Aug 27, 2008, at 12:41 PM, Evert Lammerts wrote:


Everybody seems to agree on escaping :-) And I'm learning! HEREDOC,
nifty indeed!


Yeah, ever since I found out about HEREDOC I've used it quite  
extensively with some of my projects... Also, when you're in the  
HEREDOC block, if you need to reference a variable just do this:


Hello {$var1}!
HTML;
?>

and voila!



How about your $_POST variable, is there anything in there?


I think I have it narrowed down to disabling the editing of the  
fields...


If I do NOT disable the editing, then it submits fine, if I DO disable  
it then they don't submit.


I need to find a better to stop accidental editing rather then just  






On Wed, Aug 27, 2008 at 6:38 PM, Jason Pruim <[EMAIL PROTECTED]>  
wrote:


On Aug 27, 2008, at 12:24 PM, Evert Lammerts wrote:


Your index.php looks very strange:






?>


I'm guessing you're echoing this? I never echo from my scripts so I
don't know if this is new functionality, but in my days you echoed
either by  or by .


It is a index.php page using the HEREDOC syntax... so basically:
echo <<any HTML code goes here
HTML;

pretty nifty I feel.




Anyway, since you're using the $_POST variable, did you check if it
contains any values? You can do this with var_dump($_POST); Let us
know what the results are.

Another tip:


$FName= $_POST['txtFName'];
etc


is terrible practice - if anybody writes an SQL command into one of
your textfields it WILL be executed; this is called SQL injection. A
less terrible scenario, but still one that messes up your page, is  
if
somebody uses quotes. So always use mysql_real_escape_string() on  
your

post variables before using them in a query.


mysql_real_escape_string() won't help with my mysqlI connection  
though :)


I will be wrapping the whole thing in a prepared statement before  
going to
production with this. At this point this is simply a proof of  
concept for

the boss.
--

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









--

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] Problem with updating MySQL table

2008-08-27 Thread Jason Pruim


On Aug 27, 2008, at 12:24 PM, Evert Lammerts wrote:


Your index.php looks very strange:






?>


I'm guessing you're echoing this? I never echo from my scripts so I
don't know if this is new functionality, but in my days you echoed
either by  or by .


It is a index.php page using the HEREDOC syntax... so basically:
echo <<any HTML code goes here
HTML;

pretty nifty I feel.




Anyway, since you're using the $_POST variable, did you check if it
contains any values? You can do this with var_dump($_POST); Let us
know what the results are.

Another tip:


$FName= $_POST['txtFName'];
etc


is terrible practice - if anybody writes an SQL command into one of
your textfields it WILL be executed; this is called SQL injection. A
less terrible scenario, but still one that messes up your page, is if
somebody uses quotes. So always use mysql_real_escape_string() on your
post variables before using them in a query.


mysql_real_escape_string() won't help with my mysqlI connection  
though :)


I will be wrapping the whole thing in a prepared statement before  
going to production with this. At this point this is simply a proof of  
concept for the boss.

--

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] Problem with updating MySQL table

2008-08-27 Thread Jason Pruim

Hi Yves,

I plan to wrap the $_POST's into something to protect against some  
issues like that. But this was a proof of concept for the boss so it  
just needed to be up quickly to see if it was something we wanted to  
go ahead with :)



On Aug 27, 2008, at 12:21 PM, YVES SUCAET wrote:


Ah, how to debug SQL code in PHP...

Here's what I would do: run your query separately in something like  
SQLyog or
the Netbeans database interface. Just to "echo $sql" and copy and  
paste. An
"echo $Record" statement may also help to assure that you're passing  
on the PK

to the record correctly.

One suggestion: you may want put mysql_real_escape_string() wrappers  
around

all those $_POST[] fields to prevent SQL hijacking of your site.

HTH,

Yves

-- Original Message --
Received: Wed, 27 Aug 2008 11:07:20 AM CDT
From: Jason Pruim <[EMAIL PROTECTED]>
To: php-db@lists.php.net
Subject: [PHP-DB] Problem with updating MySQL table

Hi Everyone,

So I'm working on a project (Same one I sent the question about
regarding the user access rights on monday) And now I am attempting to
update the record... Here is some of my code:

index.php

First Name/Last Name 
Email Address 
Company name 
Company Address 
City/State/Zip
Phone 
Your Favorite Type of coffee:  
value="Other"> Other: size="20">

When would a good time to bring it over be? 



   

?>

purlprocessing.php



mysql> describe schreur;
++-+--+-+-+---+
| Field  | Type| Null | Key | Default | Extra |
++-+--+-+-+---+
| FName  | varchar(20) | YES  | | NULL|   |
| LName  | varchar(20) | YES  | | NULL|   |
| email  | varchar(50) | YES  | | NULL|   |
| phone  | varchar(12) | YES  | | NULL|   |
| url| int(12) | YES  | | NULL|   |
| record | int(7)  | YES  | | NULL|   |
| subscribed | int(1)  | NO   | | |   |
| date   | varchar(12) | YES  | | NULL|   |
| IPAddress  | varchar(19) | YES  | | NULL|   |
| Business   | varchar(20) | YES  | | NULL|   |
| Address1   | varchar(50) | YES  | | NULL|   |
| City   | varchar(20) | YES  | | NULL|   |
| State  | varchar(2)  | YES  | | NULL|   |
| Zip| varchar(10) | YES  | | NULL|   |
| Coffee | varchar(20) | YES  | | NULL|   |
| Meeting| text| YES  | | NULL|   |
++-+--+-+-+---+


The problem is when I am attempting to update some of the info, it
erases the info in the field.

Anyone got a clue as to what is going on? :)

Thanks for looking!



--

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




--

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



[PHP-DB] Problem with updating MySQL table

2008-08-27 Thread Jason Pruim

Hi Everyone,

So I'm working on a project (Same one I sent the question about  
regarding the user access rights on monday) And now I am attempting to  
update the record... Here is some of my code:


index.php

	First Name/Last Namevalue="{$row['FName']}" $edit> value="{$row['LName']}" $edit>
	Email Address value="{$row['email']}" $edit>
	Company name value="{$row['Business']}" $edit>
	Company Address value="{$row['Address1']}" $edit>
	City/State/Zip value="{$row['City']}" $edit> value="{$row['State']}" $edit> value="{$row['Zip']}" $edit>	
	Phone $edit>
	Your Favorite Type of coffee: value="Starbucks">   
 	 value="Other"> Other: 
	When would a good time to bring it over be? name="txtMeeting">




   

?>

purlprocessing.php

	$sql = "UPDATE `schreur` set FName='{$FName}', LName='{$LName}',  
email='{$Email}', Business='{$Business}', Address1='{$Address1}',  
City='{$City}', State='{$State}', Zip='{$Zip}', Coffee='{$Coffee}',  
subscribed='0', date='{$date}', IPAddress='{$IPAddress}',  
Meeting='{$Meeting}' WHERE record='{$Record}'";
	mysqli_query($link, $sql) or die("Could not update..." .  
mysqli_error($link));

?>

mysql> describe schreur;
++-+--+-+-+---+
| Field  | Type| Null | Key | Default | Extra |
++-+--+-+-+---+
| FName  | varchar(20) | YES  | | NULL|   |
| LName  | varchar(20) | YES  | | NULL|   |
| email  | varchar(50) | YES  | | NULL|   |
| phone  | varchar(12) | YES  | | NULL|   |
| url| int(12) | YES  | | NULL|   |
| record | int(7)  | YES  | | NULL|   |
| subscribed | int(1)  | NO   | | |   |
| date   | varchar(12) | YES  | | NULL|   |
| IPAddress  | varchar(19) | YES  | | NULL|   |
| Business   | varchar(20) | YES  | | NULL|   |
| Address1   | varchar(50) | YES  | | NULL|   |
| City   | varchar(20) | YES  | | NULL|   |
| State  | varchar(2)  | YES  | | NULL|   |
| Zip| varchar(10) | YES  | | NULL|   |
| Coffee | varchar(20) | YES  | | NULL|   |
| Meeting| text| YES  | | NULL|   |
++-+--+-+-+---+


The problem is when I am attempting to update some of the info, it  
erases the info in the field.


Anyone got a clue as to what is going on? :)

Thanks for looking!



--

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






Re: [PHP-DB] Question about access rights in php/mysql

2008-08-26 Thread Jason Pruim


On Aug 26, 2008, at 8:32 AM, Dan Shirah wrote:


Hi Everyone,

I am attempting to wrap my head around an issue and wanted to see if  
I was thinking right.


I am attempting to setup a pURL site, one where they go to something  
like: example.com/purl.php?purl=jason1234 and the site says "Welcome  
Jason". I have that part of it working, and it's pulling the info  
from the database just fine, what I'm wondering about is locking it  
down a little bit more so that they can't just edit the info in the  
main page, but they have to specifically hit a button to edit the  
info.


Is it better to have 2 connections to the database with 2 separate  
logins? One for the initial load which just has select privileges  
and a second for when they hit edit which then gives them update  
privileges?


Or, should i just do 1 login with select, and update privileges?

Any ideas or suggestions?

Thanks!


Jason,

I would assume you have some kind of login page, correct? Or can  
anyone type in the direct URL and access someone else's page?


If they have already logged in, I would use some simple javascript  
to enable/disable the editing of form objects. By setting all of the  
form objects to "disabled" they will appear grayed out but the text  
is still legible.  Then when they click on your "Edit" button just  
have a Javascript function set them all to enabled. You could do  
something similar to show/hide div's.


Or, you could bypass all the javascript and just add an "edit" flag  
to your page? So once they click on the Edit button/link it would  
update a variable and you could do something like:


if ($edit =="Y") {
  
}

Add in the option to save only if Edit has been selected?

As for your database logins, I don't see a problem with doing it  
either way. I personally prefer to use a single login, but doing a  
include() for a second login is no big deal either.


Hi Dan,

Thanks for the info! the page will not actually require a login, it is  
a new direct mail technique where they get a piece of mail with the  
pURL on it, and then go there to "follow up" on the web.


I think though that I will go with the 1 login, with a simple variable  
like to described.


Thanks Dan!


--

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






[PHP-DB] Question about access rights in php/mysql

2008-08-26 Thread Jason Pruim

Hi Everyone,

I am attempting to wrap my head around an issue and wanted to see if I  
was thinking right.


I am attempting to setup a pURL site, one where they go to something  
like: example.com/purl.php?purl=jason1234 and the site says "Welcome  
Jason". I have that part of it working, and it's pulling the info from  
the database just fine, what I'm wondering about is locking it down a  
little bit more so that they can't just edit the info in the main  
page, but they have to specifically hit a button to edit the info.


Is it better to have 2 connections to the database with 2 separate  
logins? One for the initial load which just has select privileges and  
a second for when they hit edit which then gives them update privileges?


Or, should i just do 1 login with select, and update privileges?

Any ideas or suggestions?

Thanks!


--

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] Multi-level marketing system

2008-08-14 Thread Jason Pruim


On Aug 14, 2008, at 6:30 AM, A. Joseph wrote:

I want to develop a multilevel marketing system, please can someone  
give me
a good starting point,  or if you know a system developed for such,  
tell me.




It will be a hierarchical structure.

But members will need to earn money on some level




And what precisely does this have to do with PHP or databases?

I have a feeling if you google for "MLM Systems" you'll get more then  
you could ever want...



--

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] Timestamps

2008-05-02 Thread Jason Pruim


On May 1, 2008, at 8:31 PM, Chris wrote:



PS... Was it you, Jason, or someone else who asked about the  
security
of the community knowing their database structure and I encouraged  
the

use of `backticks` around all field and table names?


Yeah it was me... Old habits die hard :) I'm working on converting
everything :)


A little caveat with that:

1) it's mysql specific


Currently the system is just running on my server, and probably always  
will... so I'm not too worried about it being mysql specific.


2) I can disable you using backticks

http://www.php.net/manual/en/language.operators.execution.php


I'll have to take a look at that and see what it says in a little bit.


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
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] How to do a Newsletter

2008-05-01 Thread Jason Pruim
Without seeing any of your code to base it off of I'd select it like  
this:


$sql = "SELECT `email`, `emailNewsletter` FROM `mytable` where  
`emailNewsletter`='YES'";


then just loop through the array that gets returned...

while ($row = mysqli_fetch_assoc($result)) {
//build the e-mail


}

Obviously, there's more to it, but that should get you started. If you  
run into trouble, post code that we could look at and see if we can  
help you.




On May 1, 2008, at 12:17 PM, Nasreen Laghari wrote:

I have to email it. Basically I have run a query according to user  
criteria of newsletter and send it via email



- Original Message 
From: Jason Pruim <[EMAIL PROTECTED]>
To: Nasreen Laghari <[EMAIL PROTECTED]>
Cc: php-db@lists.php.net
Sent: Thursday, May 1, 2008 5:03:43 PM
Subject: Re: [PHP-DB] How to do a Newsletter

That's not an awful lot to go off of.. I'm assuming the actual
newsletter is already produced probably in a PDF?

Are you looking to e-mail it out?

Post it to a website?

Get e-mail addresses to e-mail it to?

Get postal addresses to postal mail it to?

More info I think would definitely help.


On May 1, 2008, at 11:59 AM, Nasreen Laghari wrote:


Hi,
Does any one know a better way of doing "Newsletter". I have to run
a query and send that data to clients.
Regards




Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]




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


  


Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
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] How to do a Newsletter

2008-05-01 Thread Jason Pruim
That's not an awful lot to go off of.. I'm assuming the actual  
newsletter is already produced probably in a PDF?


Are you looking to e-mail it out?

Post it to a website?

Get e-mail addresses to e-mail it to?

Get postal addresses to postal mail it to?

More info I think would definitely help.


On May 1, 2008, at 11:59 AM, Nasreen Laghari wrote:


Hi,
Does any one know a better way of doing "Newsletter". I have to run  
a query and send that data to clients.

Regards


  


Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
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] Timestamps

2008-05-01 Thread Jason Pruim


On Apr 30, 2008, at 5:03 PM, Philip Thompson wrote:


On Apr 30, 2008, at 10:54 AM, Jason Pruim wrote:

Hi Yves,

Thanks for the tip, that worked, I think I'll use that from now on..

Just out of curiosity though, any idea why it wasn't working as I  
was writing it :)


Did you try putting the query that PHP is generating in phpMyAdmin  
or MySQL Query Browser? See if it throws an error when attempting to  
update. It *appears* that the query should work.


No I haven't, I don't have phpMyAdmin installed since I do it all from  
the command line, and I don't pay for hosting yet... But I am going to  
need to change that. I don't believe I have heard about MySQL Query  
Browser though... Is it a webapp? Or do I need to install it on my  
local computer?






~Philip

PS... Was it you, Jason, or someone else who asked about the  
security of the community knowing their database structure and I  
encouraged the use of `backticks` around all field and table names?


Yeah it was me... Old habits die hard :) I'm working on converting  
everything :)





On Apr 30, 2008, at 11:47 AM, YVES SUCAET wrote:


Hi Jason,

It's not because you create a date/time value that you  
automatically have an
integer-value. You need to specify first that you want the date/ 
time value

converted to an integer value first.

See
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_unix-timestamp
for an example of how to do this.

Actually, by using this function, you probably don't even need to  
create the
$modifiedTimestamp variable anymore. You can just write your SQL  
query as

follows:

$sql = "Update `mytable` set timestamp=UNIX_TIMESTAMP() where  
Record='1'";


HTH,

Yves

-- Original Message --
Received: Wed, 30 Apr 2008 10:39:11 AM CDT
From: Jason Pruim <[EMAIL PROTECTED]>
To: Stut <[EMAIL PROTECTED]>Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Timestamps


On Apr 30, 2008, at 11:35 AM, Stut wrote:


On 30 Apr 2008, at 16:29, Jason Pruim wrote:

Okay... So I know this should be simple...

Trying to store a timestamp in a MySQL database... The timestamp I
am making like so: $modifiedTimestamp = time();

and then just $sql = "Update `mytable` set
timestamp='$modifiedTimestamp' where Record='1'";

Simple right? Not quite...in my database it's storing a "0" in the
timestamp field which is a int(10) field.

I have googled, and searched manuals, but have not been able to
figure out what is going on

Any Ideas?


timestamp is a reserved word. Try putting it in backticks.



Okay, so I did a really crappy job at my sudo code... The field name
is actually Last_Updated.

so my update code looks like this: Last_Updated='$modifiedTimestamp'

*Slaps his wrist... Bad copy/paste! BAD!!!


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




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
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] Timestamps

2008-04-30 Thread Jason Pruim

Hi Yves,

Thanks for the tip, that worked, I think I'll use that from now on..

Just out of curiosity though, any idea why it wasn't working as I was  
writing it :)



On Apr 30, 2008, at 11:47 AM, YVES SUCAET wrote:


Hi Jason,

It's not because you create a date/time value that you automatically  
have an
integer-value. You need to specify first that you want the date/time  
value

converted to an integer value first.

See
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_unix-timestamp
for an example of how to do this.

Actually, by using this function, you probably don't even need to  
create the
$modifiedTimestamp variable anymore. You can just write your SQL  
query as

follows:

$sql = "Update `mytable` set timestamp=UNIX_TIMESTAMP() where  
Record='1'";


HTH,

Yves

-- Original Message --
Received: Wed, 30 Apr 2008 10:39:11 AM CDT
From: Jason Pruim <[EMAIL PROTECTED]>
To: Stut <[EMAIL PROTECTED]>Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Timestamps


On Apr 30, 2008, at 11:35 AM, Stut wrote:


On 30 Apr 2008, at 16:29, Jason Pruim wrote:

Okay... So I know this should be simple...

Trying to store a timestamp in a MySQL database... The timestamp I
am making like so: $modifiedTimestamp = time();

and then just $sql = "Update `mytable` set
timestamp='$modifiedTimestamp' where Record='1'";

Simple right? Not quite...in my database it's storing a "0" in the
timestamp field which is a int(10) field.

I have googled, and searched manuals, but have not been able to
figure out what is going on

Any Ideas?


timestamp is a reserved word. Try putting it in backticks.



Okay, so I did a really crappy job at my sudo code... The field name
is actually Last_Updated.

so my update code looks like this: Last_Updated='$modifiedTimestamp'

*Slaps his wrist... Bad copy/paste! BAD!!!

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[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




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
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] Timestamps

2008-04-30 Thread Jason Pruim


On Apr 30, 2008, at 11:35 AM, Stut wrote:


On 30 Apr 2008, at 16:29, Jason Pruim wrote:

Okay... So I know this should be simple...

Trying to store a timestamp in a MySQL database... The timestamp I  
am making like so: $modifiedTimestamp = time();


and then just $sql = "Update `mytable` set  
timestamp='$modifiedTimestamp' where Record='1'";


Simple right? Not quite...in my database it's storing a "0" in the  
timestamp field which is a int(10) field.


I have googled, and searched manuals, but have not been able to  
figure out what is going on


Any Ideas?


timestamp is a reserved word. Try putting it in backticks.



Okay, so I did a really crappy job at my sudo code... The field name  
is actually Last_Updated.


so my update code looks like this: Last_Updated='$modifiedTimestamp'

*Slaps his wrist... Bad copy/paste! BAD!!!

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]




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



[PHP-DB] Timestamps

2008-04-30 Thread Jason Pruim

Okay... So I know this should be simple...

Trying to store a timestamp in a MySQL database... The timestamp I am  
making like so: $modifiedTimestamp = time();


and then just $sql = "Update `mytable` set  
timestamp='$modifiedTimestamp' where Record='1'";


Simple right? Not quite...in my database it's storing a "0" in the  
timestamp field which is a int(10) field.


I have googled, and searched manuals, but have not been able to figure  
out what is going on


Any Ideas?
--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
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 database

2008-04-18 Thread Jason Pruim


On Apr 18, 2008, at 7:35 AM, nickthegreek- wrote:


hello to everyone.. what i wanna..

is to send me the total code from the connection in the database  
until the

end

what i wanna is

i have a connection in database

and i wanna my page to show a dropdown menu whick shows the column  
name in

my database "select name from xxx"

when i select a name from the dropdown menu , iw anna to show me  
what name i

have selected..
pls help


Are you looking for something that just displays the table names in a  
drop down box? Do you have any code you could show to help explain  
your question?




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
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] mysqli_stmt_bind_param question

2008-04-04 Thread Jason Pruim

Hi Krister,

On Apr 4, 2008, at 2:35 PM, Krister Karlström wrote:

Hi!

First of all you must connect to the server and then perform an init  
to get a statement. Maybe you dropped that code out here... Please  
have a look at the manual page:


http://www.php.net/manual/en/function.mysqli-stmt-prepare.php

In order to get the result you also need to bind the result to a  
variable and then fetch the data.


I'll guess that your error comes from an unsuccessful initialization  
of your prepared statement.


If you don't want to include your primary key column that is  
autogenerated you just ignore it. That means to write a proper query  
like:


INSERT INTO legioCurrent (column_1, column_2, ...)
VALUES (?,?,...)


I was not aware with prepared statements you could do it that way...  
Thank you! Once I added that it worked like a charm! Not quite sure  
how I missed that on the manuel page though...





I would also like to propose for you to use the object oriented  
style, since it's more readable and easier to get an overview of.


I have never been able to understand OO code... For me the procedural  
code is much easier to read.





You also don't need to mess around with so many parameters.


What do you mean by this?






--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]




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



[PHP-DB] mysqli_stmt_bind_param question

2008-04-04 Thread Jason Pruim

Hi Everyone,

I have a MySQL database that I am accessing from PHP. The table in  
question has a auto increment field on it and I don't want to include  
that in my add/edit/update query's to the database... But I can't seem  
to figure out how to ignore it? Everything I have done seems to fail..  
I am using prepared statements so I"m not sure it that is it, but I  
would like to keep using them since it reduces the security issues a  
little... Here is the code from one of my prepared statements:


//Create the statement
mysqli_stmt_prepare($stmt, "INSERT INTO legionCurrent VALUES  
( ?,?,?,?,?,?,?,?)");
mysqli_stmt_bind_param($stmt, '', $FName, $LName, $Add1,  
$Add2, $City, $State, $Zip, $XCode)or die(mysqli_error($addlink));

//Add the record
mysqli_stmt_execute($stmt) or die(mysqli_error($addlink));

Here is the error I get in my logs:

[Fri Apr  4 09:35:32 2008] [error] PHP Warning:   
mysqli_stmt_bind_param() [function.mysqli-stmt-bind-param]: invalid object or  
resource mysqli_stmt\n in /Volumes/RAIDer/webserver/Documents/dev/ 
OLDBv2/add.php on line 91


Line 91 is the mysqli_stmt_bind_param() line above

My database structure looks like this:

| FName  | LName | Add1| Add2| City | State | Zip  |  
XCode  | Reason  | Record


I know there is away to do it, but all my searching and reading hasn't  
told me anything... I've looked in the php manual, and mysql, plus  
various websites... and I just can't figure this one out... RTFM's are  
appreciated, as long as M is defined! :)


Thanks for taking the time to look!



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]





Re: [PHP-DB] Not updating certain fields in same row

2008-03-27 Thread Jason Pruim

Hi Everyone

Thanks for all the info and help with this, I have decided to write a  
separate function for changing the password. That way I can compare  
the original password with the one inputted in the database, and then  
change it after both have been the old and new password have been  
verified :)


So Thanks! :)



On Mar 25, 2008, at 12:59 PM, Jason Pruim wrote:

Hi everyone,

I am attempting to update a record for a login system while leaving  
certain fields untouched if they arn't changed, and am running into  
issues.


Basically what I want to do, is say I have these fields:

Field1
Field2
Field3
Field4

I update Field1 and Field3 but not Field2 and Field4. What I want to  
do is change the values in Field1 and Field3 without touching the  
values in Field2 and Field4.


I have tried this code:
$tab = "\t";
	if (!isset($_POST['txtLoginName']) ||  
empty($_POST['txtLoginName'])) {


			$loginName = mysqli_real_escape_string($chpwpostlink,  
$_POST['txtLoginName']);

}
else
{
$loginName = $tab;
}

which works the fields that I've changed, but if I don't submit a  
value in the form it sets the field to be blank in MySQL. Which is  
what I am trying to avoid. Any ideas?


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]





--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
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] Not updating certain fields in same row

2008-03-25 Thread Jason Pruim


On Mar 25, 2008, at 2:57 PM, Evert Lammerts wrote:

I might be way off here. Php.net tells me that:

[quote]

mysql_real_escape_string — Escapes special characters in a string  
for use in a SQL statement


string **mysql_real_escape_string** ( string $unescaped_string [,  
resource $link_identifier ] )


[/quote]

and you use

[quote]

mysqli_real_escape_string($chpwpostlink, $_POST['txtLoginName']);

[/quote]

I can't imagine that $_POST['txtLoginName'] is a resource identifier  
(which is the actual connection to your database).


It's not... see: http://us2.php.net/manual/en/function.mysqli-real-escape-string.php 
 Notice the I after mysql



Also, this condition:

[quote]

if (!isset($_POST['txtLoginName']) || empty($_POST['txtLoginName']))

[/quote]

is true if and only if no form element by the name txtLoginName  
existed on the previous page - and on top of that, empty() does the  
same as isset() and apart from that also checks whether, if the  
variable has been set, it has a value (0, "", NULL or FALSE) that  
evaluates to FALSE.


I don't understand why you'd want to fill the username with a tab  
either: "\t".
I didn't want to... What I am attempting to do is if the field is NOT  
changed, don't touch it in the database. The main issue I had was with  
the password field for updating a password since I"m not going to read  
a MD5 hash back to the user to be edited.





Maybe you can post your full code?

Evert


Daniel Brown wrote:
On Tue, Mar 25, 2008 at 1:14 PM, Jason Pruim <[EMAIL PROTECTED]>  
wrote:



the actual query I'm using is this:

   $chpwsql = "UPDATE current SET customerName='$customerName',
loginName='$loginName', loginPassword='$PW', email='$email',
adminLevel='$adminLevel' WHERE Record='$Record1'";

What it is doing now is if I don't set a a field I am replacing the
content of it with a tab, which isn't what I want. Basically what  
I'm

looking for is if loginPassword hasn't changed... don't clear the
contents of it. if it has changed, then update loginPassword



   Okay, since you won't only want to rely on isset() here (in case
someone accidentally hits a key into the field), try this:

// NOTE: This assumes prior sanity checks and cleansing
// of variables, and is written like so to avoid breaking
// of the query due to mail client-enforced line breaks.
$chpwsql  = "UPDATE current SET ";
$chpwsql .= "customerName='".$customername."',";
$chpwsql .= "loginName='".$loginName."',";
if(preg_match('/^[a-z0-9]{5,16}$/i',$PW)) {
   // If it's between 5-16 case-insensitive alphanumeric
   // characters, it's all good. If you want to allow symbols,
   // simply modify the regexp accordingly.
   $chpwsql .= "loginPassword='".$PW."',";
}
$chpwsql .= "email='".$email."',";
$chpwsql .= "adminLevel='".$adminLevel',";
$chpwsql .= " WHERE Record='".$Record1."'";
$chpwsql .= " LIMIT 1";





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




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
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] Not updating certain fields in same row

2008-03-25 Thread Jason Pruim


On Mar 25, 2008, at 1:17 PM, Matt Anderton wrote:
I usually pre-populate the form with the values that are already in  
the

record:

(... using PEAR's MDB2 package -- http://pear.php.net/packages/MDB2 )

$query = "SELECT * FROM member WHERE username = '" .  
$_POST['username'] .

"'";
$result = $db->query($query);
$member = $result->fetchRow(MDB2_FETCHMODE_ASSOC);

foreach ($member as $key => $value) {
$$key = $value;
}

method="POST">










then when they submit, the record is just repopulated with whatever  
is in
the form when they submit.  ie -- only fields they changed get  
changed in

the db.

if($_POST['_submit']) {
$update = "UPDATE member SET .. blah, blah..."
}

that way, none of the fields are blank unless they were in the db  
blank to
begin with.  and you can add client or server-side validation to  
prevent

that.

-- matt


Hi Matt,

That's what I'm doing for most of the fields, but how would you handle  
a password that has been MD5'ed and includes some variables to make it  
harder to crack? :)


ie: $PW = md5("$salt$password");

I can't undo the MD5 and I don't really want to... Just want to be  
able to change it rather then view what it is.









On Tue, Mar 25, 2008 at 11:59 AM, Jason Pruim <[EMAIL PROTECTED]>  
wrote:



Hi everyone,

I am attempting to update a record for a login system while leaving
certain fields untouched if they arn't changed, and am running into
issues.

Basically what I want to do, is say I have these fields:

Field1
Field2
Field3
Field4

I update Field1 and Field3 but not Field2 and Field4. What I want to
do is change the values in Field1 and Field3 without touching the
values in Field2 and Field4.

I have tried this code:
  $tab = "\t";
  if (!isset($_POST['txtLoginName']) ||
empty($_POST['txtLoginName'])) {

  $loginName =
mysqli_real_escape_string($chpwpostlink,
$_POST['txtLoginName']);
  }
  else
  {
  $loginName = $tab;
  }

which works the fields that I've changed, but if I don't submit a
value in the form it sets the field to be blank in MySQL. Which is
what I am trying to avoid. Any ideas?

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]






--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
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] Not updating certain fields in same row

2008-03-25 Thread Jason Pruim


On Mar 25, 2008, at 1:09 PM, Daniel Brown wrote:
On Tue, Mar 25, 2008 at 12:59 PM, Jason Pruim <[EMAIL PROTECTED]>  
wrote:

Hi everyone,

I am attempting to update a record for a login system while leaving
certain fields untouched if they arn't changed, and am running into
issues.

[snip!]


I have tried this code:
   $tab = "\t";
   if (!isset($_POST['txtLoginName']) ||  
empty($_POST['txtLoginName'])) {


   $loginName =  
mysqli_real_escape_string($chpwpostlink,

$_POST['txtLoginName']);
   }
   else
   {
   $loginName = $tab;
   }


   Mmm-hmm and exactly how do that work to update the database?
The SQL query you're probably looking for would be like this:

   $sql = "UPDATE users SET
Field1 
= 
'".mysql_real_escape_string 
($field1)."',Field3='".mysql_real_escape_string($field3)."'

WHERE id='".mysql_real_escape_string($id)."' LIMIT 1";


the actual query I'm using is this:

	$chpwsql = "UPDATE current SET customerName='$customerName',  
loginName='$loginName', loginPassword='$PW', email='$email',  
adminLevel='$adminLevel' WHERE Record='$Record1'";


What it is doing now is if I don't set a a field I am replacing the  
content of it with a tab, which isn't what I want. Basically what I'm  
looking for is if loginPassword hasn't changed... don't clear the  
contents of it. if it has changed, then update loginPassword






--

Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

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




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]




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



[PHP-DB] Not updating certain fields in same row

2008-03-25 Thread Jason Pruim

Hi everyone,

I am attempting to update a record for a login system while leaving  
certain fields untouched if they arn't changed, and am running into  
issues.


Basically what I want to do, is say I have these fields:

Field1
Field2
Field3
Field4

I update Field1 and Field3 but not Field2 and Field4. What I want to  
do is change the values in Field1 and Field3 without touching the  
values in Field2 and Field4.


I have tried this code:
$tab = "\t";
if (!isset($_POST['txtLoginName']) || empty($_POST['txtLoginName'])) {

			$loginName = mysqli_real_escape_string($chpwpostlink,  
$_POST['txtLoginName']);

}
else
{
$loginName = $tab;
}

which works the fields that I've changed, but if I don't submit a  
value in the form it sets the field to be blank in MySQL. Which is  
what I am trying to avoid. Any ideas?


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]





Re: [PHP-DB] PHP, MySQL and Lookups

2008-02-26 Thread Jason Pruim


On Feb 26, 2008, at 8:55 AM, Henry Felton wrote:


Hi everyone,

I'm just getting into PHP at the moment and was wondering; what code  
would I
need to look at a field value entered in a form, then if that value  
is found
in my table, enter all the other information entered in the form, to  
the

other fields on that record.
Basically, what I'm trying to do is give a load of users an individual
password that they enter, with various other pieces of information  
such as
year of birth, single/married or whatever, into a form. In MySQL I  
have a
table with three fields, but only the password one has any data in  
them. A
script will then took in the table to find the password entered in  
the form,

and then append all the other information (i.e. data for the other two
fields) to the particular record that holds the password value  
entered.


Hope that made sense, but I'd be so grateful if someone could help  
me with

this


What you're looking for to me sounds like using the UPDATE syntax in  
MySQL... something along the lines of:


$sql = "UPDATE tablename field1="$MySuperData1" field2="$MySuperData2"  
where password="$MySuperHardPassword";


Of course, this is untested check the mysql site for specifics on  
using update. Also... always be sure to escape your data or you are  
asking for trouble...


That should be enough to get you started!



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
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] Question about database design

2007-10-24 Thread Jason Pruim
I think I understand what you are saying here... On the main table  
just list the persons name and then on a second table use a 1 to many  
relationship on a foreign key to link all the addresses into the  
name? Or did I miss the mark? :)



On Oct 24, 2007, at 9:30 AM, Bastien Koert wrote:

I would approach this by having a main people table (with a unique  
id of course) and then create a second addresses table which uses  
the people Id key as the foreign key to this table...then you can  
have multiple (more than two) addresses for those users, you could  
add a season in the addresses to be able to pull the correct one  
based on date


bastien

> To: php-db@lists.php.net
> From: [EMAIL PROTECTED]
> Date: Wed, 24 Oct 2007 09:06:29 -0400
> Subject: [PHP-DB] Question about database design
>
> I sent this to the MySQL list but didn't receive any
> response, My apologies if you have already received this.
>
>
> Hi Everyone,
>
> So having learned my lesson with the last application, I am  
trying to

> plan out the addition of a feature to my database application.
> Basically, some of my customers go south for the winter ("Snow
> Birds") what I would like to do is have away of storing both their
> addresses in the database, and have it so that the people
> administering the list can choose between wether they are up  
north or

> down south without having to erase the old address.
>
> For that I was thinking creating a second table "SnowBirds" and list
> their southern addresses in there and then when the list admin  
clicks
> on the edit button for their name, it would also be able to pull  
up a

> list of the the addresses stored and associated with that person.
>
> I'm also considering adding a date range for the addresses so  
that if

> they know they'll be south from November to March it will check the
> date and switch between the record accordingly BEFORE exporting to
> excel.
>
> Now... I haven't really asked a question yet but gave some  
background

> into what I want to do. So... Here's the question, does anyone
> have any advice on the best way to do it? Am I right in thinking  
that
> a second table is required? Would it be called a Relational  
database?

> Or have I missed the terminology?
>
> Any help would be greatly appreciated!
>
> Thanks for looking!
>
> ohhh... and in case it makes a difference it's MySQL 5.* and I'll be
> writing the stuff to access that database with php 5.
>
> --
>
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 3251 132nd ave
> Holland, MI, 49424
> www.raoset.com
> [EMAIL PROTECTED]
>
>


Express yourself with free Messenger emoticons. Get them today!


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]




Re: [PHP-DB] Question about database design

2007-10-24 Thread Jason Pruim

Hi Tim,

Right now the customer I have has about 1,000 records which I know  
isn't alot for MySQL to handle, but if people like the application we  
could end up with 15 to 20 all having around 1,000 or more records  
which would add up more on the database. Although right now I plan to  
have a database per customer, easier to keep the info separate. I'm  
just beginning with MySQL and PHP (Although I know and understand PHP  
more then MySQL)


So just to double check I understand what you are saying, you would  
set up a database with 2 tables, on the first one would be something  
like name, address, city, state, zip, Primary Key. And then on the  
second table it would have Name, address, city, state, zip, foreign  
key?  and the foreign key someone links the 2 records?


Like I said, I'm still learning MySQL :) Know of any good articles  
that describe it for a beginner?



On Oct 24, 2007, at 9:28 AM, Tim McGeary wrote:


Hi Jason,

There are a couple ways you could do this.  Yes, this would make it  
a relational database.


If you go with a second table, you'll want to be sure to include  
the UID from the main address table in the "SnowBirds" table so  
that they are linked.  The UID in the second table would actually  
be a foreign key that links it to the main address table.  It could  
also act as the primary key of the "SnowBirds" table since it will  
be unique.  The other importance for this relationship of the UID  
is that if you delete a person and their address from the main  
table, you'll probably want to delete their seasonal address, too.


You may also want to have a binary column in your main address  
table to indicate to your PHP script whether or not to look for  
another address in the SnowBirds tables.  I would do this so that  
you aren't wasting an SQL query if it isn't needed.  May not be a  
big deal if you have limited tables, but as list of queries  
increase, there is no need for extra queries.


You could add a start date and end date column the "SnowBirds"  
database.  Sounds like for your purposes that is a good idea.


If you I missed anything or you have more specific questions, feel  
free to email me on or off list.


Cheers,
Tim

Tim McGeary '99, '06G
Senior Systems Specialist
Lehigh University
610-758-4998
[EMAIL PROTECTED]


Jason Pruim wrote:
I sent this to the MySQL list but didn't receive any  
response, My apologies if you have already received this.

Hi Everyone,
So having learned my lesson with the last application, I am trying to
plan out the addition of a feature to my database application.
Basically, some of my customers go south for the winter ("Snow
Birds") what I would like to do is have away of storing both their
addresses in the database, and have it so that the people
administering the list can choose between wether they are up north or
down south without having to erase the old address.
For that I was thinking creating a second table "SnowBirds" and list
their southern addresses in there and then when the list admin clicks
on the edit button for their name, it would also be able to pull up a
list of the the addresses stored and associated with that person.
I'm also considering adding a date range for the addresses so that if
they know they'll be south from November to March it will check the
date and switch between the record accordingly BEFORE exporting to
excel.
Now... I haven't really asked a question yet but gave some background
into what I want to do. So... Here's the question, does anyone
have any advice on the best way to do it? Am I right in thinking that
a second table is required? Would it be called a Relational database?
Or have I missed the terminology?
Any help would be greatly appreciated!
Thanks for looking!
ohhh... and in case it makes a difference it's MySQL 5.* and I'll be
writing the stuff to access that database with php 5.
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
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




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
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



[PHP-DB] Question about database design

2007-10-24 Thread Jason Pruim
I sent this to the MySQL list but didn't receive any  
response, My apologies if you have already received this.



Hi Everyone,

So having learned my lesson with the last application, I am trying to
plan out the addition of a feature to my database application.
Basically, some of my customers go south for the winter ("Snow
Birds") what I would like to do is have away of storing both their
addresses in the database, and have it so that the people
administering the list can choose between wether they are up north or
down south without having to erase the old address.

For that I was thinking creating a second table "SnowBirds" and list
their southern addresses in there and then when the list admin clicks
on the edit button for their name, it would also be able to pull up a
list of the the addresses stored and associated with that person.

I'm also considering adding a date range for the addresses so that if
they know they'll be south from November to March it will check the
date and switch between the record accordingly BEFORE exporting to
excel.

Now... I haven't really asked a question yet but gave some background
into what I want to do. So... Here's the question, does anyone
have any advice on the best way to do it? Am I right in thinking that
a second table is required? Would it be called a Relational database?
Or have I missed the terminology?

Any help would be greatly appreciated!

Thanks for looking!

ohhh... and in case it makes a difference it's MySQL 5.* and I'll be
writing the stuff to access that database with php 5.

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]