[PHP-DB] RE Viewing Session Varibles
Seems to me that the problem might be in the logic (correct me if I'm wrong - likely - but...) In these lines : foreach ($cart as $id = $qty) { if ($$id == 0) { unset ($cart[$id]); . [snip] You unset $cart[$id] if $$id==0. Now, if you are using numeric array indexes, then for example $id might be '12' (number or string, it don't matter). So what you're asking of php is to get $$id, that works out as $12 , which I guess is not a variable name. Not being a variable it will return false (or zero) and so $$id==0 will be true, your if statement executes and unsets the value for $cart[$id], which *is* a valid variable name. Could you replace $$id==0 with isset($$id) and see if you get the same results? Cheers, Neil Smith. At 20:57 07/02/2002 +, you wrote: From: Robert Weeks [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 07, 2002 10:41 AM To: php Subject: Re: [PHP-DB] Viewing Session Varibles Ok, This is driving me nuts. I'm sure its something simple but I can't seem to find the glitch. I'm trying to make a simple shopping cart using Session varibles to store the item = quantity pairs, then I loop thru the cart and query the db to get the item details, etc.. Most of it works fine but whenever I add a new item to the cart I lose the $qty value for the other items. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ODBC_EXECUTE has a DANGEROUS 'feature'!!!
Hi folks, I don't know if everyone ever knew this, but I haven't been able to find anything about this, anywhere... odbc_execute has a very dangerous 'feature'. I would like to call it a bug, because someone has implemented it on purpose I should call it a feature... odbc_execute takes two arguments; the statement to be executed, and an array containing the parameters for this statement. So far so good. Works perfectly. In the parameters you can put any data. Any data! So you can enter characters like eg. , *, %... you name it. You can also enter single quotes ('). Nice. Noop... not nice. If you put a single quote at the start of the parameter and at the end PHP does something very scary... it reads the _file_(!) and stores it in the database. So if you would have a parameter: 'myname' you would get an error telling you that the file myname couldn't be opened. But... if you use this parameter: '/etc/passwd' No problem! The contents of your password file is stored in the database. Any file readable for your webserver can be 'used' this way. Any file! So, imagine you have some site containing a textarea input in the form, some user can easily type: '/etc/passwd' and then submit the form. When you also have the possibility on this site for the user to take a look at the data he entered (and this is a very common feature), he gets to see the contents of your password file. And he can do this with any file(). As long as it's readable for the webserver, users can very easily get the contents of the file! And... is it documented? NO Nowhere. Not the mailinglists, not the documentation, not the bugreport, not even in the sources itself. It's just there! Some security huh?! -- * RzE: -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ODBC_EXECUTE has a DANGEROUS 'feature'!!!
Oops... sorry... I little mistake. odbc_execute ofcourse doesn't take the statement to be executed as a parameter, but the odbc result-id... -- * RzE: -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Simple Question, hopefully simple answer
In one of my mySql tables I have a colum that contains many fields of numbers. for example | id | Name | Age | Sex | |1 | Jim | 17 | m| |2 | Dave | 31 | f | |3 | Fred | 25 | m| Ok and I want to get the total value of all the ages out of the table. how can I get this? Hope someone can help. Luke -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Deleting characters from a string...
Hi, I have a string that says width=123 Height =456 and I need to for mat the output as 123 x 456 is there a way to do this? Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Simple Question, hopefully simple answer
- Original Message - From: Luke [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, October 08, 2001 10:52 AM Subject: [PHP-DB] Simple Question, hopefully simple answer In one of my mySql tables I have a colum that contains many fields of numbers. for example | id | Name | Age | Sex | |1 | Jim | 17 | m| |2 | Dave | 31 | f | |3 | Fred | 25 | m| Ok and I want to get the total value of all the ages out of the table. how can I get this? mysql_query(select sum(age) as total from table); maybey you need after the from table the follow rule: distinc by id. it is not tested. success Jeroen Hope someone can help. Luke -- 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] Deleting characters from a string...
use substr http://www.php.net/manual/en/function.substr.php good luck Jeroen - Original Message - From: Luke [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, October 08, 2001 11:09 AM Subject: [PHP-DB] Deleting characters from a string... Hi, I have a string that says width=123 Height =456 and I need to for mat the output as 123 x 456 is there a way to do this? Thanks -- 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] Simple Question, hopefully simple answer
Luke, In one of my mySql tables I have a colum that contains many fields of numbers. for example | id | Name | Age | Sex | |1 | Jim | 17 | m| |2 | Dave | 31 | f | |3 | Fred | 25 | m| Ok and I want to get the total value of all the ages out of the table. how can I get this? RTFM (MySQL) for COUNT() and SUM() (and many other useful functions). Regards, =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP-DB] Simple Question, hopefully simple answer
- Original Message - From: Jeroen Timmers [EMAIL PROTECTED] To: Kunden Admin [EMAIL PROTECTED] Sent: Friday, February 08, 2002 1:04 PM Subject: Re: [PHP-DB] Simple Question, hopefully simple answer - Original Message - From: Kunden Admin [EMAIL PROTECTED] To: Jeroen Timmers [EMAIL PROTECTED] Sent: Monday, October 08, 2001 11:49 AM Subject: Re: [PHP-DB] Simple Question, hopefully simple answer I always seem to get the value Resource id#2 as output when I use the following code... { $result = mysql_query(SELECT SUM(ACCTSESSIONTIME) AS TOTAL FROM ACCOUNTING where FROM_UNIXTIME(TIME_STAMP,'%d.%m.%Y')='$filter'); } echo $result; you must fetch the result while($row = mysql_fetch_array($result)) echo $row[0]; /*or echo $row[total];*/ Jeroen any help is much apreciated! Luke - Original Message - From: Jeroen Timmers [EMAIL PROTECTED] Newsgroups: php.db To: Luke [EMAIL PROTECTED] Cc: [PHP-DB] [EMAIL PROTECTED] Sent: Friday, February 08, 2002 1:36 PM Subject: Re: [PHP-DB] Simple Question, hopefully simple answer - Original Message - From: Luke [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, October 08, 2001 10:52 AM Subject: [PHP-DB] Simple Question, hopefully simple answer In one of my mySql tables I have a colum that contains many fields of numbers. for example | id | Name | Age | Sex | |1 | Jim | 17 | m| |2 | Dave | 31 | f | |3 | Fred | 25 | m| Ok and I want to get the total value of all the ages out of the table. how can I get this? mysql_query(select sum(age) as total from table); maybey you need after the from table the follow rule: distinc by id. it is not tested. success Jeroen Hope someone can help. Luke -- 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] Need to delete charcters from a string
This dosen't quite do what i need, this atually just displays the last 3 characters of the string removing everything else, I wanted to do the opposite, but thanks anyways. Joe Van Meer wrote: Why couldn't you use something like this: $mystr = substr($mystr, -3); Joe Jeroen Timmers [EMAIL PROTECTED] wrote in message 003001c1b026$97373cb0$7f6440d4@jeroen">news:003001c1b026$97373cb0$7f6440d4@jeroen... you can take the function substr from php in combination with strlen (lenght of a string) example $string = 1234567890; $rest = substr($string, 0, strlen($string)-3); // returns 1234567 Success Jeroen Timmers - Original Message - From: Renaldo De Silva [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, February 07, 2002 8:56 PM Subject: [PHP-DB] Need to delete charcters from a string I need to delete the last 3 character of a string, what command can i use o do this. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: [PHP-WIN] why doesnt this work?
I forgot somthing ? if (isset($submit) ) // this ) { IF ($submit) // this is line 8 { . } } ? - Original Message - From: George Lioumis [EMAIL PROTECTED] To: chris [EMAIL PROTECTED]; PHP Mailing List [EMAIL PROTECTED] Sent: Friday, February 08, 2002 3:37 PM Subject: [PHP-DB] Re: [PHP-WIN] why doesnt this work? The first time you enter the page submit button is not pressed. That's why it gives you this error. Try the following: ? if (isset($submit) { IF ($submit) // this is line 8 { . } } ? - Original Message - From: chris [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 08, 2002 3:38 PM Subject: [PHP-WIN] why doesnt this work? i get this message when i try to open this page : PHP Warning: Undefined variable: submit in c:\inetpub\wwwroot\testsite\registrer.php on line 8 form method=post action=registRer.php Fornavn: input type=text name=fornavnbr Etternavn: input type=text name=etternavnbr input type=Submit name=submit value=Registrerbr /form ? IF ($submit) // this is line 8 { } ? If you know why it doesnt work please help. -- PHP Windows 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] MySQL / PHP Database Help
Hello, something that you can help is the follow try var_dump($newquery); then you see the complete query and run it in phpmyadmin. Jeroen - Original Message - From: Jonathan Underfoot [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 08, 2002 2:43 PM Subject: [PHP-DB] MySQL / PHP Database Help I'm trying to write a script that checks for multiple entries on a table in a database. So far I've been plagued by MySQL errors. I'm fairly confident my scripting is ok (Then again, I've been wrong before.) I think moreover there might be some difficulty with my theory. Then again, I could try and do this with MySQL join statements. Any feedback would be appreciated. $sqlquery = mysql_query(SELECT * FROM local_shows); while ($row = mysql_fetch_array($sqlquery)) { $newquery = mysql_query(SELECT * FROM local_shows WHERE show_date='$row[show_date]' AND venue='$row[venue]'); var_dump($newquery); /* for example to see the query */ while ($row2 = mysql_fetch_array($newquery)) { $num_rows = mysql_num_rows($row2); if ($num_rows1) { print etc etc (Do things with my $row2 data) I get loads of: Warning: Supplied argument is not a valid MySQL result resource in /home/ufr2/underfoot-www/admin/dupeshows.html on line 51 Can you not reselect in another while while selecting? Does that make any sense to anyone but me? I shouldent have to open another DB connection? Anyhow... your I would appreciate any help. -Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL / PHP Database Help
Yes, you can re-select from the same database without opeing a new connection. I recommend that you print the contents od $newquery to verify it contains the string you think it should. Perhaps the apostrophes you've enclosed the $row[] variable are not expanding. -Original Message- From: Jonathan Underfoot [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 7:43 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL / PHP Database Help I'm trying to write a script that checks for multiple entries on a table in a database. So far I've been plagued by MySQL errors. I'm fairly confident my scripting is ok (Then again, I've been wrong before.) I think moreover there might be some difficulty with my theory. Then again, I could try and do this with MySQL join statements. Any feedback would be appreciated. $sqlquery = mysql_query(SELECT * FROM local_shows); while ($row = mysql_fetch_array($sqlquery)) { $newquery = mysql_query(SELECT * FROM local_shows WHERE show_date='$row[show_date]' AND venue='$row[venue]'); while ($row2 = mysql_fetch_array($newquery)) { $num_rows = mysql_num_rows($row2); if ($num_rows1) { print etc etc (Do things with my $row2 data) I get loads of: Warning: Supplied argument is not a valid MySQL result resource in /home/ufr2/underfoot-www/admin/dupeshows.html on line 51 Can you not reselect in another while while selecting? Does that make any sense to anyone but me? I shouldent have to open another DB connection? Anyhow... your I would appreciate any help. -Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Can't get left join to work
Actually, the is the same as and. So it could be written as: mysql select e.id,fname,sum(m.miles) from employees e - left join mileage m on m.id=e.id and month(trip_date)=3 - and substring(year(m.trip_date),3,2) = '02' - group by e.id; I'm just lazy...easier to hit twice than type out and. You were on the right path. You simply needed to move the conditional statements from the WHERE to the JOIN clause. I learned that stuff from reading the comments/answers on the list from DuBoise, Zawodny, and others. -Original Message- From: paul wilczynski [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 5:42 AM To: Rick Emery Subject: Re: [PHP-DB] Can't get left join to work Thank you! I'm obviously going to have to read up on that 'on ... ' syntax - it's not something I'm familiar with. Paul Rick Emery wrote: And the answer is: mysql select e.id,fname,sum(m.miles) from employees e - left join mileage m on m.id=e.id month(trip_date)=3 - substring(year(m.trip_date),3,2) = '02' - group by e.id; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Need to delete charcters from a string (Works)
$mystring = substr($mystring,0,-3); - Original Message - From: Renaldo De Silva [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, February 07, 2002 8:56 PM Subject: [PHP-DB] Need to delete charcters from a string I need to delete the last 3 character of a string, what command can i use o do this. -- 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] Need to delete charcters from a string
You were close: $mystr = substr($mystr, 0, -3); -Original Message- From: Renaldo De Silva [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 7:36 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Need to delete charcters from a string This dosen't quite do what i need, this atually just displays the last 3 characters of the string removing everything else, I wanted to do the opposite, but thanks anyways. Joe Van Meer wrote: Why couldn't you use something like this: $mystr = substr($mystr, -3); Joe Jeroen Timmers [EMAIL PROTECTED] wrote in message 003001c1b026$97373cb0$7f6440d4@jeroen">news:003001c1b026$97373cb0$7f6440d4@jeroen... you can take the function substr from php in combination with strlen (lenght of a string) example $string = 1234567890; $rest = substr($string, 0, strlen($string)-3); // returns 1234567 Success Jeroen Timmers - Original Message - From: Renaldo De Silva [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, February 07, 2002 8:56 PM Subject: [PHP-DB] Need to delete charcters from a string I need to delete the last 3 character of a string, what command can i use o do this. -- 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] MySQL / PHP Database Help
Jonathan, I'm trying to write a script that checks for multiple entries on a table in a database. So far I've been plagued by MySQL errors. I'm fairly confident my scripting is ok (Then again, I've been wrong before.) I think moreover there might be some difficulty with my theory. Then again, I could try and do this with MySQL join statements. Any feedback would be appreciated. ... Warning: Supplied argument is not a valid MySQL result resource in /home/ufr2/underfoot-www/admin/dupeshows.html on line 51 I notice that others have addressed your PHP/interfacing issues... You asked about theory. The current solution will require n+1 calls to the database (where there are n-rows in the local_shows table). That's quite 'expensive'. Which is likely to be the 'best tool for the job' - an external scripting language (PHP) or the RDBMS itself (MySQL)? Consider a 'MySQL-oriented' solution:- 1 if the two fields (show_date and venue) were made into a UNIQUE index, then the check would become superfluous because MySQL would ensure the situation never arose - at the cost of the time to perform the check/index insertion at every row INSERT or UPDATE (although you may gain a speed increase for certain SELECTS) 2 performing the existing PHP routine using SQL - you show only a list of 'duplicates' (and no DELETE), so: select show_date, venue, count(*) as freq from local_shows group by show_date, venue having freq1 will give you what you have attempted to code thus far. (you may wish/need to juggle the sequence of show_date and venue to suit) Regards, =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Deleting characters from a string...
If you are certain the format will ALWAYS be as you indicate, then try: eregi(width=([0-9]*) height=([0-9]*), $mystring, $reg); $newstring = $reg[1], x .$reg[2]; NOTE: I don't have PHP here at work (I've got it at home). So you may have to tweak this. -Original Message- From: Luke [mailto:[EMAIL PROTECTED]] Sent: Monday, October 08, 2001 5:09 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Deleting characters from a string... Hi, I have a string that says width=123 Height =456 and I need to for mat the output as 123 x 456 is there a way to do this? Thanks -- 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] Exact String replace with eregi_replace()
First, the example you give will replace is with , if is is the ONLY work in the line. You indicate this with the ^$ construct. Are you trying to replace only the first occurrence if is? -Original Message- From: Desikan [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 6:42 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Exact String replace with eregi_replace() hi I'm trying to replace the exact match of 'is' with ','.. But all the matches of 'is' in the string gets replaced how can i avoid this??? ?php echo ereg_replace (^is$, ,, This is a dismissal of windows based technology); ? rgds, Desikan -- Desikan [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
Re: [PHP-DB] MySQL / PHP Database Help
What does bool(false) mean? Thats off the vardump -J - Original Message - From: Jeroen Timmers [EMAIL PROTECTED] To: Jonathan Underfoot [EMAIL PROTECTED] Cc: [PHP-DB] [EMAIL PROTECTED] Sent: Friday, February 08, 2002 8:58 AM Subject: Re: [PHP-DB] MySQL / PHP Database Help Hello, something that you can help is the follow try var_dump($newquery); then you see the complete query and run it in phpmyadmin. Jeroen - Original Message - From: Jonathan Underfoot [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 08, 2002 2:43 PM Subject: [PHP-DB] MySQL / PHP Database Help I'm trying to write a script that checks for multiple entries on a table in a database. So far I've been plagued by MySQL errors. I'm fairly confident my scripting is ok (Then again, I've been wrong before.) I think moreover there might be some difficulty with my theory. Then again, I could try and do this with MySQL join statements. Any feedback would be appreciated. $sqlquery = mysql_query(SELECT * FROM local_shows); while ($row = mysql_fetch_array($sqlquery)) { $newquery = mysql_query(SELECT * FROM local_shows WHERE show_date='$row[show_date]' AND venue='$row[venue]'); var_dump($newquery); /* for example to see the query */ while ($row2 = mysql_fetch_array($newquery)) { $num_rows = mysql_num_rows($row2); if ($num_rows1) { print etc etc (Do things with my $row2 data) I get loads of: Warning: Supplied argument is not a valid MySQL result resource in /home/ufr2/underfoot-www/admin/dupeshows.html on line 51 Can you not reselect in another while while selecting? Does that make any sense to anyone but me? I shouldent have to open another DB connection? Anyhow... your I would appreciate any help. -Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL / PHP Database Help
You don't need to use var_dump. Just use the following statements: $newquery = mysql_query(SELECT * FROM local_shows WHERE show_date='$row[show_date]' AND venue='$row[venue]'); print $newquery; -Original Message- From: Jonathan Underfoot [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 8:48 AM To: Jeroen Timmers Cc: [PHP-DB] Subject: Re: [PHP-DB] MySQL / PHP Database Help What does bool(false) mean? Thats off the vardump -J - Original Message - From: Jeroen Timmers [EMAIL PROTECTED] To: Jonathan Underfoot [EMAIL PROTECTED] Cc: [PHP-DB] [EMAIL PROTECTED] Sent: Friday, February 08, 2002 8:58 AM Subject: Re: [PHP-DB] MySQL / PHP Database Help Hello, something that you can help is the follow try var_dump($newquery); then you see the complete query and run it in phpmyadmin. Jeroen - Original Message - From: Jonathan Underfoot [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 08, 2002 2:43 PM Subject: [PHP-DB] MySQL / PHP Database Help I'm trying to write a script that checks for multiple entries on a table in a database. So far I've been plagued by MySQL errors. I'm fairly confident my scripting is ok (Then again, I've been wrong before.) I think moreover there might be some difficulty with my theory. Then again, I could try and do this with MySQL join statements. Any feedback would be appreciated. $sqlquery = mysql_query(SELECT * FROM local_shows); while ($row = mysql_fetch_array($sqlquery)) { $newquery = mysql_query(SELECT * FROM local_shows WHERE show_date='$row[show_date]' AND venue='$row[venue]'); var_dump($newquery); /* for example to see the query */ while ($row2 = mysql_fetch_array($newquery)) { $num_rows = mysql_num_rows($row2); if ($num_rows1) { print etc etc (Do things with my $row2 data) I get loads of: Warning: Supplied argument is not a valid MySQL result resource in /home/ufr2/underfoot-www/admin/dupeshows.html on line 51 Can you not reselect in another while while selecting? Does that make any sense to anyone but me? I shouldent have to open another DB connection? Anyhow... your I would appreciate any help. -Jonathan -- 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] MySQL / PHP Database Help
you need to print the qeury and i guess you print the result in the var_dump i use always var_dump instead a print because the var_dump have more info. jeroen - Original Message - From: Jonathan Underfoot [EMAIL PROTECTED] To: Jeroen Timmers [EMAIL PROTECTED] Cc: [PHP-DB] [EMAIL PROTECTED] Sent: Friday, February 08, 2002 3:47 PM Subject: Re: [PHP-DB] MySQL / PHP Database Help What does bool(false) mean? Thats off the vardump -J - Original Message - From: Jeroen Timmers [EMAIL PROTECTED] To: Jonathan Underfoot [EMAIL PROTECTED] Cc: [PHP-DB] [EMAIL PROTECTED] Sent: Friday, February 08, 2002 8:58 AM Subject: Re: [PHP-DB] MySQL / PHP Database Help Hello, something that you can help is the follow try var_dump($newquery); then you see the complete query and run it in phpmyadmin. Jeroen - Original Message - From: Jonathan Underfoot [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 08, 2002 2:43 PM Subject: [PHP-DB] MySQL / PHP Database Help I'm trying to write a script that checks for multiple entries on a table in a database. So far I've been plagued by MySQL errors. I'm fairly confident my scripting is ok (Then again, I've been wrong before.) I think moreover there might be some difficulty with my theory. Then again, I could try and do this with MySQL join statements. Any feedback would be appreciated. $sqlquery = mysql_query(SELECT * FROM local_shows); while ($row = mysql_fetch_array($sqlquery)) { $newquery = mysql_query(SELECT * FROM local_shows WHERE show_date='$row[show_date]' AND venue='$row[venue]'); var_dump($newquery); /* for example to see the query */ while ($row2 = mysql_fetch_array($newquery)) { $num_rows = mysql_num_rows($row2); if ($num_rows1) { print etc etc (Do things with my $row2 data) I get loads of: Warning: Supplied argument is not a valid MySQL result resource in /home/ufr2/underfoot-www/admin/dupeshows.html on line 51 Can you not reselect in another while while selecting? Does that make any sense to anyone but me? I shouldent have to open another DB connection? Anyhow... your I would appreciate any help. -Jonathan -- 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] Searching Documents
I was wondering if there is a way to search documents. Scenario: I have a application where it uploads MS Word documents to a server and holds the documents location in the database. What I want is to be able to search those Word documents via keywords. Is this possible with PHP? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] addslashes()
So if I: Going in $Notes = addslashes($Notes); Going Out: $Notes = stripslashes($Notes); wouldn't that kill the html? or no? Joe Van Meer [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi. addslashes() going in to db, stripslashes() coming out :) HTH Joe :) Todd Williamsen [EMAIL PROTECTED] wrote in message 002601c1b033$382a4700$f6b2d83f@goofy1">news:002601c1b033$382a4700$f6b2d83f@goofy1... Paul, It is being inserted into a database -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 07, 2002 5:41 PM To: Todd Williamsen; [EMAIL PROTECTED] Subject: Re: [PHP-DB] addslashes() At 16:54 -0600 2/7/02, Todd Williamsen wrote: Ok.. i tried it out... and it almost works like I want it... weird though 1. when I put in pfont color=bluethis is BLUE/p/font it prints it in like a bright green. but if i use the RGB # then its fine. weird 2. if there is an apostrophe in the notes, then it will add slashes it to that as well so if I type blah blah blah I am going over to my friend's website later on and here is the address... a href=http://friends.comFriends/a it will look like friend\\\'s Friends(link) addslashes() is for escaping values that you're going to insert into a database. If you're generating HTML, use htmlspecialchars() instead. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Searching Documents
Hello!!! Use LIKE in your Select statement...Like this!! $sql = Select File_Name From Table2 WHERE File_Name LIKE '%$Search%'; $Search would come from a form... Dan On Friday, February 8, 2002, at 09:06 AM, [EMAIL PROTECTED] wrote: I was wondering if there is a way to search documents. Scenario: I have a application where it uploads MS Word documents to a server and holds the documents location in the database. What I want is to be able to search those Word documents via keywords. Is this possible with 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] Searching Documents
So that statement would actually open up the MS Word document and search it for the keywords specified? -Original Message- From: Dan Brunner [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 9:34 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Searching Documents Hello!!! Use LIKE in your Select statement...Like this!! $sql = Select File_Name From Table2 WHERE File_Name LIKE '%$Search%'; $Search would come from a form... Dan On Friday, February 8, 2002, at 09:06 AM, [EMAIL PROTECTED] wrote: I was wondering if there is a way to search documents. Scenario: I have a application where it uploads MS Word documents to a server and holds the documents location in the database. What I want is to be able to search those Word documents via keywords. Is this possible with 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] addslashes()
At 9:14 -0600 2/8/02, Todd Williamsen wrote: So if I: Going in $Notes = addslashes($Notes); Going Out: $Notes = stripslashes($Notes); wouldn't that kill the html? or no? I have no idea. What do you mean by in and out? What exactly are you trying to do? Are you generating HTML for a Web page, storing data in a database, or are you trying to store HTML in your database? Joe Van Meer [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi. addslashes() going in to db, stripslashes() coming out :) HTH Joe :) Todd Williamsen [EMAIL PROTECTED] wrote in message 002601c1b033$382a4700$f6b2d83f@goofy1">news:002601c1b033$382a4700$f6b2d83f@goofy1... Paul, It is being inserted into a database -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 07, 2002 5:41 PM To: Todd Williamsen; [EMAIL PROTECTED] Subject: Re: [PHP-DB] addslashes() At 16:54 -0600 2/7/02, Todd Williamsen wrote: Ok.. i tried it out... and it almost works like I want it... weird though 1. when I put in pfont color=bluethis is BLUE/p/font it prints it in like a bright green. but if i use the RGB # then its fine. weird 2. if there is an apostrophe in the notes, then it will add slashes it to that as well so if I type blah blah blah I am going over to my friend's website later on and here is the address... a href=http://friends.comFriends/a it will look like friend\\\'s Friends(link) addslashes() is for escaping values that you're going to insert into a database. If you're generating HTML, use htmlspecialchars() instead. -- 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] addslashes()
It shouldn't. It will affect any or ' coming out. For example, for going in to db: $mystring = Hi there Mr O'Neil.; $mystring = addslashes($mystring); echo $mystring; would result in Hi there Mr O\'Neil. When coming out of db make sure you use the stripslashes function to return the original value that was created upon entry $mystring = stripslashes($mystring); would result back to Hi there Mr O'Neil. HTH Joe :) Todd Williamsen [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... So if I: Going in $Notes = addslashes($Notes); Going Out: $Notes = stripslashes($Notes); wouldn't that kill the html? or no? Joe Van Meer [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi. addslashes() going in to db, stripslashes() coming out :) HTH Joe :) Todd Williamsen [EMAIL PROTECTED] wrote in message 002601c1b033$382a4700$f6b2d83f@goofy1">news:002601c1b033$382a4700$f6b2d83f@goofy1... Paul, It is being inserted into a database -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 07, 2002 5:41 PM To: Todd Williamsen; [EMAIL PROTECTED] Subject: Re: [PHP-DB] addslashes() At 16:54 -0600 2/7/02, Todd Williamsen wrote: Ok.. i tried it out... and it almost works like I want it... weird though 1. when I put in pfont color=bluethis is BLUE/p/font it prints it in like a bright green. but if i use the RGB # then its fine. weird 2. if there is an apostrophe in the notes, then it will add slashes it to that as well so if I type blah blah blah I am going over to my friend's website later on and here is the address... a href=http://friends.comFriends/a it will look like friend\\\'s Friends(link) addslashes() is for escaping values that you're going to insert into a database. If you're generating HTML, use htmlspecialchars() instead. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Oracle 9i support
Greetings! As far as I can tell from the documentation, the OCI8 driver supports Oracle 8. However, on the ADODB site, they mention that the OCI8 driver supports Oracle 8/9. Can someone clarify what the status of support for Oracle 9i is in PHP? I need to know if I need to stick with Oracle 8i now or not. Ted Boardman Communications Technology Editor Indiana University Alumni Association [EMAIL PROTECTED] http://www.alumni.indiana.edu -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Need to delete charcters from a string
Oops, I totally misunderstood what you were trying to accomplish :) heh Sorry for any confusion Joe :) Renaldo De Silva [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I need to delete the last 3 character of a string, what command can i use o do this. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] multiple entries in database
Show us you table data Show your PHP code as well -Original Message- From: Justin Hall [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 12:06 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] multiple entries in database I have worked my problem down to the mysql database. I have a table like so: Field Type Attributes Null Default Extra username varchar(16) No commID int(9) No auto_increment commState char(2) No commCity varchar(25) No commZip int(5) No 0 commName varchar(255) No commID is primaryKey. when I do an insert to this table without giving the ID a value inside the insert statement it duplicates the entry or increments another blank entry. the insert statement is not in a loop or recursive function. I have found out that if I take out the auto_increment that it adds it just fine if the ID value is added to the statement..without the ID value it enters the ID as '0'. I have another insert statement with another table that is doing the exact same thing. I'm kinda new and kinda not..so..any help is appreciated.. Justin Hall JD Media www.jdmedia.net [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] addslashes()
Paul.. Going into the database Coming out of the database Please read the whole post.. 8) -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 9:40 AM To: Todd Williamsen; [EMAIL PROTECTED] Subject: Re: [PHP-DB] addslashes() At 9:14 -0600 2/8/02, Todd Williamsen wrote: So if I: Going in $Notes = addslashes($Notes); Going Out: $Notes = stripslashes($Notes); wouldn't that kill the html? or no? I have no idea. What do you mean by in and out? What exactly are you trying to do? Are you generating HTML for a Web page, storing data in a database, or are you trying to store HTML in your database? Joe Van Meer [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi. addslashes() going in to db, stripslashes() coming out :) HTH Joe :) Todd Williamsen [EMAIL PROTECTED] wrote in message 002601c1b033$382a4700$f6b2d83f@goofy1">news:002601c1b033$382a4700$f6b2d83f@goofy1... Paul, It is being inserted into a database -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 07, 2002 5:41 PM To: Todd Williamsen; [EMAIL PROTECTED] Subject: Re: [PHP-DB] addslashes() At 16:54 -0600 2/7/02, Todd Williamsen wrote: Ok.. i tried it out... and it almost works like I want it... weird though 1. when I put in pfont color=bluethis is BLUE/p/font it prints it in like a bright green. but if i use the RGB # then its fine. weird 2. if there is an apostrophe in the notes, then it will add slashes it to that as well so if I type blah blah blah I am going over to my friend's website later on and here is the address... a href=http://friends.comFriends/a it will look like friend\\\'s Friends(link) addslashes() is for escaping values that you're going to insert into a database. If you're generating HTML, use htmlspecialchars() instead. -- 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] addslashes()
Paul, Sorry for the confusion... Ok.. I have an application where it organizes candidates for positions for HR. There is a Notes field where they can update actions with the potential candidate. Now this can be when this person has been contacted, conversations, or just to say this person is not available, etc. There may be a point where quotes need to be added to quote a candidate, or I wanted to give them the option of adding HTML tags to the field so that when someone looks at the person's record, that the HTML will be displayed. It wasn't just the HTML that was causing problems, but the quotes as well. So... If I add.. Joe Blow said blah blah blah the query wouldn't execute. But if I did Joe Blow said, blah blah blah, it works fine. I know HTML isn't as touchy and you can actually do without the quotes, ie, font color=redBLAH/font it will still display red font. The weird thing is that I have a Job Posting section and when you update or edit an exsisting job and add HTML, it works fine without the addslashes() function, but with the Edit Candidate, it craps out... Weird, both are practically carbon copies of each other, database field is both set to TEXT and both queries are the same structure. I cannot figure it out If you want the URL to look at it, I will send it to you. Thanks! -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 10:00 AM To: Todd Williamsen; [EMAIL PROTECTED] Subject: RE: [PHP-DB] addslashes() At 9:53 -0600 2/8/02, Todd Williamsen wrote: Paul.. Going into the database Coming out of the database Please read the whole post.. 8) I did. It's not clear, at least to me, what you're trying to do. You say print at one point and insert into database at another point. I'm pretty sure I know the solution. What's not clear to me is the *problem*. Where are the data coming from? Are you generating it within the script? Are you receiving it as the contents of a web form? What are you doing with that data? Printing it? Storing it into the database? Storing it into the database so that you can print it as a Web page later? -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 9:40 AM To: Todd Williamsen; [EMAIL PROTECTED] Subject: Re: [PHP-DB] addslashes() At 9:14 -0600 2/8/02, Todd Williamsen wrote: So if I: Going in $Notes = addslashes($Notes); Going Out: $Notes = stripslashes($Notes); wouldn't that kill the html? or no? I have no idea. What do you mean by in and out? What exactly are you trying to do? Are you generating HTML for a Web page, storing data in a database, or are you trying to store HTML in your database? Joe Van Meer [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi. addslashes() going in to db, stripslashes() coming out :) HTH Joe :) Todd Williamsen [EMAIL PROTECTED] wrote in message 002601c1b033$382a4700$f6b2d83f@goofy1">news:002601c1b033$382a4700$f6b2d83f@goofy1... Paul, It is being inserted into a database -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 07, 2002 5:41 PM To: Todd Williamsen; [EMAIL PROTECTED] Subject: Re: [PHP-DB] addslashes() At 16:54 -0600 2/7/02, Todd Williamsen wrote: Ok.. i tried it out... and it almost works like I want it... weird though 1. when I put in pfont color=bluethis is BLUE/p/font it prints it in like a bright green. but if i use the RGB # then its fine. weird 2. if there is an apostrophe in the notes, then it will add slashes it to that as well so if I type blah blah blah I am going over to my friend's website later on and here is the address... a href=http://friends.comFriends/a it will look like friend\\\'s Friends(link) addslashes() is for escaping values that you're going to insert into a database. If you're generating HTML, use htmlspecialchars() instead. -- 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] addslashes()
At 10:06 -0600 2/8/02, Todd Williamsen wrote: Paul, Sorry for the confusion... Ok.. I have an application where it organizes candidates for positions for HR. There is a Notes field where they can update actions with the potential candidate. Now this can be when this person has been contacted, conversations, or just to say this person is not available, etc. I assume by this you mean you have a form-based application through which the information is submitted. There may be a point where quotes need to be added to quote a candidate, or I wanted to give them the option of adding HTML tags to the field so that when someone looks at the person's record, that the HTML will be displayed. It wasn't just the HTML that was causing problems, but the quotes as well. This makes your problem basically intractable. Sorry. If I input: Candidate requires salary $100K and $75K Then it like kinda like there's a tag there, because of the and Or if I input: Candidate has a, shall we say, checkered past Then the value has quotes. Now, you want to let people put in something like: Candidate has a, shall we say, font color=redcheckered/font past. Now, you can store any of those values into the database easily. Just use addslashes() to escape the values that are special in SQL. When you retrieve the values, you'll get exactly the values as shown above. But then what do you do with them? For the first two instances, you need to display the , and characters literally, which you might do by converting them to HTML entities (lt;, lt;, and quot;) by running the strings through htmlspecialchars() before printing them as part of the Web page. But for the third instance, you want to pass those same characters through to the browser so that it interprets them as HTML markup. How are you going to tell? See the problem? So... If I add.. Joe Blow said blah blah blah the query wouldn't execute. But if I did Joe Blow said, blah blah blah, it works fine. I know HTML isn't as touchy and you can actually do without the quotes, ie, font color=redBLAH/font it will still display red font. The weird thing is that I have a Job Posting section and when you update or edit an exsisting job and add HTML, it works fine without the addslashes() function, but with the Edit Candidate, it craps out... Weird, both are practically carbon copies of each other, database field is both set to TEXT and both queries are the same structure. I cannot figure it out If you want the URL to look at it, I will send it to you. Thanks! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] addslashes()
Paul, No kidding I see the problem, that is why I am asking how do I solve it. I don't need the problem re-explained to me 8) -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 10:21 AM To: Todd Williamsen; [EMAIL PROTECTED] Subject: RE: [PHP-DB] addslashes() At 10:06 -0600 2/8/02, Todd Williamsen wrote: Paul, Sorry for the confusion... Ok.. I have an application where it organizes candidates for positions for HR. There is a Notes field where they can update actions with the potential candidate. Now this can be when this person has been contacted, conversations, or just to say this person is not available, etc. I assume by this you mean you have a form-based application through which the information is submitted. There may be a point where quotes need to be added to quote a candidate, or I wanted to give them the option of adding HTML tags to the field so that when someone looks at the person's record, that the HTML will be displayed. It wasn't just the HTML that was causing problems, but the quotes as well. This makes your problem basically intractable. Sorry. If I input: Candidate requires salary $100K and $75K Then it like kinda like there's a tag there, because of the and Or if I input: Candidate has a, shall we say, checkered past Then the value has quotes. Now, you want to let people put in something like: Candidate has a, shall we say, font color=redcheckered/font past. Now, you can store any of those values into the database easily. Just use addslashes() to escape the values that are special in SQL. When you retrieve the values, you'll get exactly the values as shown above. But then what do you do with them? For the first two instances, you need to display the , and characters literally, which you might do by converting them to HTML entities (lt;, lt;, and quot;) by running the strings through htmlspecialchars() before printing them as part of the Web page. But for the third instance, you want to pass those same characters through to the browser so that it interprets them as HTML markup. How are you going to tell? See the problem? So... If I add.. Joe Blow said blah blah blah the query wouldn't execute. But if I did Joe Blow said, blah blah blah, it works fine. I know HTML isn't as touchy and you can actually do without the quotes, ie, font color=redBLAH/font it will still display red font. The weird thing is that I have a Job Posting section and when you update or edit an exsisting job and add HTML, it works fine without the addslashes() function, but with the Edit Candidate, it craps out... Weird, both are practically carbon copies of each other, database field is both set to TEXT and both queries are the same structure. I cannot figure it out If you want the URL to look at it, I will send it to you. Thanks! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] addslashes()
At 10:22 -0600 2/8/02, Todd Williamsen wrote: Paul, No kidding I see the problem, that is why I am asking how do I solve it. By writing a content parser that is intelligent enough to recognize HTML constructs and pass them through literally, while recognizing when your people write other stuff containing the same characters that does not signify HTML. In other words, a parser that can read their minds. Good luck. :-) Alternatively, tell them to signal special constructs using a syntax that doesn't overlap HTML so that you can recognize the constructs and transform them to HTML when you render a Web page. Alternatively, tell them that if they want to include literal characters like or , they must enter them as lt; or gt;. In this case, you interpret the text as HTML that's already properly escaped and you simply display it as is with no extra conversion. None of these are particularly attractive. It's an ugly problem; I suspect it has no pretty solution. I don't need the problem re-explained to me 8) -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 10:21 AM To: Todd Williamsen; [EMAIL PROTECTED] Subject: RE: [PHP-DB] addslashes() At 10:06 -0600 2/8/02, Todd Williamsen wrote: Paul, Sorry for the confusion... Ok.. I have an application where it organizes candidates for positions for HR. There is a Notes field where they can update actions with the potential candidate. Now this can be when this person has been contacted, conversations, or just to say this person is not available, etc. I assume by this you mean you have a form-based application through which the information is submitted. There may be a point where quotes need to be added to quote a candidate, or I wanted to give them the option of adding HTML tags to the field so that when someone looks at the person's record, that the HTML will be displayed. It wasn't just the HTML that was causing problems, but the quotes as well. This makes your problem basically intractable. Sorry. If I input: Candidate requires salary $100K and $75K Then it like kinda like there's a tag there, because of the and Or if I input: Candidate has a, shall we say, checkered past Then the value has quotes. Now, you want to let people put in something like: Candidate has a, shall we say, font color=redcheckered/font past. Now, you can store any of those values into the database easily. Just use addslashes() to escape the values that are special in SQL. When you retrieve the values, you'll get exactly the values as shown above. But then what do you do with them? For the first two instances, you need to display the , and characters literally, which you might do by converting them to HTML entities (lt;, lt;, and quot;) by running the strings through htmlspecialchars() before printing them as part of the Web page. But for the third instance, you want to pass those same characters through to the browser so that it interprets them as HTML markup. How are you going to tell? See the problem? So... If I add.. Joe Blow said blah blah blah the query wouldn't execute. But if I did Joe Blow said, blah blah blah, it works fine. I know HTML isn't as touchy and you can actually do without the quotes, ie, font color=redBLAH/font it will still display red font. The weird thing is that I have a Job Posting section and when you update or edit an exsisting job and add HTML, it works fine without the addslashes() function, but with the Edit Candidate, it craps out... Weird, both are practically carbon copies of each other, database field is both set to TEXT and both queries are the same structure. I cannot figure it out If you want the URL to look at it, I will send it to you. Thanks! -- 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] addslashes()
Explain this... Now I have Edit Jobs where you can do the same HTML and other SQL specific stuff in the Job Description, that works with no problems whatsoever, then I have this Edit Candidate page that is structured EXACTLY the same, and the Edit Candidate craps out... Why is that? One works and the other doesn't? -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 10:34 AM To: Todd Williamsen; [EMAIL PROTECTED] Subject: RE: [PHP-DB] addslashes() At 10:22 -0600 2/8/02, Todd Williamsen wrote: Paul, No kidding I see the problem, that is why I am asking how do I solve it. By writing a content parser that is intelligent enough to recognize HTML constructs and pass them through literally, while recognizing when your people write other stuff containing the same characters that does not signify HTML. In other words, a parser that can read their minds. Good luck. :-) Alternatively, tell them to signal special constructs using a syntax that doesn't overlap HTML so that you can recognize the constructs and transform them to HTML when you render a Web page. Alternatively, tell them that if they want to include literal characters like or , they must enter them as lt; or gt;. In this case, you interpret the text as HTML that's already properly escaped and you simply display it as is with no extra conversion. None of these are particularly attractive. It's an ugly problem; I suspect it has no pretty solution. I don't need the problem re-explained to me 8) -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 10:21 AM To: Todd Williamsen; [EMAIL PROTECTED] Subject: RE: [PHP-DB] addslashes() At 10:06 -0600 2/8/02, Todd Williamsen wrote: Paul, Sorry for the confusion... Ok.. I have an application where it organizes candidates for positions for HR. There is a Notes field where they can update actions with the potential candidate. Now this can be when this person has been contacted, conversations, or just to say this person is not available, etc. I assume by this you mean you have a form-based application through which the information is submitted. There may be a point where quotes need to be added to quote a candidate, or I wanted to give them the option of adding HTML tags to the field so that when someone looks at the person's record, that the HTML will be displayed. It wasn't just the HTML that was causing problems, but the quotes as well. This makes your problem basically intractable. Sorry. If I input: Candidate requires salary $100K and $75K Then it like kinda like there's a tag there, because of the and Or if I input: Candidate has a, shall we say, checkered past Then the value has quotes. Now, you want to let people put in something like: Candidate has a, shall we say, font color=redcheckered/font past. Now, you can store any of those values into the database easily. Just use addslashes() to escape the values that are special in SQL. When you retrieve the values, you'll get exactly the values as shown above. But then what do you do with them? For the first two instances, you need to display the , and characters literally, which you might do by converting them to HTML entities (lt;, lt;, and quot;) by running the strings through htmlspecialchars() before printing them as part of the Web page. But for the third instance, you want to pass those same characters through to the browser so that it interprets them as HTML markup. How are you going to tell? See the problem? So... If I add.. Joe Blow said blah blah blah the query wouldn't execute. But if I did Joe Blow said, blah blah blah, it works fine. I know HTML isn't as touchy and you can actually do without the quotes, ie, font color=redBLAH/font it will still display red font. The weird thing is that I have a Job Posting section and when you update or edit an exsisting job and add HTML, it works fine without the addslashes() function, but with the Edit Candidate, it craps out... Weird, both are practically carbon copies of each other, database field is both set to TEXT and both queries are the same structure. I cannot figure it out If you want the URL to look at it, I will send it to you. Thanks! -- 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] Dealing with Quotation marks
Does anyone know how to deal with this problem? If a user enters in a text box; O'Connor's 2 x 3 When you print it out on the next web page it reads; O\'Connor\'s 2\ x 3\ I have written a function to take care of this, but when you try to write it to the database you get an error of unmatched quotation marks. Is there a function to handle this? Any help would be appreciated. Thanks, Gary -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] addslashes()
At 10:35 -0600 2/8/02, Todd Williamsen wrote: Explain this... Now I have Edit Jobs where you can do the same HTML and other SQL specific stuff in the Job Description, that works with no problems whatsoever, then I have this Edit Candidate page that is structured EXACTLY the same, and the Edit Candidate craps out... Why is that? One works and the other doesn't? Good question. It may be that they really behave the same and you don't know it because you're entering different kinds of information into them and thus not triggering the bug for one of them. Or it may be that they're not really *exactly* the same. You can test the first possibility by swapping the information that you enter into the two fields. If the one that works now fails and the one that fails now works, then you have two non-working fields and didn't realize it due to having not tried a sufficient range of values. If the one that works continues to work and the one that fails continues to fail, then clear they're not really *exactly* the same. -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 10:34 AM To: Todd Williamsen; [EMAIL PROTECTED] Subject: RE: [PHP-DB] addslashes() At 10:22 -0600 2/8/02, Todd Williamsen wrote: Paul, No kidding I see the problem, that is why I am asking how do I solve it. By writing a content parser that is intelligent enough to recognize HTML constructs and pass them through literally, while recognizing when your people write other stuff containing the same characters that does not signify HTML. In other words, a parser that can read their minds. Good luck. :-) Alternatively, tell them to signal special constructs using a syntax that doesn't overlap HTML so that you can recognize the constructs and transform them to HTML when you render a Web page. Alternatively, tell them that if they want to include literal characters like or , they must enter them as lt; or gt;. In this case, you interpret the text as HTML that's already properly escaped and you simply display it as is with no extra conversion. None of these are particularly attractive. It's an ugly problem; I suspect it has no pretty solution. I don't need the problem re-explained to me 8) -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 10:21 AM To: Todd Williamsen; [EMAIL PROTECTED] Subject: RE: [PHP-DB] addslashes() At 10:06 -0600 2/8/02, Todd Williamsen wrote: Paul, Sorry for the confusion... Ok.. I have an application where it organizes candidates for positions for HR. There is a Notes field where they can update actions with the potential candidate. Now this can be when this person has been contacted, conversations, or just to say this person is not available, etc. I assume by this you mean you have a form-based application through which the information is submitted. There may be a point where quotes need to be added to quote a candidate, or I wanted to give them the option of adding HTML tags to the field so that when someone looks at the person's record, that the HTML will be displayed. It wasn't just the HTML that was causing problems, but the quotes as well. This makes your problem basically intractable. Sorry. If I input: Candidate requires salary $100K and $75K Then it like kinda like there's a tag there, because of the and Or if I input: Candidate has a, shall we say, checkered past Then the value has quotes. Now, you want to let people put in something like: Candidate has a, shall we say, font color=redcheckered/font past. Now, you can store any of those values into the database easily. Just use addslashes() to escape the values that are special in SQL. When you retrieve the values, you'll get exactly the values as shown above. But then what do you do with them? For the first two instances, you need to display the , and characters literally, which you might do by converting them to HTML entities (lt;, lt;, and quot;) by running the strings through htmlspecialchars() before printing them as part of the Web page. But for the third instance, you want to pass those same characters through to the browser so that it interprets them as HTML markup. How are you going to tell? See the problem? So... If I add.. Joe Blow said blah blah blah the query wouldn't execute. But if I did Joe Blow said, blah blah blah, it works fine. I know HTML isn't as touchy and you can actually do without the quotes, ie, font color=redBLAH/font it will still display red font. The weird thing is that I have a Job Posting section and when you update or edit an exsisting job and add HTML, it works fine without the addslashes() function, but with the Edit Candidate, it craps out... Weird, both are practically carbon copies of each other, database field is both set to TEXT and both queries are the same structure. I cannot figure it out If you want the URL to look at it, I will send it to you. Thanks!
RE: [PHP-DB] Dealing with Quotation marks
First, you don't have to write your own function to remove slashes. Simply use: $newline = stripslashes($oldline); Second, write your lien containing slashes to the database. When you pull it from the database, use stripslashes(). -Original Message- From: Gary [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 10:35 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Dealing with Quotation marks Does anyone know how to deal with this problem? If a user enters in a text box; O'Connor's 2 x 3 When you print it out on the next web page it reads; O\'Connor\'s 2\ x 3\ I have written a function to take care of this, but when you try to write it to the database you get an error of unmatched quotation marks. Is there a function to handle this? Any help would be appreciated. Thanks, Gary -- 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] Simple Question, hopefully simple answer
RTFM (MySQL) for COUNT() and SUM() (and many other useful functions). My MySQL client is giving me a syntax error when I enter that command. :-) =that? Please post the SQL/PHP causing the problem - the list's crystal ball filter is not working. =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL / PHP Database Help
Jonathan, [have put the cc back to the list] Is it possible to make BOTH the date and venue into a single unique index? =Why not? Like a good woman, treat her right, and SQL will do almost anything for you: 6.5.3 CREATE TABLE Syntax CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)] [table_options] [select_statement] create_definition: col_name type [NOT NULL | NULL] [DEFAULT default_value] [AUTO_INCREMENT] [PRIMARY KEY] [reference_definition] orPRIMARY KEY (index_col_name,...) orKEY [index_name] (index_col_name,...) orINDEX [index_name] (index_col_name,...) ... Note the ellipses (...) at the end of that last line - many people are used to writing [PRIMARY] KEY or INDEX immediately after field name and definition, forgetting that if it is a separate clause of the CREATE stmt, multiple columns may be specified! (Not that this works for me.) But I'm qcurious about this. I understand where this could be useful as a single unique index.. (as opposed to two unique indexes) Is this possible? How so? =yes it is possible, as above. =the short answer is: wherever you find yourself doing SELECT...WHERE field/index-condition1 AND field/index-condition2 =If only the first field/column is indexed, then obviously the SELECT will be faster than when accessing an unindexed table. However if there is a large fan-out between the two fields columns, (ie there are a large number of different values in field/column2 which share the same value in field/column1) then it may pay to combine the two fields into a single index for even faster results. Of course, the smaller your table, the harder it is to 'see' any return on the investment! (In my case multiple entries are ok, just as long as I can run a report to spot them, and then edit them which usually requires human interaction.) =If your system's data-entry stage is time-constrained then I would be tempted to agree. Otherwise conventional wisdom suggests that it is better to prevent 'dirty' data entering the system or data integrity issues creeping in, than it is to develop a strategy to 'clean' the db post-fact. Usually the person entering the data knows most about it - or has the best opportunity to ask the 'data source' for clarification! Your second suggestion worked rather well... although its not quite generating the output that would be best suited to me. The MySQL docs on Group By and Count are quite weak.. do you have something else you could send me / can you explain these commands. I was sure there is / was a way to do it in MySQL my SQL just isn't what it should be. =if you post the code you've developed thus far, and some sample source data and results, together with some specific criticism, we might be able to help with issues like best suited, or tweak the code I sent earlier to provide for situations that may not have been evident (at least to me) in your first post. =GROUP BY and COUNT() can be combined in many different ways, so what seems straightforward on the surface can yield enormous power when you start to tinker under the hood. I assume what you mean is that the manual is not really a tutorial. =Apart from the manual, I use books (I've picked up a few over the years - some probably now out of print; Paul DuBois' MySQL is current and the most specific - and has a PHP interface chapter, plus other more-PHP books, eg Welling Thomson) and there are a number of tutorial web sites either covering SQL generally or MySQL in particular (start at the MySQL site or any search engine). =Regards, =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Searching Documents
No one knows??? hmm... I looked around on php.net couldn't find anything regarding this.. would I need to do these searches in MS Word docs with ASP? Todd Williamsen [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I was wondering if there is a way to search documents. Scenario: I have a application where it uploads MS Word documents to a server and holds the documents location in the database. What I want is to be able to search those Word documents via keywords. Is this possible with PHP? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Searching Documents
Todd, No one knows??? =or isn't telling? hmm... I looked around on php.net couldn't find anything regarding this.. would I need to do these searches in MS Word docs with ASP? =go ahead if you are aspidexterous... =the Word document format is proprietary information - ie not 'open'. So it is a 'bit much' expecting an open system (PHP) to gain access! Try gaining access to words in a Word doc from even Access!? =What about PHP-COM/DCOM? =dn I was wondering if there is a way to search documents. Scenario: I have a application where it uploads MS Word documents to a server and holds the documents location in the database. What I want is to be able to search those Word documents via keywords. Is this possible with 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] Simple Display
I am trying to do a simple fetch of the lastest add name. I have the following code : $query = SELECT name FROM name ORDER BY name DESC LIMIT 1; $latename = mysql_query($query) or die(Select Failed!); $latename = mysql_fetch_array($latename); echo bLastest Name Added:/b $latename I know I am doing something wrong as being new to php it get be confused. It returns : Lastest Name Added: Array Could someone please point out where i'm going wrong Thank you -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Searching Documents
Yes, I was thinking COM/DCOM, but then does PHP able to do that? Or do I need to resort to ASP(Awful Scripting Pages)? -Original Message- From: DL Neil [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 12:40 PM To: Todd Williamsen Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Re: Searching Documents Todd, No one knows??? =or isn't telling? hmm... I looked around on php.net couldn't find anything regarding this.. would I need to do these searches in MS Word docs with ASP? =go ahead if you are aspidexterous... =the Word document format is proprietary information - ie not 'open'. So it is a 'bit much' expecting an open system (PHP) to gain access! Try gaining access to words in a Word doc from even Access!? =What about PHP-COM/DCOM? =dn I was wondering if there is a way to search documents. Scenario: I have a application where it uploads MS Word documents to a server and holds the documents location in the database. What I want is to be able to search those Word documents via keywords. Is this possible with 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] Simple Display
At 7:46 +1300 2/9/02, Barry Rumsey wrote: I am trying to do a simple fetch of the lastest add name. I have the following code : $query = SELECT name FROM name ORDER BY name DESC LIMIT 1; $latename = mysql_query($query) or die(Select Failed!); $latename = mysql_fetch_array($latename); echo bLastest Name Added:/b $latename I know I am doing something wrong as being new to php it get be confused. It returns : Lastest Name Added: Array Could someone please point out where i'm going wrong You've fetched an array, and you're trying to print the array itself, not a member of the array. Perhaps you want: echo bLastest Name Added:/b $latename[name] Or: echo bLastest Name Added:/b $latename[0] I suppose you might also mean Latest rather than Lastest... :-) Thank you -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Searching Documents
Actually, PHP does COM very wellsearch the PHP-WIN list about COM and Word and you should find some good hints and examples to get going. I haven't accessed the keywords portion of a word document yet, but someone wrote a spellcheck function that used the spellcheck built into Word using PHP COM. There is also a really helpful article at phpbuilder.com that gets you started with COM. If you have trouble finding them, I could forward some messages to you from that list. Court -Original Message- I was thinking COM/DCOM, but then does PHP able to do that? Or do I need to resort to ASP(Awful Scripting Pages)? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Searching Documents
Now, if I do COM with PHP, then does this need to be on a Windows server? Currently it sits on a Linux box. -Original Message- From: DL Neil [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 12:40 PM To: Todd Williamsen Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Re: Searching Documents Todd, No one knows??? =or isn't telling? hmm... I looked around on php.net couldn't find anything regarding this.. would I need to do these searches in MS Word docs with ASP? =go ahead if you are aspidexterous... =the Word document format is proprietary information - ie not 'open'. So it is a 'bit much' expecting an open system (PHP) to gain access! Try gaining access to words in a Word doc from even Access!? =What about PHP-COM/DCOM? =dn I was wondering if there is a way to search documents. Scenario: I have a application where it uploads MS Word documents to a server and holds the documents location in the database. What I want is to be able to search those Word documents via keywords. Is this possible with 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] Re: Searching Documents
correct to my knowledge. I am not sure even running ASP on a linux server would allow you to open the word documents, as I think ASP uses COM to do the dirty work. of course, you could always do the world a favor and not use microsoft's proprietary file formats in any way. an open standard will always be easier and be able to reach the most people--even micorosft products can read open standard documents, why shutoff the rest of the world to what you are doing by using M$? glad to hear you are running linux, though, so you must already know most of this :-) best of luck in your endeavors! court -Original Message- Now, if I do COM with PHP, then does this need to be on a Windows server? Currently it sits on a Linux box. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Round a float to the next highest value despite the value after the point
how can I round a float to the next highest value reguardless of the value after the point, does anyone have any suggestion, any help would be apreciated. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Searching Documents
Well, This application would eventually land on either Linux or Windows box, it would be for internal use only, so it wouldn't get wacked too bad. I know IIS5 has a bunch of COM built-ins. The problem of going to like a text based documents is that this is for resume management and 99% of the resumes are in MS Word format, so thats the reason why Court Shrock [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... correct to my knowledge. I am not sure even running ASP on a linux server would allow you to open the word documents, as I think ASP uses COM to do the dirty work. of course, you could always do the world a favor and not use microsoft's proprietary file formats in any way. an open standard will always be easier and be able to reach the most people--even micorosft products can read open standard documents, why shutoff the rest of the world to what you are doing by using M$? glad to hear you are running linux, though, so you must already know most of this :-) best of luck in your endeavors! court -Original Message- Now, if I do COM with PHP, then does this need to be on a Windows server? Currently it sits on a Linux box. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Round a float to the next highest value despite the value after the point
ceil($myvalue) -Original Message- From: Renaldo De Silva [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 1:32 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Round a float to the next highest value despite the value after the point how can I round a float to the next highest value reguardless of the value after the point, does anyone have any suggestion, any help would be apreciated. -- 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] Round a float to the next highest value despite the value after the point
http://www.php.net/manual/en/function.ceil.php -Original Message- how can I round a float to the next highest value reguardless of the value after the point, does anyone have any suggestion, any help would be apreciated. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Searching Documents
Court, Todd, et al Actually, PHP does COM very wellsearch the PHP-WIN list about COM and Word and you should find some good hints and examples to get going. I haven't accessed the keywords portion of a word document yet, but someone wrote a spellcheck function that used the spellcheck built into Word using PHP COM. There is also a really helpful article at phpbuilder.com that gets you started with COM. If you have trouble finding them, I could forward some messages to you from that list. -Original Message- I was thinking COM/DCOM, but then does PHP able to do that? Or do I need to resort to ASP(Awful Scripting Pages)? Thanks for that comment Court. I have seen the entries in the PHP manual - and possibly one or two of those articles (but not yet studied them - so many PHP info sources/ideas but so little time!). The spell-check exploit caught my eye - a good way to make use of a well-established (and if you use if frequently - a well invested) tool. Unlike Todd's application (getting data out of Word) I was thinking of going the 'other way' (yes there's always one!). HTML/browsers are good for showing information on the screen - whether a data-entry type of form, or a web page or descriptive/narrative information (eg a PHPbuilder article). However when you want to print the data out, browsers are pretty basic! So I was wondering about extending the idea of constructing web documents from a db/on the fly for display in a browser, to going the next step and reproducing the same doc in (say) Word (using its presentation/printing/formatting features), so that the doc can be presented with natty facilities, eg page/chapter headings/footings, page numbers, chapters and table of contents, cover page(s), indexes/indices, etc - 'camera ready'! Anyone seen it done? =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Round a float to the next highest value despite thevalue after the point
At 15:31 -0400 2/8/02, Renaldo De Silva wrote: how can I round a float to the next highest value reguardless of the value after the point, does anyone have any suggestion, any help would be apreciated. Define next highest value. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Round a float to the next highest value despite the value after the point
how can I round a float to the next highest value reguardless of the value after the point, does anyone have any suggestion, any help would be apreciated. do you mean the function round maybey or .. explain the question with an example please -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Searching Documents
DL Sounds cool!! Get to work! LOL! Well, as soon as I get some idea what the hell I will be doing I will start it, and I will keep you guys informed on it if you like. For DL's app, it would be the opposite, but same method, but backwards, right? -Original Message- From: DL Neil [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 1:33 PM To: Shrock, Court; 'Todd Williamsen' Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Re: Searching Documents Court, Todd, et al Actually, PHP does COM very wellsearch the PHP-WIN list about COM and Word and you should find some good hints and examples to get going. I haven't accessed the keywords portion of a word document yet, but someone wrote a spellcheck function that used the spellcheck built into Word using PHP COM. There is also a really helpful article at phpbuilder.com that gets you started with COM. If you have trouble finding them, I could forward some messages to you from that list. -Original Message- I was thinking COM/DCOM, but then does PHP able to do that? Or do I need to resort to ASP(Awful Scripting Pages)? Thanks for that comment Court. I have seen the entries in the PHP manual - and possibly one or two of those articles (but not yet studied them - so many PHP info sources/ideas but so little time!). The spell-check exploit caught my eye - a good way to make use of a well-established (and if you use if frequently - a well invested) tool. Unlike Todd's application (getting data out of Word) I was thinking of going the 'other way' (yes there's always one!). HTML/browsers are good for showing information on the screen - whether a data-entry type of form, or a web page or descriptive/narrative information (eg a PHPbuilder article). However when you want to print the data out, browsers are pretty basic! So I was wondering about extending the idea of constructing web documents from a db/on the fly for display in a browser, to going the next step and reproducing the same doc in (say) Word (using its presentation/printing/formatting features), so that the doc can be presented with natty facilities, eg page/chapter headings/footings, page numbers, chapters and table of contents, cover page(s), indexes/indices, etc - 'camera ready'! Anyone seen it done? =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Searching Documents
Todd, Now, if I do COM with PHP, then does this need to be on a Windows server? Currently it sits on a Linux box. I assume if you are setting up a dynamic connection to Word, Word will have to be running - which almost implies a Windows box. Whether the COM component/add-on to PHP (also?) demands a Windows box, I can't say. Regards, =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Round a float to the next highest value despite the value after the point
I just found it, what I was looking for was ceil(), that function round a float to the next highest values no matter what is after the point Example:$test=5.3 ceil($test) // gives 6 If you just used round you would get 5 instead of 6 Renaldo De Silva wrote: how can I round a float to the next highest value reguardless of the value after the point, does anyone have any suggestion, any help would be apreciated. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Searching Documents
If running meant at the process level and not just installed, then word does not have to be running.COM creates the appropriate instances of whatever is requested via COM. But yes, Word does have to be installed. However, wonder what the wine project could afford this discussion? Maybe you could do it on a 'nix afterall?! -Original Message- I assume if you are setting up a dynamic connection to Word, Word will have to be running - which almost implies a Windows box. Whether the COM component/add-on to PHP (also?) demands a Windows box, I can't say. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Searching Documents
I did get a reply regarding searching Word documents, and one person said that if Word uses an ASCII format, then use the regex function.. She tried it, and it worked..so who knows! Now I got to figure out how to use it... geez -Original Message- From: Shrock, Court [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 1:51 PM To: 'DL Neil'; Todd Williamsen Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Re: Searching Documents If running meant at the process level and not just installed, then word does not have to be running.COM creates the appropriate instances of whatever is requested via COM. But yes, Word does have to be installed. However, wonder what the wine project could afford this discussion? Maybe you could do it on a 'nix afterall?! -Original Message- I assume if you are setting up a dynamic connection to Word, Word will have to be running - which almost implies a Windows box. Whether the COM component/add-on to PHP (also?) demands a Windows box, I can't say. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] multiple query string
Help! I'm designing a search page and I need to keep the search variable alive even after i refresh the page, I'm already using a string in the url and I can't register a global variable because that would limit the search page to one user at a time. How can I get the search string back into the pag? Any Ideas. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] multiple query string
cookies -Original Message- From: Renaldo De Silva [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 2:08 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] multiple query string Help! I'm designing a search page and I need to keep the search variable alive even after i refresh the page, I'm already using a string in the url and I can't register a global variable because that would limit the search page to one user at a time. How can I get the search string back into the pag? Any Ideas. -- 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] multiple query string
isn't there any other way? Rick Emery wrote: cookies -Original Message- From: Renaldo De Silva [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 2:08 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] multiple query string Help! I'm designing a search page and I need to keep the search variable alive even after i refresh the page, I'm already using a string in the url and I can't register a global variable because that would limit the search page to one user at a time. How can I get the search string back into the pag? Any Ideas. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] multiple query string
sessions -Original Message- From: Renaldo De Silva [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 2:10 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] multiple query string isn't there any other way? Rick Emery wrote: cookies -Original Message- From: Renaldo De Silva [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 2:08 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] multiple query string Help! I'm designing a search page and I need to keep the search variable alive even after i refresh the page, I'm already using a string in the url and I can't register a global variable because that would limit the search page to one user at a time. How can I get the search string back into the pag? Any Ideas. -- 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] How to Upload
How can I use PHP to upload a file from a client computer? -- Ashraf Al Shafaki ICQ me at 144936414 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] multiple query string
That's the same as cookies, isn't it you have to either store the id in a cookie or at the end of the url I can't store it at the end of the url and i don't want to use cookies. Rick Emery wrote: sessions -Original Message- From: Renaldo De Silva [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 2:10 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] multiple query string isn't there any other way? Rick Emery wrote: cookies -Original Message- From: Renaldo De Silva [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 2:08 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] multiple query string Help! I'm designing a search page and I need to keep the search variable alive even after i refresh the page, I'm already using a string in the url and I can't register a global variable because that would limit the search page to one user at a time. How can I get the search string back into the pag? Any Ideas. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Word dosen't save as ascii text
word dosen't use ascii text, ascii text dosen't support formatting so if you convert your resume's into ascii text you loose all formating. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] multiple query string
Could you make it a hidden value in a form? -Original Message- From: Renaldo De Silva [SMTP:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 3:15 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] multiple query string That's the same as cookies, isn't it you have to either store the id in a cookie or at the end of the url I can't store it at the end of the url and i don't want to use cookies. Rick Emery wrote: sessions -Original Message- From: Renaldo De Silva [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 2:10 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] multiple query string isn't there any other way? Rick Emery wrote: cookies -Original Message- From: Renaldo De Silva [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 2:08 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] multiple query string Help! I'm designing a search page and I need to keep the search variable alive even after i refresh the page, I'm already using a string in the url and I can't register a global variable because that would limit the search page to one user at a time. How can I get the search string back into the pag? Any Ideas. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: How To Upload
Heres a form and the PHP behind it I use: ---FORM--- HTML HEAD TITLEAdd Pic/TITLE /HEAD BODY BGCOLOR=#FF TEXT=#00 LINK=#FF VLINK=#800080 form enctype=multipart/form-data action=addpic.php method=post input type=hidden value=$com_num name=com_num Pic to Upload(Only .jpg and .gif files) pinput name=userfile type=file input type=submit value=Send File /form /BODY /HTML ---PHP FILE--- ?PHP if (is_uploaded_file($userfile)) { copy($userfile, location/filename.xxx); }} else { echo That diddn't work!; } header (Location: http://www.underfoot.cc/;); ? I do much more with it (resize and edit images etc etc) but thats the basic layout... -Jonathan
[PHP-DB] PHP CGI Problems.....
I am trying to put PHP into a template HTML document that is used by a CGI script. The PHP script isn't working at all - and even when I put some generic line of PHP (an echo), it doesn't turn out. Could the CGI be causing this? Is it possible to compile PHP to allow it in CGI files? Thanks, -Mike -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Double spacing e-mail content..
I have set up a php form that allows me to fill in the information and then it e-mails the information to the specified e-mail address. On the second step the informatioin is poseted to the screen so I can see exactly what the e-mail is going to look like. The problem I am having is that the content within the e-mail is getting double spaced. I thought I had this fiqured out when I sent it to a dirrerent e-mail address and it appeard to be fine with no double spacing. So my conclusiion was that it must be how it is getting parsed. Now all of the sudden it is double spacing only the bottom half of the e-mail with the top o.k... Thoughts..Ideas...Suggestions?? I have three pages in my program these are.. generalForm.html - Form to be filled in. emailBody.html - the file that contains all the verbage with varibles that are filled in with the forms submissioin values. createEmail.php - This file first posts the e-mail to the screen with a submit button that allows you to send the e-mail if everything appears to be correct. Thx Troy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Table Relationships
In databases, after creating a number of tables, one could usually set relationships (or some call it relations) between these tables, by tying some reference number in one table with the id (or index) in another table for example, or just making any other kinds of relationships between tables for any other reason. I used to do relationships between tables when I used Microsoft Access. My question is: Does MySQL enable you to create relationships between tables after you create the tables? If so, how (what are the commands from the command prompt?) -- Ashraf Al Shafaki ICQ me at 144936414 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Creating temp table with data out of 2 tables possible?
Hi there, how is it possible to copy rows from more then one table into a temporary table? I have 250 city tables named after the country e.g: ca_cities. Now the user has choosen stuff from lets say ca and gm. I want to collect the data into a temp table and then querry this temp table for other stuff. I always get the error: Error: 1060 Duplicate column name 'id' Here is my statement made for a sample of two tables creating the temporary one ( works with one) $stmt = CREATE TEMPORARY TABLE all_cities SELECT * FROM $DB2.$country_found[0]_cities, $DB2.$country_found[1]_cities ; Does anybody have a clue whats going on here? Thanx for any help Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Table Relationships
Hi there. You bet you can have relationships between tables! You accomplish this by setting primary keys and foreign keys when you create you tables. When you assign a unique identifier to a table not only do you assign a name such as employeeid for example, you also have to set it as the primary key. Here's a link to the mysql website: http://www.mysql.com/doc/C/R/CREATE_TABLE.html Notice the primary option beside the auto_increment option, you'll no doubt need to use that as well to ensure you create the proper relationships between entities. Hope this helps you out, Joe:) raf Al Shafaki [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... In databases, after creating a number of tables, one could usually set relationships (or some call it relations) between these tables, by tying some reference number in one table with the id (or index) in another table for example, or just making any other kinds of relationships between tables for any other reason. I used to do relationships between tables when I used Microsoft Access. My question is: Does MySQL enable you to create relationships between tables after you create the tables? If so, how (what are the commands from the command prompt?) -- Ashraf Al Shafaki ICQ me at 144936414 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Calculate a value during the SQL command
I know I could very easily do this after doing the initial database call simply by calculating the two variables, but, I was wondering if there was a way to do this during the sql statement so my results would already have my answer... Here's the setup. I have two tables. Table A has the information about a mailing. Table B has an individual record for each click generated by the e-mail. They look like this: TableA ID // unique identifier mail_date mail_qty // shows how many mails were sent TableB ID // unique identifier mail_ID // matches up with the ID in Table A mem_ID // the member's unique code Here is what I thought was going to work (but didn't): SELECT mail_date, mail_qty, count(*) as clicks, ((clicks / mail_qty)*100) as percentage FROM TableA, TableB WHERE mail_ID = TableA.ID GROUP BY mail_ID What I was hoping to get back was something like this: | mail_date | mail_qty | clicks | percentage | | 2001-02-05 | 1000 | 100 | 10 | If I need to do this the long way, it's not a huge deal, but, I thought this may be something I could do... I hope I explained that good enough. Thanks for your help! __ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Calculate a value during the SQL command
John, I know I could very easily do this after doing the initial database call simply by calculating the two variables, but, I was wondering if there was a way to do this during the sql statement so my results would already have my answer... Here's the setup. I have two tables. Table A has the information about a mailing. Table B has an individual record for each click generated by the e-mail. They look like this: TableA ID // unique identifier mail_date mail_qty // shows how many mails were sent TableB ID // unique identifier mail_ID // matches up with the ID in Table A mem_ID // the member's unique code Here is what I thought was going to work (but didn't): SELECT mail_date, mail_qty, count(*) as clicks, ((clicks / mail_qty)*100) as percentage FROM TableA, TableB WHERE mail_ID = TableA.ID GROUP BY mail_ID What I was hoping to get back was something like this: | mail_date | mail_qty | clicks | percentage | | 2001-02-05 | 1000 | 100 | 10 | If I need to do this the long way, it's not a huge deal, but, I thought this may be something I could do... I hope I explained that good enough. Thanks for your help! If the clicks is removed from the formula, and replaced with count(*) does that solve the problem? Let us know! =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Calculate a value during the SQL command
Now why didn't I try that??? Thanks for your help. Worked like a charm! John --- DL Neil [EMAIL PROTECTED] wrote: John, I know I could very easily do this after doing the initial database call simply by calculating the two variables, but, I was wondering if there was a way to do this during the sql statement so my results would already have my answer... Here's the setup. I have two tables. Table A has the information about a mailing. Table B has an individual record for each click generated by the e-mail. They look like this: TableA ID // unique identifier mail_date mail_qty // shows how many mails were sent TableB ID // unique identifier mail_ID // matches up with the ID in Table A mem_ID // the member's unique code Here is what I thought was going to work (but didn't): SELECT mail_date, mail_qty, count(*) as clicks, ((clicks / mail_qty)*100) as percentage FROM TableA, TableB WHERE mail_ID = TableA.ID GROUP BY mail_ID What I was hoping to get back was something like this: | mail_date | mail_qty | clicks | percentage | | 2001-02-05 | 1000 | 100 | 10 | If I need to do this the long way, it's not a huge deal, but, I thought this may be something I could do... I hope I explained that good enough. Thanks for your help! If the clicks is removed from the formula, and replaced with count(*) does that solve the problem? Let us know! =dn __ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Exact String replace with eregi_replace()
Hi there, Please help me out in the following... ?php $is='is'; echo eregi_replace( .$is. , ,This is a test string which contains is in dismissal); ? Actually I want to replace is alone from the string and not all the words that contains is... I have tried with ^.$is.$ --- but yields nothing thanks and regards, Desikan On Fri, 8 Feb 2002 08:52:10 -0600 , Rick Emery [EMAIL PROTECTED] said: To get is alone, use is -Original Message- From: Desikan [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 8:51 AM To: Rick Emery Subject: RE: [PHP-DB] Exact String replace with eregi_replace() hi there, Actually ^string$ represents the exact match of the string alone, and not words containg that sring... thanks Desikan On Fri, 8 Feb 2002 08:46:32 -0600 , Rick Emery [EMAIL PROTECTED] said: First, the example you give will replace is with , if is is the ONLY work in the line. You indicate this with the ^$ construct. Are you trying to replace only the first occurrence if is? -Original Message- From: Desikan [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 6:42 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Exact String replace with eregi_replace() hi I'm trying to replace the exact match of 'is' with ','.. But all the matches of 'is' in the string gets replaced how can i avoid this??? ?php echo ereg_replace (^is$, ,, This is a dismissal of windows based technology); ? rgds, Desikan -- Desikan [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Desikan [EMAIL PROTECTED] -- Desikan [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Exact String replace with eregi_replace()
on 2/8/02 9:05 PM, Desikan at [EMAIL PROTECTED] appended the following bits to my mbox: Actually I want to replace is alone from the string and not all the words that contains is... I have tried with ^.$is.$ --- but yields nothing This kind of question really belongs on the PHP General List, since it isn't db related. That said, look at the preg_replace function: http://www.php.net/manual/en/function.preg-replace.php And use the \b escape in your search string: http://www.php.net/manual/en/pcre.pattern.syntax.php Paul ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] option in forms
I know how to do the option call e.g. This is the list of artists already in our database : SELECT name=artist ?php echo $option_block; ? /SELECT But I want to do a form where they select the option then fill out rest of form. The option above returns the artist name, but I want to insert the artistid. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Maintain MySQL Transactions
Hi, How can I maintain MySQL transactions with PHP Best Regards Hayan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Session End
Hi, How can I realize that one session in PHP has been ended, I mean I want a trigger that the visitor of my website, has left ;) Thanks Best Regards Hayan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php