[PHP-DB] error handling with ms sql server (mssql) - insert and update unique indexes
sorry for posting this mail twice, but the first one doesn't appear on the news server (posting with google, doesn't work...) Hi, when I insert a new record with a unique indexed attribute, which is already in the table, I only get some php warnings: Warning: MS SQL message: Cannot insert duplicate key row in object 'user_profile' with unique index 'nickname'. (severity 14) in c:\web\register\register.php on line 81 Warning: MS SQL: Query failed in c:\web\register\register.php on line 81 I want to identify the error and do some special php functions. Unfortunately I don't get any message with mssql_get_last_message() and SELECT ERROR AS errorId always returns 0. changing the severity only gives different php warnings mssql_min_error_severity (0); mssql_min_message_severity (0); How do I fetch and handle INSERT INTO and UPDATE SET warnings. Is there any example on the internet? Thanks for your hints muhe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] htdig interface class
http://phpclasses.promoxy.com/browse.html/package/26.html Anyone tried this package - successfully? I have only been able to pull up No results. I spent the past 10 hours trying to find/write a wrapper for htdig that will call htsearch mutliple times with different options (specifically limit_urls_to and restrict) to emulate results in categories. If anyone could point me to potential hangups - I would sure appreciate it. Thanks much, olinux __ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] scope of variables in php script
im accepting input using form (method post). the variables which are passed thru post method are available in the file whitch i specify for action. but i want those variables in other file. how to make them global to be accessed from any file?? thnx and regds, smita _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Reload the page without losing variables
Hi. I have a little problem concerning passing variables or reloading the page. I have a search fom page (search.php) which POSTS some variables to another page displaying the results (results.php). What I want to do is to let the users change the order of appearance in the last page. I thought I should use a variable named $order and put it into the select string like this: SELECT fields... FROM tables... WHERE expresions ORDER BY $order ASC and then make a link of the header of each column like this: a href=\results.php?order=HEADER_NAME\HEADER_NAME/a This would force the page to reload with a new order of appearance of the results but if I do this I will lose all the other variables that came to this page by the previous form. I wonder if there is a better way to refresh the page, without losing my variables, than using sessions or by sending again all my variables through the url (it would become too big and ugly...) With a great respect to this list (it has helped me alot in the past), Achilles
Re: [PHP-DB] scope of variables in php script
On Wednesday 28 August 2002 19:23, Smita Manohar wrote: im accepting input using form (method post). the variables which are passed thru post method are available in the file whitch i specify for action. but i want those variables in other file. how to make them global to be accessed from any file?? Please clarify what you mean by 'other file' and 'any file'. In the file which you specify the action for, any included files and required files will automatically be able to access the $_POST variables. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Concept, n.: Any idea for which an outside consultant billed you more than $25,000. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL Database Connection Error ?
i have a simple guest book script from a book by jay greenspan i think , when i run seems oikay i fill in the form and click submit, after submitting iam getting this error ? PHP Warning: Failed opening 'dbconnect.php' for inclusion (include_path='c:\php\includes') in c:\Inetpub\wwwroot\php\create_entry.php on line 5 PHP Notice: Undefined variable: submit in c:\Inetpub\wwwroot\php\create_entry.php on line 6 i had a look at the 'Include_path' in the php.ini file but it seemed oikay. i have Win98 runing PWS i checked it with the ? phpinfo() ? script and it works. here is the Exact Contense for the dbconnection.php file mysql_connect(localhost,richie,richie)or die (Could not connect to database); mysql_select_db(guestbook)or die (Could not select database); 'richie' is both my password and user, im a newbie to all this PHP stuff so if someone could please Explain to me how to get PHP to work with MySQL id be very grateful. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] how to display tree structure from database??? [ NEW VERSION]
adapted to your database ... for errors and more information .. let me know ? # Simple function 2 create an indentation according to the level/depth of the tree node function PrintNode ( $level , $text) { # função para imprimir um nó e fazer o indentamento if ( $level == 0 ) { return $textbr; } echo img src=\images/spacer.jpg\ width=\. 5 * $level . %\ height=\20\$textbr; } # Main function, to be called recursively function Parse_Tree ( $level=0, $parent=0 ) { $db = mysql_connect(localhost, root, password); mysql_select_db(mydb,$db); $sql = SELECT * FROM table WHERE parent_id=$parent ; $result = mysql_query($sql,$db); if ($result == false) die(failed); if ( mysql_num_rows($result) == 0 ) return 0 ; while ($fields = mysql_fetch_row($result)) { Print_Node( $level, . $fields[0] . . . $fields[1] . . . $fields[2] . ); Parse_Tree ( $level + 1 , $fields[0] ) ; # Check if the current node as childs and so on, recursively } return 0; } ? -Mensagem original- De: Smita Manohar [mailto:[EMAIL PROTECTED]] Enviada: terça-feira, 27 de Agosto de 2002 9:33 Para: [EMAIL PROTECTED] Assunto: [PHP-DB] how to display tree structure from database??? hiii im using php with mysql. i have one table for which i want to display tree structure. for eg. table is like this... person_id name parent_id 1 shyam 0 2 rohit 1 3 nikita 1 4 ram 0 5 ankit 4 6 jui 5 7 vicky 5 8 rekha 0 9 jay 6 10 kirti 8 i want help for writing query to display all topnodes, parent, their childern and grand children thnx and regards, smita _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- 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 Database Connection Error ?
On Wednesday 28 August 2002 20:48, R Strang wrote: i have a simple guest book script from a book by jay greenspan i think , when i run seems oikay i fill in the form and click submit, after submitting iam getting this error ? PHP Warning: Failed opening 'dbconnect.php' for inclusion It's looking for a file called 'dbconnect.php' ... here is the Exact Contense for the dbconnection.php file ... but you named the file 'dbconnection.php'? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* We can embody the truth, but we cannot know it. -- Yates */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Can subject in mail function be set in charset=big5?
I have sent an email using mail function in which the subject and email body have charset=big5 and they are generated by mysql statement. Customers with outlook express can read the big5 chinese characters without any trouble. However, people who read their emails from Lotus Notes complain that they cannot read the subject. But, they can read the email body because I have put $mailHeader=From: [EMAIL PROTECTED]\r\nContent-type: text/plain; charset=big5\r\n ; My mail statement looks like mail($mailTo, $mailSubject, $mailBody, $mailHeader) ; where $mailSubject and $mailHeader are both big5 char. Is there a way I can set $mailSubject charset=big5? Thanks for your help Ellen __ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] A Doubt
hi, I have a question. Hoping someone may help me out. Can a PHP page say file abcd.php access a variable $xyz which is used in another file mnop.php? I mean can I refer to a variable whose value has been set in some other file. The point is that the file mnop.php after finishing its query and on a particular case loads abcd.php. The reason is, I need to check everytime the file abcd.php is loaded, I should be able to determine that it was loaded by mnop.php and not by typing in the complete URL to abcd.php on the Web Browser. Hoping someone could tell me how if it is possible Best Regards, Manoj 'I have miles to go before I sleep, and promises to keep' -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] A Doubt
Hi, The reason is, I need to check everytime the file abcd.php is loaded, I should be able to determine that it was loaded by mnop.php If you include abcd.php in mnop.php $_SERVER['SCRIPT_NAME'] equals /mnop.php for both scripts. So you can test in abcd.php for this. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Date difference
hello how can i calculate the difference in days between 2 dates in SQL or PHP ?
[PHP-DB] Re: convert mysql table to Excell or Access file
Try the 'free' PC program called MySQL-Front from http://www.anse.de/mysqlfront/index.php It has a nice function for exporting to Excel. simon Alex Shi [EMAIL PROTECTED] skrev i meddelandet [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Can MySQL table be converted to Access or Excell format? Alex -- --- TrafficBuilder Network: http://www.bestadv.net/index.cfm?ref=7029 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] A Doubt
Hi Manoj, Your reply adrress seems to be wrong: - The following addresses had permanent fatal errors - [EMAIL PROTECTED] (reason: 553 sorry, your envelope sender is in my badmailfrom list (#5.7.1)) - Transcript of session follows - ... while talking to mail3.rediffmail.com.: RCPT To:[EMAIL PROTECTED] 553 sorry, your envelope sender is in my badmailfrom list (#5.7.1) 550 5.1.1 [EMAIL PROTECTED]... User unknown try out this main.php: ? include('include.php'); ? include.php: ? echo $_SERVER['SCRIPT_NAME']; ? Now run include.php directly outputted is: /include.php run main.php outputted is: /main.php Hope that helps? so in include.php, you can say: if($_SERVER['SCRIPT_NAME']!='/main.php') {echo 'forbidden to call the script direcly'; exit;} Op woensdag 28 augustus 2002 22:26, schreef u: hi bas, I am sorry but I could not follow what you meant by saying include abcd.php. I am a bit new to PHP and so I am bit slow to grasp the concepts. If I am not wrong, I understand that if by including a file the whole file is displayed in addition to the main file, i.e. if I include abcd.php in mnop.php the output would be mnop.php plus the the output of abcd.php, right? And could you explain what $_SERVER['SCRIPT_NAME'] equals /mnop.php for both scripts. means. Thanks for your help and patience. I appreciate that. Best Regards, Manoj. Op woensdag 28 augustus 2002 17:44, schreef Manoj Japher: hi, I have a question. Hoping someone may help me out. Can a PHP page say file abcd.php access a variable $xyz which is used in another file mnop.php? I mean can I refer to a variable whose value has been set in some other file. The point is that the file mnop.php after finishing its query and on a particular case loads abcd.php. The reason is, I need to check everytime the file abcd.php is loaded, I should be able to determine that it was loaded by mnop.php and not by typing in the complete URL to abcd.php on the Web Browser. Hoping someone could tell me how if it is possible Best Regards, Manoj 'I have miles to go before I sleep, and promises to keep' -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: htdig interface class
Hello, On 08/28/2002 06:35 AM, Olinux wrote: http://phpclasses.promoxy.com/browse.html/package/26.html Anyone tried this package - successfully? I have only been able to pull up No results. I spent the past 10 hours trying to find/write a wrapper for htdig that will call htsearch mutliple times with different options (specifically limit_urls_to and restrict) to emulate results in categories. If anyone could point me to potential hangups - I would sure appreciate it. Have you setup the configuration right first? Have you run the page indexing script? If you need further help, just let me know because I wrote that class. -- Regards, Manuel Lemos -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: convert mysql table to Excell or Access file
Hello, On 07/12/2002 07:36 PM, Alex Shi wrote: Can MySQL table be converted to Access or Excell format? Alex You may want to try this class that can write Excell files just with PHP, so it can run under Linux/Unix too: http://www.phpclasses.org/biffwriter -- Regards, Manuel Lemos -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] A Doubt
Hi Manoj, echo SCRIPT document.location = 'include.php' /SCRIPT ; I think i could also use: header('Location: include.php'); // you shouldn't print anything else before the header Now your flag thing. I the first place you could check $_SERVER['HTTP_REFERRER'] gives you the page the user came from. A other thing you could do is: 1) make een unique key ($key=md5(uniqid(rand(),1));) 2a) put that key in a session -- session_start(); $_SESSION['key']=$key; -- 2b)give it througt as flag header('Location: include.php?key='.$key); 3) Now you can do the check in your include: -- session_start(); if($_SESSION['key']!=$_GET[key]) {echo 'forbidden to call the script direcly'; exit;} -- This is saver the the referrer check but still not 100% proof. The savest way is to put all in one file. I will give you an example: Show the secret to evryone who filled in Manoj -- ? if(!empty($_POST['username'])) { if($_POST['username']!='manoj'){$message='wrong!!!';} else { ? html body Secret information in plain html /body /html ? exit; } } ? html body ? if(isset($message)){?p align='center'?=$message?/p?} ? form action=?=$_SERVER['PHP_SELF']? method=post username: input type=text name=username input type=submit value=show /form /body /html -- Notice: I haven't checked the code above. You can put the html in the else clause in an seperated file and use the script_name check discussed before. Best regards, Bas -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: htdig interface class
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... http://phpclasses.promoxy.com/browse.html/package/26.html Anyone tried this package - successfully? I have only been able to pull up No results. I spent the past 10 hours trying to find/write a wrapper for htdig that will call htsearch mutliple times with different options (specifically limit_urls_to and restrict) to emulate results in categories. If anyone could point me to potential hangups - I would sure appreciate it. Thanks much, olinux You might have a look through the source for php.net - last time I looked they were using HtDig as their search engine. Try this for a start point: http://php.net/source.php?url=/search.php -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] how to display tree structure from database???
Pierre-Alain Joye wrote: Hello, http://membres.lycos.fr/sqlpro/Tree/SQL_tree.htm provides a good way to store trees in a DB, docs are in french, nut sqlimages are universal. hth pa run this URL through the translator at http://babel.altavista.com and you have a 90-98% accurate translation. handy site to keep around... -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php