php-general Digest 6 Oct 2002 20:00:00 -0000 Issue 1628
Topics (messages 118984 through 119012): How to connect Web database 118984 by: Vinod Bhaskar 118986 by: Intruder How to connect Web Database from local machine 118985 by: Vinod Bhaskar 118996 by: John W. Holmes sessions without cookies *or* URLs 118987 by: David T-G 118990 by: Justin French Using date() function 118988 by: Davy Obdam 118989 by: nicos.php.net 118992 by: Davy Obdam 118994 by: . Edwin 118995 by: John W. Holmes mysql_fetch_row() problem 118991 by: tony.tabzilla.com 118993 by: Intruder Re: MySQL>Limit size 118997 by: John W. Holmes 118998 by: Christian Ista 118999 by: John W. Holmes Re: [PHP-WIN] RE: [PHP] Re: Using date() function 119000 by: Davy Obdam 119001 by: John W. Holmes Re: Mysqldump 119002 by: Paul Nicholson working with pspell 119003 by: Andy 119006 by: Lowell Allen Re: access denied 119004 by: Simon Angell Re: Quick question. 119005 by: Simon Angell Can it be Done? 119007 by: Stephen 119008 by: Sascha Cunz 119009 by: . Edwin 119012 by: Adriano Re: after mysqlfront? 119010 by: John W. Holmes formatting / beautifying PHP code 119011 by: Andrew Ziem Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] ----------------------------------------------------------------------
--- Begin Message ---Hi Friends, I am having a local MySQL database & tables in Linux and the data is updated in the table using PHP scripts working through apache web server. local MySQL database is connected using the following php scripts. mysql_connect("localhost","root","vinodb") or die ("cannot connect to mysqld"); mysql_select_db("lnnet") or die("cannot select database"); I have created same database and tables which is available locally on web which is having MySQL & PHP support. Now I want to update the web database from the local database using php scripts. How do I connect web database and local database simultaneously. I will be grateful, if any body can mail me the connecting scripts, so that I can write php scripts to update the records from local database. or can any body suggest a solution on how to update the tables. Regards, Vinod.--- End Message ---
--- Begin Message ---You have to use mysqldump utility to make script, then you can put it into your PHP script and run that script: <?php $sql = "<PRODUCED SCRIPT BODY GOES HERE>"; mysql_query($sql); ?> or just dump your database directly to remote server by running mysqldump with parameters Host and some other. The only difficulty could be, that remote provider could reject all emote connections :(( the third way is to place PHP script on remote mashine and to connect to your local MySQL server and just make some SELECT-INSERT. Here you can have the same problem as in previous: proveder can reject all connection aoutside their box :(((--- End Message ---
--- Begin Message ---Hi all, I am having MySQL database on web. (eg., at www.lmcr.net). What is the PHP script which I can connect the MySQL table from my Local machine. Can anybody help me. Regards, Vinod.--- End Message ---
--- Begin Message ---> I am having MySQL database on web. (eg., at www.lmcr.net). What is the PHP > script which I can connect the MySQL table from my Local machine. Can > anybody help me. Well, most hosting companies do not allow remote access to the MySQL server, but if you're does, then you connect the same way as usual... $link_id = mysql_connect("mysql.yourdomain.com","user","password"); You just pass the IP or name of your MySQL server in the mysql_connect function. To also connect to your local database, just use $link_id2 = mysql_connect("localhost","user","password"); And then you have a connection to each one open. Be sure to use the appropriate $link_id in your queries. ---John Holmes...--- End Message ---
--- Begin Message ---Hi, all -- I've seen a recent flurry of discussion on sessions, and that's good; lovely how that has shown up just as I need to dig into sessions. I think I've come to understand, though, that you can't manage sessions without either URL extensions or cookies, and that's bad (for me, at least). Is that a correct understanding? It seems that using forms to pass the session token would work, but that means having all buttons instead of links, which has its own disadvantages. Is there any other way to get data to the server? We currently use the URL to pass variables but we don't want to hang the page password out there :-) and so we have to maove away from that somehow, and it would be nice if we could get away from URL mangling entirely. Cookies aren't an option, though. TIA & HAND :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!--- End Message ---
msg81288/pgp00000.pgp
Description: PGP signature
--- Begin Message ---I think you're under a little misconception about how sessions are used. Maintaining a session is simply just having a unique identifier for each "user", so that the server can recognise the user from page to page, maintaining state. Typically this is done by passing a session id around in he URL or cookies or POSTing forms. A session ID is typically a long unique number -- that's it. What you then do associate or register data TO that Session ID... this data is stored on the SERVER, and NOT passed around in the URL. So you pass around PHPSESSID=198235021612423 in the url or a cookie, and assign data to that session... all of which is stored server side. The session with the id 198235021612423 may have a username, password, shoe size, favourite colour, etc etc all attached to it, done with either: $_SESSION['shoesize'] = "14"; // new register globals OFF method or $shoesize = "14"; session_register("shoesize"); // old method Therefor, I can see no need for anything other than the session ID to be passed around in the URL. Hope this clears it up! Justin French on 06/10/02 9:26 PM, David T-G ([EMAIL PROTECTED]) wrote: > Hi, all -- > > I've seen a recent flurry of discussion on sessions, and that's good; > lovely how that has shown up just as I need to dig into sessions. I > think I've come to understand, though, that you can't manage sessions > without either URL extensions or cookies, and that's bad (for me, at > least). > > Is that a correct understanding? It seems that using forms to pass the > session token would work, but that means having all buttons instead of > links, which has its own disadvantages. Is there any other way to get > data to the server? > > We currently use the URL to pass variables but we don't want to hang the > page password out there :-) and so we have to maove away from that somehow, > and it would be nice if we could get away from URL mangling entirely. > Cookies aren't an option, though. > > > TIA & HAND > > :-D--- End Message ---
--- Begin Message ---Hi people I have a guestbook, and i need to convert the date and time from the database into a normal readable date.. Like Sunday, 6 october 2002 13:30:00. I thought i could use the date() function here. I have done this: $entry_date = date('l, d F Y H:i:s','$sql["date"]'); echo $entry_date; But then i dont get the date i need. It says Thursday, 01 January 1970 01:00:00 (i wasn`t even born then;-), so it wasn`t me signing that guestbook. Any sugestions what i am doing wrong. Thanks for your time. Best regards, Davy Obdam, mailto:[EMAIL PROTECTED]--- End Message ---
--- Begin Message ---First you should use : $entry_date = date('l, d F Y H:i:s',$sql['date']); And $sql['date'] must be a TIMESTAMP. -- Nicos - CHAILLAN Nicolas [EMAIL PROTECTED] www.WorldAKT.com - Hébergement de sites Internet "Davy Obdam" <[EMAIL PROTECTED]> a écrit dans le message de news: 001601c26d2c$e5391ff0$[EMAIL PROTECTED] > Hi people > > I have a guestbook, and i need to convert the date and time from the > database into a normal readable date.. Like Sunday, 6 october 2002 > 13:30:00. I thought i could use the date() function here. I have done > this: > > $entry_date = date('l, d F Y H:i:s','$sql["date"]'); > echo $entry_date; > > But then i dont get the date i need. It says Thursday, 01 January 1970 > 01:00:00 (i wasn`t even born then;-), so it wasn`t me signing that > guestbook. Any sugestions what i am doing wrong. Thanks for your time. > > Best regards, > > Davy Obdam, > mailto:[EMAIL PROTECTED] > >--- End Message ---
--- Begin Message ---Hi Nicos, Using $entry_date = date('l, d F Y H:i:s',$sql['date']); now gives me back Tuesday, 19 January 2038 04:14:07 with ever entry. $sql['date'] is a TIMESTAMP and looks like this 20021006141256 in the datebase. It should give me Sunday, 06 October 2002 14:12:56..? Wierd eh? Do u know a solution? Best regards, Davy Obdam, mailto:[EMAIL PROTECTED] -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Sunday, October 06, 2002 1:59 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP] Re: Using date() function First you should use : $entry_date = date('l, d F Y H:i:s',$sql['date']); And $sql['date'] must be a TIMESTAMP. -- Nicos - CHAILLAN Nicolas [EMAIL PROTECTED] www.WorldAKT.com - Hébergement de sites Internet--- End Message ---
--- Begin Message ---Hello, Why not just do it in your sql query? If you're using MySQL perhaps this page would be helpful: http://www.mysql.com/doc/en/Date_and_time_functions.html Just an idea... - E On Sunday, October 6, 2002 10:01 PM Davy Obdam wrote: > Hi people > > I have a guestbook, and i need to convert the date and time from the > database into a normal readable date.. Like Sunday, 6 october 2002 > 13:30:00. I thought i could use the date() function here. I have done > this: > > $entry_date = date('l, d F Y H:i:s','$sql["date"]'); > echo $entry_date; > > But then i dont get the date i need. It says Thursday, 01 January 1970 > 01:00:00 (i wasn`t even born then;-), so it wasn`t me signing that > guestbook. Any sugestions what i am doing wrong. Thanks for your time. > > Best regards, > > Davy Obdam, > mailto:[EMAIL PROTECTED] > >--- End Message ---
--- Begin Message ---> Using $entry_date = date('l, d F Y H:i:s',$sql['date']); now gives me > back Tuesday, 19 January 2038 04:14:07 with ever entry. $sql['date'] is > a TIMESTAMP and looks like this 20021006141256 in the datebase. It > should give me Sunday, 06 October 2002 14:12:56..? Wierd eh? Do u know a > solution? No, not weird. MySQL uses a timestamp in the YYYYMMDDHHMMSS format. Date() is expecting a UNIX timestamp, which is the number of seconds since Jan 1, 1970. So... you can either use DATE_FORMAT() in your query, with is the MySQL equivalent of date(). Look up the format in the manual. Or, you can use UNIX_TIMESTAMP() in your query to select out the unix timestamp instead of the mysql timestamp, and then use that value within date() in your PHP script. ---John Holmes...--- End Message ---
--- Begin Message ---I have this small bit of code to fetch the latest songs submitted by a user on theire profile for my tab website, here is the code: <?php $get_songs = mysql_query("SELECT `id`,`title`,`artist_id`,`type` FROM `resources` WHERE `user_id` = '$id' ORDER BY `rating` LIMIT 0,10"); ?> <table border="0" cellpadding="1"><tr><td><B>10 Latest Songs Submited by <?php echo($profile_array[0]); ?></b></td><td></td><td></td></tr> <?php for ($i = 0; $i < mysql_num_rows($get_songs); $i ++) { $latsongs = mysql_fetch_row($get_songs); $get_anames = mysql_query("SELECT `name` FROM `artists` WHERE `artist_id` = '$id'"); $anames = mysql_fetch_row($get_names); // !!! ERROR LINE !!! echo("<tr><td><a href=\"view.php?id=$latsongs[0]\">$latsongs[1]</a></td><td><a href=\"artist.php?id=$latsongs[2]\">$anames[0]</a></td><td>($latsongs[3])</t d></tr>"); } ?> The problem is with the line i labelled !!! ERROR LINE !!!, to fetch the artist name. The error returned is: Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/tabzilla/public_html/profile.php on line 115 You can see the complete page at http://www.tabzilla.com/profile.php?id=3--- End Message ---
--- Begin Message ---ttc> $get_anames = mysql_query("SELECT `name` FROM `artists` WHERE `artist_id` = ttc> '$id'"); ttc> $anames = mysql_fetch_row($get_names); // !!! ERROR LINE !!! of course it is an error! check your spelling !!! $get_names != $get_anames ;))))--- End Message ---
--- Begin Message ---> I have a form with a textarea. When I put a long text(one word page for > example), when I submit, the form is not submitted. I have to remove > some line to submit. I don't have any limit in the textarea. The content > of this form is sorted in a MySQL database. I tried to set the field > where the textarea will be stored to LONGTEXt or LONGBLOB but I have all > the time the same problem. Are you using POST or GET for your form? Show some code... ---John Holmes...--- End Message ---
--- Begin Message ---> Are you using POST or GET for your form? Show some code... I use get. But I tried to post and look ok. Why this difference ? Christian,--- End Message ---
--- Begin Message ---> > Are you using POST or GET for your form? Show some code... > > I use get. But I tried to post and look ok. Why this difference ? > > Christian, > You can only send so much data through GET, because the URL is limited as to how long it can be. It may be different for each browser, but I think it's usually 1024 characters. There is no limit with POST. ---John Holmes...--- End Message ---
--- Begin Message ---Hi John, How do u use UNIX_TIMESTAMP or DATE_FORMAT in your query. My query now looks like this: "SELECT * FROM guestbook2002 ORDER BY entryID DESC LIMIT $entry, $show"; Can u help me;-) Thanks for your time Best regards, Davy Obdam, mailto:[EMAIL PROTECTED] -----Original Message----- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Sunday, October 06, 2002 3:31 PM To: 'Davy Obdam'; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-WIN] RE: [PHP] Re: Using date() function > Using $entry_date = date('l, d F Y H:i:s',$sql['date']); now gives me > back Tuesday, 19 January 2038 04:14:07 with ever entry. $sql['date'] is > a TIMESTAMP and looks like this 20021006141256 in the datebase. It > should give me Sunday, 06 October 2002 14:12:56..? Wierd eh? Do u know a > solution? No, not weird. MySQL uses a timestamp in the YYYYMMDDHHMMSS format. Date() is expecting a UNIX timestamp, which is the number of seconds since Jan 1, 1970. So... you can either use DATE_FORMAT() in your query, with is the MySQL equivalent of date(). Look up the format in the manual. Or, you can use UNIX_TIMESTAMP() in your query to select out the unix timestamp instead of the mysql timestamp, and then use that value within date() in your PHP script. ---John Holmes... -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php--- End Message ---
--- Begin Message ---> Hi John, > > How do u use UNIX_TIMESTAMP or DATE_FORMAT in your query. My query now > looks like this: > > "SELECT * FROM guestbook2002 ORDER BY entryID DESC LIMIT $entry, $show"; > > Can u help me;-) Thanks for your time Did you read the Date and Time Functions chapter of the MySQL manual?? SELECT UNIX_TIMESTAMP(your_timestamp_column) AS alias FROM your_table ... SELECT DATE_FORMAT(column,'<format>'), column2, column3, etc FROM yourtable ... You have to name the columns and not use * in your query. You'll also want to read up on the AS alias, if you don't know what that is. ---John Holmes...--- End Message ---
--- Begin Message --------BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hey, I'm not sure about windows machines as I use linux but it looks like you're sending the right commands. You need to check your permissions. ~Paul On Sunday 06 October 2002 12:30 am, Uma Shankari T. wrote: > Hello, > > I am trying to dump the text file contents to mysql which was already > backup from mysql only..While trying to dump it is telling access denied > error > > i am trying from here > > d:\mysql\bin>mysqldump databasename txt.file name > > Can anyone tell me how to go about with this ?? > > Regards, > Uma - -- ~Paul Nicholson Design Specialist @ WebPower Design "The web....the way you want it!" [EMAIL PROTECTED] "It said uses Windows 98 or better, so I loaded Linux!" Registered Linux User #183202 using Register Linux System # 81891 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9oFpTDyXNIUN3+UQRAq7wAJ97jRHEUq/oQivyZzHD22wpQegbZwCdGeTl Sux8I5NCDdbJk9lstKeKsr8= =dwjM -----END PGP SIGNATURE-------- End Message ---
--- Begin Message ---Hi everybody, I just installed pspell and would like to get behind of the whole concept of spellchecking with php. As far as I understand, I have to check it word by word. Is there an algorithm which allowes to give a sentence to check and highlight all the words mispelled. On clickin the mispelled word to open a popup with suggestions and by clicking on the proper word to automaticly replace the wrong word. This sounds very complicated. Has anybody a good suggestion, or article to recommend on this topic? Thanx for your help, Andy--- End Message ---
--- Begin Message ---> From: "Andy" <[EMAIL PROTECTED]> > > I just installed pspell and would like to get behind of the whole concept of > spellchecking with php. > > As far as I understand, I have to check it word by word. Is there an > algorithm which allowes to give a sentence to check and highlight all the > words mispelled. On clickin the mispelled word to open a popup with > suggestions and by clicking on the proper word to automaticly replace the > wrong word. > > This sounds very complicated. Has anybody a good suggestion, or article to > recommend on this topic? > I'm currently doing a spell checker, and found this article very helpful: <http://www.zend.com/zend/spotlight/spellchecking.php>. -- Lowell Allen--- End Message ---
--- Begin Message ---I don't know exactly what shell access is, but in my quest to do what i was trying to do, i realised its not worth it due to the fact the file i was copying was still being accessed everytime the php file was open, and my aim was to get the particular file from the remote server, copy it onto my server 2 times a day and then the php file that im working on would access the local file instead of the remote file which its doing now, Anyways, thanx for all your help -- Cheers --------------------------------------------------------- Simon Angell Canberra ACT www.canberra-wx.com --------------------------------------------------------- Member of: Australian Severe Weather Association. www.severeweather.asn.au --------------------------------------------------------- This email is virus free. Scanned before leaving my mailbox using Norton Antivirus 2002 for Win2k Scanned with the latest definition File.--- End Message ---
--- Begin Message ---Hi, sorry about the delay, i have some computer problems in the last few days, all fixed now i hope. I don't know exactly what shell access is, or ssh for that matter, but in my quest to do what i was trying to do, I realised its not worth it due to the fact the file i was copying was still being accessed everytime the php file was open, and my aim was to get the particular file from the remote server, copy it onto my server 2 times a day and then the php file that im working on would access the local file instead of the remote file which its doing now, Anyways, thanx for all your help -- Cheers --------------------------------------------------------- Simon Angell Canberra ACT www.canberra-wx.com --------------------------------------------------------- Member of: Australian Severe Weather Association. www.severeweather.asn.au --------------------------------------------------------- This email is virus free. Scanned before leaving my mailbox using Norton Antivirus 2002 for Win2k Scanned with the latest definition File.--- End Message ---
--- Begin Message ---Hello, I was wondering if what I want to do is possible. I have a website that uses iframes and sometimes the search engines pick up the file that's displayed in the iframe. That file jsut plain looks really bad but in the site itself and displayed in the iframe it looks a whole lot better. What I want to be able to do is this. If the file is being displayed just plain, not in the iframe, it forwards to the main site and then displays the file in the iframe. But then, if the file is already being displayed in the iframe, it doesn't do anything. Can this be done and how? Thanks, Stephen Craton--- End Message ---
--- Begin Message ---Hi, i don't think you can do this all on Server-side. I once made things like that work with usual frames. I used Javascript in each page of the frameset to find out if the "parent" exists - and if not, redirect to the frameset which itself was a PHP script whom i told to load the current page in correct frames. I don't know if that's also posibile with iframes. Anyway, you need to do two steps: 1. You must be able to view the outer page with a parameter, which tells it what Site is to be viewed inside the iframe. 2. Some sort of JavaScript wich redirects to the outer page. Tha JavaScript must live inside each site that might show up inside the iframe. Regards Sascha Am Sonntag, 6. Oktober 2002 18:29 schrieb Stephen: > Hello, > > I was wondering if what I want to do is possible. I have a website that > uses iframes and sometimes the search engines pick up the file that's > displayed in the iframe. That file jsut plain looks really bad but in the > site itself and displayed in the iframe it looks a whole lot better. > > What I want to be able to do is this. If the file is being displayed just > plain, not in the iframe, it forwards to the main site and then displays > the file in the iframe. But then, if the file is already being displayed in > the iframe, it doesn't do anything. Can this be done and how? > > Thanks, > Stephen Craton--- End Message ---
--- Begin Message ---'Not really sure, but perhaps, with Javascript. But I'd rather recommend you to give up iframes... ;) - E On Monday, October 7, 2002 1:29 AM Stephen wrote: > Hello, > > I was wondering if what I want to do is possible. I have a website that uses iframes >and sometimes the search engines pick up the file that's displayed in the iframe. >That file jsut plain looks really bad but in the site itself and displayed in the >iframe it looks a whole lot better. > > What I want to be able to do is this. If the file is being displayed just plain, not >in the iframe, it forwards to the main site and then displays the file in the iframe. >But then, if the file is already being displayed in the iframe, it doesn't do >anything. Can this be done and how? > > Thanks, > Stephen Craton--- End Message ---
--- Begin Message ---Hi people, @ Edwin wrore: > 'Not really sure, but perhaps, with Javascript. > > But I'd rather recommend you to give up iframes... ;) > Can you post an example of Javascript code checking for _parent frame? By the way, what's wrong with iframes? bye, Adr--- End Message ---
--- Begin Message ---> DB tools (getting better every version) > http://www.dbtools.com.br/EN/ Let's hope so, because the version I just downloaded would always crash whenever you tried to set up a new connection.... Mascon seems to be a very good project and far more features than MySQL-Front. And I'm a big fan of MySQL-Front... ---John Holmes...--- End Message ---
--- Begin Message ---Is there a utility that formats / beautifies PHP code like indent does for C code? -- Andrew Ziem Is Jesus Your Answer? http://www.ChristianAnswers.net/gospel--- End Message ---