[PHP-DB] advancing file pointer
hi, i was able to read from the file, thanks for your help, but one problem it gives me the first 2 chars as garbage values and then proceeds to print out the enter file. so how can i proceed to advance the file pointer. any suggestions. regards, roslyn - Do you Yahoo!? New DSL Internet Access from SBC Yahoo!
[PHP-DB] Re: Stupid dumb question about mySQL Im sure.
Try to use single quotes in your where statement delete from logfile where browser = 'some_browser'; HTH, Ernani Liz Kimber [EMAIL PROTECTED] escreveu na mensagem news:[EMAIL PROTECTED]... OK, I have a table, such as CREATE TABLE logfile ( Address varchar(255) NOT NULL, GroupID varchar(20) NOT NULL, UserID varchar(20) NOT NULL, AccessDate varchar(40) NOT NULL, Cmd varchar(255) NOT NULL, RetCode varchar(4) NOT NULL, Size varchar(20) NOT NULL, Referer varchar(255) NOT NULL, Browser varchar(255) NOT NULL, KEY Address (Address), KEY GroupID (GroupID), KEY UserID (UserID), KEY AccessDate (AccessDate), KEY Cmd (Cmd), KEY RetCode (RetCode), KEY Size (Size), KEY Referer (Referer), KEY Referer_2 (Referer), KEY Browser (Browser) ); OK, so why does the following line not work. delete FROM logfile WHERE Browser=somebrowser I dont get it. I need to strip out some stuff, the file is getting too big -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: ASP PHP
Try to search for asp2php at google.com []'s Ernani Nwakaji Eppie [EMAIL PROTECTED] escreveu na mensagem news:[EMAIL PROTECTED]... Does anyone know if there is a script that converts ASP to PHP?? Thanks in advance Nwakaji -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] sending hidden values
hi all, in my php script im using SELECT in FORM element. the OPTION values for SELECT tag are coming from database. and the situation in my code is that, those values i need to pass as a hidden value thru form. im doing it as, FORM method=post action=act_modify.php . . . SELECT NAME=item_v // some stuff before this to build query ? $result = mysql_query($query) or die (SELECT failed.); while ($list = mysql_fetch_array($result)) { print('INPUT type =hidden name=item_array[] value=' .$list[item_id]. ''); echo ' OPTION $list[item_id] /OPTION '; } echo '/SELECT '; ? . . . /FORM SELECT works fine without the input type=hidden stuff. but when i use print('INPUT type =hidden name=item_array[] value=' .$list[item_id]. ''); statement in betn select /select tags, it doesn't print the values betn option /option tag in list box, (ie $list[item_id]) instead it prints one empty list box and $list[item_id] value beside that box. can any one suggest some other possible way to do this? thanks in advance. smita. _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] string concatenattion
hi, i have an array of strings and would like to create a single string from the array but starting somewhere in the middle of the array index and not from the start, is there any function for me to do a string concatenation. ive gone thro the manula and didnt find any, but if u have any bright ideas how this can be achieved, pls help. roslyn ?php $conn=pg_connect(host=abcd dbname=ucs user=roslyn password=roslyn); $filename=note.txt; $fp = fopen ($filename,r); $cnt=3; $buffer=file($filename); //pg_exec ($conn, insert into books(name,sequenceno,chapters,lang) values('$buffer[0]',1,$buffer[1],1)); $i=2; while($i = $cnt) { $str = buffer[$i]; $i++; } echo $str; fclose ($fp); ? this string only prints the last element in the buffer, and no concat is done. pls help - Do you Yahoo!? New DSL Internet Access from SBC Yahoo!
RE: [PHP-DB] Date Select help
Any one have any information on selecting a rake of dates from a mysql database? my current query reads. $result = mysql_query(SELECT * FROM CWC_Memory); I neeed to select where date is between todays date and todays date +10. SELECT * FROM CWC_Memory WHERE date_column BETWEEN NOW() AND NOW() + INTERVAL 10 DAY ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] sending hidden values
What are you trying to do? Don't you want the value in the option part...not in a hidden field? option value=whateverDisplay This/option Then whatever will be passed as the value of the $select box. Are you trying to do something else? If so, create your input type=hidden string instead of echoing it out within the loop. $hidden .= input type='hidden' ... Then echo out $hidden _after_ /select ---John Holmes... -Original Message- From: Smita Manohar [mailto:[EMAIL PROTECTED]] Sent: Monday, September 23, 2002 6:31 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] sending hidden values hi all, in my php script im using SELECT in FORM element. the OPTION values for SELECT tag are coming from database. and the situation in my code is that, those values i need to pass as a hidden value thru form. im doing it as, FORM method=post action=act_modify.php . . . SELECT NAME=item_v // some stuff before this to build query ? $result = mysql_query($query) or die (SELECT failed.); while ($list = mysql_fetch_array($result)) { print('INPUT type =hidden name=item_array[] value=' .$list[item_id]. ''); echo ' OPTION $list[item_id] /OPTION '; } echo '/SELECT '; ? . . . /FORM SELECT works fine without the input type=hidden stuff. but when i use print('INPUT type =hidden name=item_array[] value=' .$list[item_id]. ''); statement in betn select /select tags, it doesn't print the values betn option /option tag in list box, (ie $list[item_id]) instead it prints one empty list box and $list[item_id] value beside that box. can any one suggest some other possible way to do this? thanks in advance. smita. _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Confused
I have two MySQL tables, groups and users: groups: group_id, group_name users: user_id, user_name, group_id, etc. I would like to produce one table for each group which will list all the members for that particular group. For example: Blue (group_id 1) Tom (group_id 1) Nancy (group_id 1) Jim (group_id 1) Red (group_id 2) Bob (group_id 1) Susan (group_id 1) James (group_id 1) ... My question is, do I need to run 2 queries? The first to select all the groups and the second to select all the users in each group based on the group_id? How would I loop through to create a table for each group? Thanks inadvance for any help. Randy Rankin
Re: [PHP-DB] Confused
if i'm reading right, you could use a join to get all of that info. select users.group_id, user_id, user_name, groups.group_name from users inner join groups on (groups.group_id = users.group_id) group by users.group_id parens not needed, it just makes it more legible. that should give you an array, if used with mysql_fetch_array of: group_id - user_id - user_name - group_name - 1 1Tom Blue 1 2Nancy Blue 1 3JimBlue 2 4Bob Red etc. jd Rankin, Randy randy.rankin@inv To: [EMAIL PROTECTED] ensys.com cc: Subject: [PHP-DB] Confused 09/23/2002 07:38 AM I have two MySQL tables, groups and users: groups: group_id, group_name users: user_id, user_name, group_id, etc. I would like to produce one table for each group which will list all the members for that particular group. For example: Blue (group_id 1) Tom (group_id 1) Nancy (group_id 1) Jim (group_id 1) Red (group_id 2) Bob (group_id 1) Susan (group_id 1) James (group_id 1) ... My question is, do I need to run 2 queries? The first to select all the groups and the second to select all the users in each group based on the group_id? How would I loop through to create a table for each group? Thanks inadvance for any help. Randy Rankin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] unicode in php{PLS HELP URGENT}
hello, ive saved a text file-note.txt with unicode encoding, and would like to print the file, how could i do so?? ive written the following piece of code, pls tell me where ive gone wrong. ?php $filename=note.txt; $fp = fopen ($filename,r); $str=utf8_encode(file($filename)); echo $str[0]; ? - Do you Yahoo!? New DSL Internet Access from SBC Yahoo!
AW: [PHP-DB] string concatenattion
Hey, try $str = str.buffer[$i]; since . does the concatenation. Best regards Claudia -Ursprungliche Nachricht- Von: roslyn jose [mailto:[EMAIL PROTECTED]] Gesendet: Montag, 23. September 2002 12:39 An: [EMAIL PROTECTED] Betreff: [PHP-DB] string concatenattion hi, i have an array of strings and would like to create a single string from the array but starting somewhere in the middle of the array index and not from the start, is there any function for me to do a string concatenation. ive gone thro the manula and didnt find any, but if u have any bright ideas how this can be achieved, pls help. roslyn ?php $conn=pg_connect(host=abcd dbname=ucs user=roslyn password=roslyn); $filename=note.txt; $fp = fopen ($filename,r); $cnt=3; $buffer=file($filename); //pg_exec ($conn, insert into books(name,sequenceno,chapters,lang) values('$buffer[0]',1,$buffer[1],1)); $i=2; while($i = $cnt) { $str = buffer[$i]; $i++; } echo $str; fclose ($fp); ? this string only prints the last element in the buffer, and no concat is done. pls help - Do you Yahoo!? New DSL Internet Access from SBC Yahoo! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] string concatenattion
The line $str= buffer[$i]; Should probably read: $str .= buffer[$i]; Mark -Original Message- From: roslyn jose [mailto:[EMAIL PROTECTED]] Sent: 23 September 2002 11:39 To: [EMAIL PROTECTED] Subject: [PHP-DB] string concatenattion hi, i have an array of strings and would like to create a single string from the array but starting somewhere in the middle of the array index and not from the start, is there any function for me to do a string concatenation. ive gone thro the manula and didnt find any, but if u have any bright ideas how this can be achieved, pls help. roslyn ?php $conn=pg_connect(host=abcd dbname=ucs user=roslyn password=roslyn); $filename=note.txt; $fp = fopen ($filename,r); $cnt=3; $buffer=file($filename); //pg_exec ($conn, insert into books(name,sequenceno,chapters,lang) values('$buffer[0]',1,$buffer[1],1)); $i=2; while($i = $cnt) { $str = buffer[$i]; $i++; } echo $str; fclose ($fp); ? this string only prints the last element in the buffer, and no concat is done. pls help - Do you Yahoo!? New DSL Internet Access from SBC Yahoo! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] advise needed for 'authorized only' site
I have set up a section of my company site for use by authorized dealers only. I am currently using mysql authorization, which works for the first page, but if someone were to type in the url of an underlying page they would be able to get in without authorization. I know I could use .htaccess for handling this but with a minimum of 350 -400 users to keep track of that would be unwieldly to say the least, especially for my boss who doesn't have a clue about *nix and has never even heard of .htaccess. What other options do I have to keep the underlying pages from being accessed without the user being forced to go through the logon screen? Thanks, -- Chip Wiegand Computer Services Simrad, Inc www.simradusa.com [EMAIL PROTECTED] There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corporation, 1977 (They why do I have 9? Somebody help me!) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] advise needed for 'authorized only' site
you could make them log in once per session and just have every page check and see if they already have logged in and if they have not then trigger the login mechanism. Not sure exactly how to implement but I've read on the practice before. -Bryan - Original Message - From: [EMAIL PROTECTED] To: PHP_DB [EMAIL PROTECTED] Sent: Monday, September 23, 2002 10:14 AM Subject: [PHP-DB] advise needed for 'authorized only' site I have set up a section of my company site for use by authorized dealers only. I am currently using mysql authorization, which works for the first page, but if someone were to type in the url of an underlying page they would be able to get in without authorization. I know I could use .htaccess for handling this but with a minimum of 350 -400 users to keep track of that would be unwieldly to say the least, especially for my boss who doesn't have a clue about *nix and has never even heard of .htaccess. What other options do I have to keep the underlying pages from being accessed without the user being forced to go through the logon screen? Thanks, -- Chip Wiegand Computer Services Simrad, Inc www.simradusa.com [EMAIL PROTECTED] There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corporation, 1977 (They why do I have 9? Somebody help me!) -- 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] advise needed for 'authorized only' site
I had a similar problem, but I can't promise that my solution is the best way to go about it. After the user was validated, I set a cookie. I then had all subsequent pages start with an if statement that checked for the cookie. If there was no cookie, they were sent back to the entry point. Another option if your application is somehow linear would be to make sure that the referring page is what you wanted it to be. -Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, September 23, 2002 10:14 AM To: PHP_DB Subject: [PHP-DB] advise needed for 'authorized only' site I have set up a section of my company site for use by authorized dealers only. I am currently using mysql authorization, which works for the first page, but if someone were to type in the url of an underlying page they would be able to get in without authorization. I know I could use .htaccess for handling this but with a minimum of 350 -400 users to keep track of that would be unwieldly to say the least, especially for my boss who doesn't have a clue about *nix and has never even heard of .htaccess. What other options do I have to keep the underlying pages from being accessed without the user being forced to go through the logon screen? Thanks, -- Chip Wiegand Computer Services Simrad, Inc www.simradusa.com [EMAIL PROTECTED] There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corporation, 1977 (They why do I have 9? Somebody help me!) -- 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] incrememnting an array
try this: ?php $arr=array(0,23,2,15,1,14,43,22); $arr2[0]=$arr[0]; for ($i=1;$icount($arr);$i++){ $ip=$i+1; $il=$i-1; $arr2[$i]=$arr[$i]+$arr2[$il]; $arr3[$il]=$arr2[$i]; } for ($i=0;$icount($arr2);$i++){ $ip=$i*2; $il=($i*2)+1; if ($arr2[$i]==) { $arr4[$ip]=0; } else { $arr4[$ip]=$arr2[$i]; } if ($arr3[$i]==) { $arr4[$il]=0; } else { $arr4[$il]=$arr3[$i]; } } echo pre\n; print_r($arr4); echo /pre\n; ? John Coder [EMAIL PROTECTED] escribió en el mensaje 1032554996.1899.9.camel@linux">news:1032554996.1899.9.camel@linux... On Fri, 2002-09-20 at 05:41, Martin Adler wrote: I hope the little script bellow helps you greet Martin ? $arr = array('a','b','c','d','e','f','g','h'); $arr2[] = $x = array_shift($arr); $arr2[] = $y = array_shift($arr); $arr2[] = $y; while($arr) { $arr2[] = $x.$y .= array_shift($arr); $arr2[] = $x.$y; } echo implode(',',$arr2); echo 'pre'; print_r($arr2); echo '/pre'; ? Unfortunately this concatates the numbers instead of summing them I need it to sum them.even if I type cast it to int it still concatates them. what I need is from the array: array(0,23,2,15,1,14,1,43,22) a new array having: array(0,23,23,25,25,40,40,41,41,55,55,98,98,120) think of angle and ) being the beginning 23 being the end then 23 being the begging of an angle haveing 2 degress so I need it to go to 25 and so forth. hope this explains it better. - Original Message - From: John Coder [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, September 20, 2002 8:19 AM Subject: [PHP-DB] incrememnting an array hi all this is what I would like to do. I have a dynamically generated array from a database and I wnat to do a piechart from it . for example the array would hold (a,b,c,d,e,f,g,h) sometimes more sometimes less . I need to get the values of a,b,b,a+b,a+b,a+b+c,a+b+c,a+b+c+d, and son on these are for the values of the angles for the pie chart on imagefilledarc(). And for the life of me I can't figure out how to do it. any help would be greatly appreciated John Coder -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] advise needed for 'authorized only' site
I have set up a section of my company site for use by authorized dealers only. I am currently using mysql authorization, which works for the first page, but if someone were to type in the url of an underlying page they would be able to get in without authorization. I know I could use .htaccess for handling this but with a minimum of 350 -400 users to keep track of that would be unwieldly to say the least, especially for my boss who doesn't have a clue about *nix and has never even heard of .htaccess. What other options do I have to keep the underlying pages from being accessed without the user being forced to go through the logon screen? You have to make a check on every page that the user is valid. Start a session on the first page, after they log in, and then check for a variable in this session on each subsequent page. If it's there, then they are good. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] advise needed for 'authorized only' site
I do pretty much the same thing but with seesion vars, I just check that the user and level session vars are the appropriate values before I display confidential material. -Steve. -Original Message- From: Rob Day [mailto:[EMAIL PROTECTED]] Sent: Monday, September 23, 2002 11:22 AM To: 'PHP DB' Subject: RE: [PHP-DB] advise needed for 'authorized only' site I had a similar problem, but I can't promise that my solution is the best way to go about it. After the user was validated, I set a cookie. I then had all subsequent pages start with an if statement that checked for the cookie. If there was no cookie, they were sent back to the entry point. Another option if your application is somehow linear would be to make sure that the referring page is what you wanted it to be. -Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, September 23, 2002 10:14 AM To: PHP_DB Subject: [PHP-DB] advise needed for 'authorized only' site I have set up a section of my company site for use by authorized dealers only. I am currently using mysql authorization, which works for the first page, but if someone were to type in the url of an underlying page they would be able to get in without authorization. I know I could use .htaccess for handling this but with a minimum of 350 -400 users to keep track of that would be unwieldly to say the least, especially for my boss who doesn't have a clue about *nix and has never even heard of .htaccess. What other options do I have to keep the underlying pages from being accessed without the user being forced to go through the logon screen? Thanks, -- Chip Wiegand Computer Services Simrad, Inc www.simradusa.com [EMAIL PROTECTED] There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corporation, 1977 (They why do I have 9? Somebody help me!) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] advise needed for 'authorized only' site
At the top of every page ... ? session_start();session_register( origin );$origin=$PHP_SELF; if( $HTTP_SERVER_VARS[ PHP_AUTH_USER ] !=lancelot $HTTP_SERVER_VARS[ PHP_AUTH_PW ] !=grail ) { if( !session_is_registered( member_id ) ) { header(Location: user_logon2.php\n); } }? The lancelot and grail were used only so that ht:dig could index the site, so they can be chopped out. The member_id flag was set in user_logon2.php. User_logon2.php was a little more complex. The goal was to allow only one user in from one browser on one machine, thus a series of checks was followed ... 1. If there was no cookie, then a regular login was displayed 2. If there was a cookie, its value was checked against the database, and if everything was OK (user wasn't blocked, etc.) then member_id was set. Member_id was only a semaphore and contained no value. 3. If there was a cookie, but it didn't validate correctly, access was denied and the user was asked to contact the office. 4. If there was no cookie, but the login values (user/pass) showed that one had been set from another machine or browser, access was denied and a message displayed to that effect, again with an invitation to contact the office. If I remember correctly, the origin var was set so that after the login check a valid user was returned to that page. All this complexity was an attempt to solve a bad pass-around problem for a daily business newsletter. Yes it was very restrictive, but that one line, at the top, protected every page so no one could blast in from Google, etc. In the same way, it let the owners of the site do their editing in Front Page, and everything was OK, so long as they didn't touch it. How did we use it? An email was sent each day to subscribers with an embedded link to the current day's news page. If the above check passed, then the newsletter, a PDF file, began downloading to their browser. Yes, IE 5.5 gave us a BUNCH of trouble, but that's another issue. When it worked, it was seamless - all the subscriber got was the news, which if they then wanted to pass around they had to save, write up an email and attach the pdf. A little more bother than simply forwarding a pdf sent to them directly. Regards - Miles Thompson At 10:22 AM 9/23/2002 -0500, Bryan McLemore wrote: you could make them log in once per session and just have every page check and see if they already have logged in and if they have not then trigger the login mechanism. Not sure exactly how to implement but I've read on the practice before. -Bryan - Original Message - From: [EMAIL PROTECTED] To: PHP_DB [EMAIL PROTECTED] Sent: Monday, September 23, 2002 10:14 AM Subject: [PHP-DB] advise needed for 'authorized only' site I have set up a section of my company site for use by authorized dealers only. I am currently using mysql authorization, which works for the first page, but if someone were to type in the url of an underlying page they would be able to get in without authorization. I know I could use .htaccess for handling this but with a minimum of 350 -400 users to keep track of that would be unwieldly to say the least, especially for my boss who doesn't have a clue about *nix and has never even heard of .htaccess. What other options do I have to keep the underlying pages from being accessed without the user being forced to go through the logon screen? Thanks, -- Chip Wiegand Computer Services Simrad, Inc www.simradusa.com [EMAIL PROTECTED] There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corporation, 1977 (They why do I have 9? Somebody help me!) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL/PHP dropping characters
Hi, I've been running into a strange problem on my server with scripts that take form input and reformat it into SQL. It only happens with statements that insert or update data, the first four characters of the POST variables starting at the fourth variable passed are dropped. So lately if I try and insert data into a table using a form: Form1 holds data: 'onevalue', 'twovalue', 'threevalue', 'fourvalue', 'fivevalue' and posts to a php script that makes an insert statement out of the data, the insert statement will read: insert into tbl_foo values ('onevalue, 'twovalue', 'threevalue', 'value', 'value'); See what I'm saying? It's always four characters and it doesn't seem to matter what the data is. Normally I would assume it's my faulty programming, but it's also happening with scripts like PHPMyAdmin, and OSCommerce. So I'm thinking it's a problem with the server configuration. It started soon after I upgraded to PHP 4.2.3 I'm running PHP as a module under Apache on a Redhat 7.2 system. Does anyone have any ideas? I'd sure appreciate it, I've been playing with php.ini for two days now, and that doesn't seem to have any effect. Thank you, -Micah Stevens Raincross Technologies Maintenance, Development and Consulting Services www.raincross-tech.com
[PHP-DB] getting mysql_fetch_row into array
Going through brain-lock here. From this query Select count(deptid) from maintenance group by deptid ,I get 11 rows. What I need to do is get an array like $a=array(315,11,43,67,415,32,25,63,93,46,76) from this query, so that $a[0]=315 $a[1]=11 $a[2]=43 and so on. The best I can get is ; $a[0][0]=315 $a[0][1]=11 $a[0][2]=43 and so on. Does anyone have any ideas??? John Coder -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
AW: [PHP-DB] getting mysql_fetch_row into array
Hi, it would have been easier to help you if you included some code snippet... Use something like this: $res = mysql_query (SELECT COUNT(deptid) FROM maintenance GROUP BY deptid); $deptcount = array(); // reset the array while ($row = mysql_fetch_row ($res)) { $deptcount[] = $row[0]; } Thomas -Ursprüngliche Nachricht- Von: LSC Exhibits Department [mailto:[EMAIL PROTECTED]] Gesendet: Montag, 23. September 2002 19:17 An: '[EMAIL PROTECTED]' Betreff: [PHP-DB] getting mysql_fetch_row into array Going through brain-lock here. From this query Select count(deptid) from maintenance group by deptid ,I get 11 rows. What I need to do is get an array like $a=array(315,11,43,67,415,32,25,63,93,46,76) from this query, so that $a[0]=315 $a[1]=11 $a[2]=43 and so on. The best I can get is ; $a[0][0]=315 $a[0][1]=11 $a[0][2]=43 and so on. Does anyone have any ideas??? John Coder -- 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: AW: [PHP-DB] getting mysql_fetch_row into array
Hi, $res = mysql_query (SELECT COUNT(deptid) FROM maintenance GROUP BY deptid); $deptcount = array(); // reset the array while ($row = mysql_fetch_row ($res)) { $deptcount[] = $row[0]; this should be $deptcount[] .= $row[0]; shouldn't it? } cheers J -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] advise needed for 'authorized only' site
you could make them log in once per session and just have every page check and see if they already have logged in and if they have not then trigger the login mechanism. This is what I do. I have a file/function called verify that I call at the top of every page that I want secure (and any page that might just perform an action and then redirect to a page that displays content). Here is how my authentication system works: 1) On any page a session is started if one doesn't already exist. 2) When they submit they submit login information it is checked against the database. 3) If the login is approved, I session_register() the user_id field, the user_level (if applicable), and a variable called valid. 4) I set valid = to the md5 hash of user_id.user_level.secret_variable (secret variable is a variable set in the code so only the server knows it. 5) on every page the verify function checks to make sure that the variable $valid is equal to the md5 of user_id.user_level.secret_variable (This works because the session knows the user_id, and user_level, and the server knows the secret variable). Hope this helps. -Jackson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: AW: [PHP-DB] getting mysql_fetch_row into array
$res = mysql_query (SELECT COUNT(deptid) FROM maintenance GROUP BY deptid); $deptcount = array(); // reset the array while ($row = mysql_fetch_row ($res)) { $deptcount[] = $row[0]; this should be $deptcount[] .= $row[0]; shouldn't it? No. The way it's written is it's adding an element onto the array with each loop. It's basically the same as doing array_push($deptcount,$row[0]); ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: AW: [PHP-DB] getting mysql_fetch_row into array
Nope. Anytime you set an array with no index equal to something, (i.e. $deptcount[]) it will add another element to the end of the array. If you use .=, that means append the data, but since you're not specifying an element, I'm not sure what it would do. Perhaps PHP is smart enough to just add another element anyway. Have you tried this? -Micah At 10:01 PM 9/23/2002 +0200, Johannes Janson wrote: Hi, $res = mysql_query (SELECT COUNT(deptid) FROM maintenance GROUP BY deptid); $deptcount = array(); // reset the array while ($row = mysql_fetch_row ($res)) { $deptcount[] = $row[0]; this should be $deptcount[] .= $row[0]; shouldn't it? } cheers J -- 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] advise needed for 'authorized only' site
Why do you need the secret variable? If your server is set up correctly, the user can't create any session variables, all they can do is create a session ID. So you could just check for a user-id and you'd be good. ---John Holmes... - Original Message - From: Jackson Miller [EMAIL PROTECTED] To: 'Bryan McLemore' [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, September 23, 2002 4:06 PM Subject: RE: [PHP-DB] advise needed for 'authorized only' site you could make them log in once per session and just have every page check and see if they already have logged in and if they have not then trigger the login mechanism. This is what I do. I have a file/function called verify that I call at the top of every page that I want secure (and any page that might just perform an action and then redirect to a page that displays content). Here is how my authentication system works: 1) On any page a session is started if one doesn't already exist. 2) When they submit they submit login information it is checked against the database. 3) If the login is approved, I session_register() the user_id field, the user_level (if applicable), and a variable called valid. 4) I set valid = to the md5 hash of user_id.user_level.secret_variable (secret variable is a variable set in the code so only the server knows it. 5) on every page the verify function checks to make sure that the variable $valid is equal to the md5 of user_id.user_level.secret_variable (This works because the session knows the user_id, and user_level, and the server knows the secret variable). Hope this helps. -Jackson -- 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: AW: [PHP-DB] getting mysql_fetch_row into array
Hi, Micah Stevens wrote: Nope. Anytime you set an array with no index equal to something, (i.e. $deptcount[]) it will add another element to the end of the array. If you use .=, that means append the data, but since you're not specifying an element, I'm not sure what it would do. Perhaps PHP is smart enough to just add another element anyway. Have you tried this? Well it's been some time since I dealt with PHP but as far as I remember I did it like that and it worked. Well, sorry for the misinformation. cheers J -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MSSQL error
I am getting problems with MSSql when using DB.php, I have an intermitant fualt where php keeps gives me a CGI The specified CGI application misbehaved by not returning a complete set of HTTP headers (you know the one), but when the page is refreshed it all works fine. I have a felling that it my be something to do with caching but don't know where to look, this same program works fine with mysql, but keeps on getting this error in MSSql. if anyone has had this problem before, or has any ideas please let me know. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: password function
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... hi, i want to encode a string that users enter with mysql password function. but sometimes this code works sometimes don't. mysql warns me: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in the code is: $result=mysql_query(select password(.$_POST['password'].)); while ($p = mysql_fetch_array($result, MYSQL_ASSOC)): $pswrd=$p['password('.$_POST['password'].')']; endwhile; thanks... Normally that error indicates a problem with the syntax of your sql query. If you add the line echo mysql_error(); after your mysql_query line you'll get a useful error message from mysql, which should indicate more precisely where your problem lies. -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] unicode in php
hi, thanks for the code, but i had tried it but got a fatal error: call to undefined function utf8_encode(). i saved my text file as unicode encoding..going thro the php.net site though...pls help if any ideas. thanks alot for the help. also am i sposed to encode or decode, as the text file is alreday saved as unicode encoding in notepadi was pondering over hat for a while. pls help. roslyn - Do you Yahoo!? New DSL Internet Access from SBC Yahoo!
Re: [PHP-DB] unicode in php{PLS HELP URGENT}
hi, ive been going thro the site aand also tried out the code, but im getting fatal error: call to undefined function utf8_encode(). pls help roslyn Dave Smith wrote:$filename=note.txt; //$fp = fopen ($filename,r); $str=utf8_encode(file($filename)); foreach( $str as $line ) echo $line; ? I got all of this code right from www.php.net. You should spend some time there. It is the best doc site I've ever seen for any programming language. --Dave roslyn jose wrote: hello, ive saved a text file-note.txt with unicode encoding, and would like to print the file, how could i do so?? ive written the following piece of code, pls tell me where ive gone wrong. $filename=note.txt; $fp = fopen ($filename,r); $str=utf8_encode(file($filename)); echo $str[0]; ? - Do you Yahoo!? New DSL Internet Access from SBC Yahoo! - Do you Yahoo!? New DSL Internet Access from SBC Yahoo!
[PHP-DB] BLOB retrieval
Hi everyone, I am new to php. I have searched the net trying to find a basic code snippet that will demonstrate how to download BLOB's from a database. I am not looking for a solution exactly, but rather a good starting point. I want to learn this on my own. Maybe with a little help. :) Is there a resource you could point me to? Or could someone post a small sample of code that will get me started? Thanks in advance, Tim Eberly -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php