This topic is locked

How do you save Full URLs in a database

1/20/2010 8:34:59 AM
PHPRunner General questions
H
horsey_kim author

I am not sure if I described what I want very clear ... But here we go:
I want to save the FULL url in my database, not just a file name. How do I do that? My goal is to set-up a central database and have other websites (that share the same localhost, but have different hosting directories/cpanels) to be able to add, edit and delete to the main central database.
I can get the text fields to work beautifully. But the photo or file fields don't work well. Each site will have their own unique build via phprunner. So the only way I can get the photo and file thing to work is if a full URL is listed in the mysql database. So if you are on any of the websites it knows the FULL url to the photo or file that was uploaded via a different website.
All I could find in help screens was this. Which I don't think really helps other than the fact that the database only has file names not the full url saved to it.
[size="3"]FROM the help screens:[/size]
Here are some examples of URL prefix usage:

images/ - images folder is located in output directory

/images/ - images folder is located under website root

../images/ - images folder is located one level above
http://www.abc.com/images/ - full path to images folder
Note: in most cases URL prefix ends with forward slash.
Mercedes-Benz-CL-500.jpg will be automatically converted into <img src="images/Mercedes-Benz-CL-500.jpg" border=0>

A
ashipley 1/21/2010

I had similar problems when I set up my database, because some URL's are so long, they get "truncated" due to the allocated field size in the database. I started setting my URL fields to 150 characters, and the problem went away. There is a similar problem with displayig the URL on the list page, since the URL may not have a good place for the program to "wrap" the text. You can set the intended field size to something like 15 characters, but it will display more like 30 or 40 characters wide, because it does not know where to break the URL. You can set the field to display something like "View Link", and the length or the URL will not affect your column widths any more.
Arthur

H
horsey_kim author 1/22/2010



I had similar problems when I set up my database, because some URL's are so long, they get "truncated" due to the allocated field size in the database. I started setting my URL fields to 150 characters, and the problem went away. There is a similar problem with displayig the URL on the list page, since the URL may not have a good place for the program to "wrap" the text. You can set the intended field size to something like 15 characters, but it will display more like 30 or 40 characters wide, because it does not know where to break the URL. You can set the field to display something like "View Link", and the length or the URL will not affect your column widths any more.
Arthur


Thanks Arthur,

I am actually after not the length of the url. I want the database to save https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=47106&image=1&table=forumreplies - not just filename.jpg like it does now.

J
Jane 1/22/2010

Hi,
use Before record added event to check full URL and save it in the database.

More info here:

http://php.net/manual/en/reserved.variables.server.php