petr.pavel 19 Junior Poster

Hi Satimis,
that makes it more clear, thanks.

I'm still surprised though, that you believe that a RSS channel already exists for your website and you only have to discover where it is. It makes me believe that you didn't create your website from scratch (i.e. program your website) but used some canned CMS already. In other words, you installed some website content management software - not programmed it yourself.
If that is the case then please let me know its name and I'll check out if it has a RSS support or not.

Or perhaps I misunderstood. You wrote that you download news from other servers and display it on your website. Do you want your RSS channel to contain (a) this downloaded news or (b) articles of your own?
If (a) then you should ask the person who programmed the news download and display. He/she will have to program another script to display the same information in XML (which is RSS format).

Or (b), then again, you will need somebody who will program a script that takes your articles (from a database I presume) and display them in XML as a RSS channel.

Am I getting closer?

petr.pavel 19 Junior Poster

Hi Mexaros,
maybe you're linking to a remote site for web stats or some cool gadget.

I would probably search all files for "http". Internal links don't need to have http (use absolute or relative paths) so this search should discover external links.

You could also use an extension like Live HTTP headers (for Firefox)
https://addons.mozilla.org/cs/firefox/addon/3829
(there are tools that do the same for MSIE, just Google for HTTP headers MSIE)
By seeing what HTTP requests are being sent out you can track down that little bugger :-)

I'd also try using a different browser. Maybe it's something related to MSIE and Firefox will not want to connect. Then you have to look for MSIE related bugs.
Or your browser has a toolbar that wants to connect. Or your box is spyware infected.

Or perhaps your website sends out HTTP headers forbidding caching, or you use sessions (that send out headers implicitly), hard to tell.

Let me know if you made any progress.

petr.pavel 19 Junior Poster

Hi Satimis,
let me ask you a couple of questions first:
1) are you looking for a general way to find a RSS channel for any website?
There isn't any. It's the people who run the website who can create a RSS channel and make it available for their readers.
Also the RSS channel address differs from server to server.
E.g. RSS channel for http://www.ft.com/world/us is http://www.ft.com/rss/world/us
No .rss.php in the address.

2) or are you a web developer who runs ft.com and wants to write a script for RSS channel?
I quite doubt that because ft.com doesn't appear to be written in PHP and also, their programmers seem to know their stuff.

3) or do you want to be able to create a RSS channel for any website just for your own usage? Then ask Google for
create rss channel from any page
This might be promising:
http://www.masternewmedia.org/news/2006/03/09/how_to_create_a_rss.htm

Or are you after something else? Please give us more information.

petr.pavel 19 Junior Poster

Hi there,
2003 is "can't connect to MySQL server" right?

I don't think that just restoring the files did the magic - if you didn't previously delete them in the first place :-)
desktop.err is error log (your computer is called "desktop")
desktop.pid is socket number where MySQL is connected to (normally you shouldn't touch this file, restarting MySQL is better)

Did you try restarting the MySQL server when you got the 2003 error?
net stop MySQL
net start MySQL
(from Windows command line; or using Services console)

When you try starting the MySQL server and it won't start, have a look into the error file desktop.err it should tell you why. If there's nothing there then the problem might be Windows related in which case take a look into Windows Event Viewer / Applications.

I hope you kept the original desktop.err before you overwrote it with the backup copy. If you didn't then well, we're talking just academically here. ;-)

P.S.: This thread should be better off in Databases forum, not PHP. But let's finish it when we're here.

petr.pavel 19 Junior Poster

sorry,output is home/webs/public_html/profiles/9/BusinessProposal.doc

Mhm... I really doubt that.
The first error means that it cannot get file size for file:
http://www.website.com/profiles/resumes/158/llllll.doc
The file path is taken directly from the function call, so it is what you pass to the function.

But you claim that you call it with

mail_attachment(..., ..., ..., ..., '/home/webs/public_html/profiles/9/BusinessProposal.doc');

(path like this must start with /, you forgot about it in your post)

If I ignore the fact that profiles/resumes/158/llllll.doc plainly isn't profiles/9/BusinessProposal.doc, even then I don't believe you are giving me what you called the function with. I'm sure you think you do but then you most likely have a bug in the program that calls the function, not the function itself.
There is no silent translation from /home/... to http://....
Your script is passing http://... and not /home/...

Try creating a new file with only include and a function call like this:

mail_attachment('sender@pepa.info', 'petr.pavel@pepa.info', 'test subject', 'test body', '/home/webs/public_html/profiles/9/BusinessProposal.doc');

And double check that the file really exist.

I'll let you know if I receive the file. Also post error messages if you receive any.

petr.pavel 19 Junior Poster

Hi Lydia, I guess that you're calling mail_attachment() with wrong information in $attachment parameter.
You're passing url while it should be a full path in the server's file system.
E.g.
/var/www/vhosts/website.com/httpdocs/profiles/resumes/....
or
./profiles/resumes....
You have to find out yourself what the path is (I don't know where your calling script (not the library) is located.
In case relative path doesn't work and you need to use absolute path try out phpinfo() command.

If I'm wrong in my assumption then please post what are mail_attachment() parameters when you call it.

petr.pavel 19 Junior Poster

Ok, so what you want is to join two arrays?
then: array_merge()
I still don't get it. Let's say that your data is, for instance,

$musica = array("nazev"=>"Justice for all", "artist" => "Metallica");

and

$ciste = array("nazev"=>"Confession on the dance floor", "artist" => "Madonna");

then what do you expect $cd to be?
This?

$cd = array(
 0 => array("nazev"=>"Justice for all", "artist" => "Metallica"),
 1 => array("nazev"=>"Confession on the dance floor", "artist" => "Madonna")
);

then do $cd = array($musica, $ciste);
or this?

..."nazev" => "Justice for allConfession on the dance floor"...?

then you need a function to foreach($musica as $attribute => $value) and join values with the dot operand ($musica[$attribute] = $musica[$attribute].$ciste[$attribute])

Man, learn to give information.

petr.pavel 19 Junior Poster

I agree with forzadraco: don't do this.
An attacker could simply call your page with:
page.php?string=;DELETE * FROM yourtable
and you're dead.

However, to answer your question, the function you're looking for is urlencode().

petr.pavel 19 Junior Poster

I agree with silviuks that generally, what you want isn't a good idea :-)

I'm not sure if what you are after is to fill blanks in a row of user_ids.
What if you have three users: 1, 2, 3 and delete 2. Do you want the next new user to receive 2 again or 4?
If your answer is 2 then I suggest you forget about it. This really stinks (http://en.wikipedia.org/wiki/Code_smell). Perhaps tell us why on Earth you would want something like this and we help you solve the real problem.

petr.pavel 19 Junior Poster

I can translate for you, pal :-) I'm Czech too.
(Můžu ti překládat, jsem taky Čech.)

We need to know of what type the return values are: arrays or objects?
(Potřebujeme vědět, jakého typu jsou návratové hodnoty těch funkcí: pole nebo objekty?)

petr.pavel 19 Junior Poster

Uhm, are you talking about syntax highlighting?
Try highlight_string() - but it's just for PHP source code.

If you want more languages then grab some open source library like
http://www.pear.php.net/package/Text_Highlighter
or
http://www.phpclasses.org/browse/package/3293.html

Some related info:
http://www.sitepoint.com/article/highlight-source-code-php

petr.pavel 19 Junior Poster

Hi Fasola, this is a specification for a project not a list of three problems :-)
I could program this for you for USD 200 if you want.

Update: Oops, I just noticed that Code 5 System is for .NET, you got wrong forum. I can't help you with that.

Or was this just spam?

petr.pavel 19 Junior Poster

Hi there,
I assume you want to reorder the list just because you don't know of a better method of pre-selecting an option, right? If that's so I suggest using "selected" instead:

$pageTitle = 'Day You Were Married';
// this is for testing, I expect this variable to be filled somewhere else in your code
$preSelect[$pageTitle] = ' selected';
// $preSelect was an empty array, now it has just one item. I use this trick for pre-selecting options

... while ...
printf('<option label="%s" value="%s"%s>%s</option>',
   $nt['product_name'], $nt['url'], $preSelect[ $nt['product_name'] ], $nt['product_name']);

Does this solve your problem?

petr.pavel 19 Junior Poster

Hi Nick,
it's a bit difficult to debug your script when you didn't use the syntax highlighting provided by this forum. Could you please edit your post insert the CODE tags?

Could I see the script at work somewhere? In general, the problem is either in HTML (answers are overwriting one another) or in processing the response. It would be easier for me to check the first area if I could see the HTML directly.

Also, your sample data contains only one item so it cannot show the behaviour you've described, right? Could you add more and use some real life data? The problem could be there too.

petr.pavel 19 Junior Poster

Hi Mexabet,
unless you want to create the thumbnail yourself
(e.g. http://www.zubrag.com/scripts/website-thumbnail-generator.php)
you could use some of these:
http://thumbnails.iwebtool.com/
http://www.splitbrain.org/blog/2007-08/23-free_website_thumbnail_services

I don't want to sound rude but... did you use Google before asking (query: website thumbnail)?

As for PageRank, try looking into source code of these Firefox extensions:
https://addons.mozilla.org/cs/firefox/search?q=pagerank

petr.pavel 19 Junior Poster

Hi Chris,
to know for sure you'll probably have to do some measurement. I recommend reading about ANALYZE (to do the measurements right is a kind of a science).

For basic PHP measurement you can use $start = time() at then $length = time()-$start. But for real work I recommend extension XDebug.

Basically, you balance between the cost of the query and the cost of:
- transferring the result from db server to apache/php
- and browsing the result

So if the result is really large then you may be better of by running the query twice. Postgres caches a lot of things so running the query for the second time may not be as long as for the first time. I guess you did your homework about tuning up the query in the first place.

However, query results are rarely so big so there's a great chance you'll get better results with running the query just once. If you don't hit into memory limit :-)

I guess my reply comes a bit too late so this is for the sake of others having the same dilemma.

petr.pavel 19 Junior Poster

what does ABS do?

Calculates absolute value: ABS(-10) = 10, ABS(10) = 10

petr.pavel 19 Junior Poster

Hi there,
try something along these lines:

SELECT columnName, ABS(columnName - 9) AS distance 
ORDER BY distance LIMIT 1

Could be that ORDER BY won't accept alias distance in which case you'll have to repeat the ABS() code. The trick is in calculating the distance of your number (9) and your column values.

In PHP you then use something like:
$result = mysql_query("SELECT ... ABS(columnName - $myNumber) ...");
list($closestNumber) = mysql_fetch_row($result);

Let me know if this helps.
Petr 'PePa' Pavel