Opinion greatly appreciated!
Moderator: General Moderators
Opinion greatly appreciated!
I'm interested in how I might go about this idea.
I'm interested in writing a PHP script where I'd have an admin page (admin.php or something) where I can enter a subject (let's say "Toy Trucks") and code that would automatically relate to the subject (let's say code that generates contextual adverts from Amazon.com), when I click submit I'd want it to be added to a table in a new row on a main page the users see (maybe index.php or something).
My questions are:
1.) Can I use tables to do this?
2.) Will contextual advertisements work like that or does everything (meaning the "subject" and advertisement) need to be in one cell (or div)?
3.) Any general advice about how to do this? I'm confident I can get the SQL end of it running and the PHP code itself but the two questions above are my main concern, any and all advice is welcome however, thank you!!!
I'm interested in writing a PHP script where I'd have an admin page (admin.php or something) where I can enter a subject (let's say "Toy Trucks") and code that would automatically relate to the subject (let's say code that generates contextual adverts from Amazon.com), when I click submit I'd want it to be added to a table in a new row on a main page the users see (maybe index.php or something).
My questions are:
1.) Can I use tables to do this?
2.) Will contextual advertisements work like that or does everything (meaning the "subject" and advertisement) need to be in one cell (or div)?
3.) Any general advice about how to do this? I'm confident I can get the SQL end of it running and the PHP code itself but the two questions above are my main concern, any and all advice is welcome however, thank you!!!
1.) Certainly. You can store virtually anything in a table.
2.) There is no restriction on what or where you put content in a page.
3.) I'm not getting a clear picture of what you want to do. Do you want to have an admin page where you manually set the nature of the material that appears on a public page? There are several ways you could do that, but it seems like it's not a very useful tool for real-world advertising. I mean, usually ads are selected based on some other criteria, and how would you prove to your advertisers that their ads were displayed, if you could arbitrarily change it?
If you really want to do this, though, one straightforward way would be to have a database with the content (or the pointer to the content) for each different alternative ad, and another table with just one row and one column, that would store the id of the currently selected option. Your admin page would update that one row. Your public page would be generated by a server script that checks for what content to place wherever you want it.
2.) There is no restriction on what or where you put content in a page.
3.) I'm not getting a clear picture of what you want to do. Do you want to have an admin page where you manually set the nature of the material that appears on a public page? There are several ways you could do that, but it seems like it's not a very useful tool for real-world advertising. I mean, usually ads are selected based on some other criteria, and how would you prove to your advertisers that their ads were displayed, if you could arbitrarily change it?
If you really want to do this, though, one straightforward way would be to have a database with the content (or the pointer to the content) for each different alternative ad, and another table with just one row and one column, that would store the id of the currently selected option. Your admin page would update that one row. Your public page would be generated by a server script that checks for what content to place wherever you want it.
Hey,
Thanks for the fast response.
To elaboroate on what it is I'm trying to do, here's what I want the user end to look like.
http://img476.imageshack.us/img476/7602/55384807zt5.jpg
I want the advertisement in the 3rd column to know what is in column 1 and make a relevant ad for it, if using tables I think all this data would need to be in the same cell so the ad has some relation to it. The admin area would just be a place to ad data to another row for column 1, 2 and 3. When I'd click submit in the admin area it'd add the row with the appropriate data. Does this make more sense..?
Thanks for the fast response.
To elaboroate on what it is I'm trying to do, here's what I want the user end to look like.
http://img476.imageshack.us/img476/7602/55384807zt5.jpg
I want the advertisement in the 3rd column to know what is in column 1 and make a relevant ad for it, if using tables I think all this data would need to be in the same cell so the ad has some relation to it. The admin area would just be a place to ad data to another row for column 1, 2 and 3. When I'd click submit in the admin area it'd add the row with the appropriate data. Does this make more sense..?
I'm afraid I still don't understand what you want to do. Is the item in column 1 (and 2) of the same row going to change from time to time? If not, I don't see what you want to do; just put whatever you want in column 3 at the time you put something in column 1. If you're going to be frequently changing the contents of each row (not just adding a new row), then you probably need a table of matching "column 1" content and "column 3" content.mrsleep99 wrote:Hey,
Thanks for the fast response.
To elaboroate on what it is I'm trying to do, here's what I want the user end to look like.
http://img476.imageshack.us/img476/7602/55384807zt5.jpg
I want the advertisement in the 3rd column to know what is in column 1 and make a relevant ad for it, if using tables I think all this data would need to be in the same cell so the ad has some relation to it. The admin area would just be a place to ad data to another row for column 1, 2 and 3. When I'd click submit in the admin area it'd add the row with the appropriate data. Does this make more sense..?
Are you planning to create this page dynamically with PHP? Then, you could do something like:
Code: Select all
. . .
$result=mysql_query("SELECT col1, col2, col3 FROM tablename WHERE id=$whatever");
$row=mysql_fetch_array($result);
$col1=$row['col1'];
$col1=$row['col2'];
$col1=$row['col3'];
echo "<tr><td>$col1</td><td>$col2</td><td>$col3</td></tr>";I don't know what else to tell you without knowing more about what you're trying to do.
Let's say I have 3 columns (and 3 rows in this particular case) and in column 1 is a list of products (apples, crackers, zuchninis) and in column 2 is the description of the food product (apples are fruit, crackers are like bread, zuchinis are a vegetable) and in column 3 I will have a few lines of code, let's say from Amazon.com that generates a relevant ad to whatever content it finds. This ad code would look like:
This code would remain the same for every single row in column 3.
Here's a visual example:
With that explained, the whole scheme is the following. I'd like to have it so I can go to an admin page, enter in the data for a new product (column 1), a new description for that product (column 2) and have the add code automatically insert itself in column 3. When I click submit, it'll enter the information into the SQL database and when the user goes to the main page it will appear, alphabetically ordered with the rest of the products on the page.
Thank you so much for listening, let me know if this makes more sense please.
Code: Select all
<script type="text/javascript"><!--
amazon_ad_tag = "test-20"; amazon_ad_width = "728"; amazon_ad_height = "90";//--></script>
<script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"></script>Here's a visual example:

With that explained, the whole scheme is the following. I'd like to have it so I can go to an admin page, enter in the data for a new product (column 1), a new description for that product (column 2) and have the add code automatically insert itself in column 3. When I click submit, it'll enter the information into the SQL database and when the user goes to the main page it will appear, alphabetically ordered with the rest of the products on the page.
Thank you so much for listening, let me know if this makes more sense please.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Since your HTML is the same in every record it might make more sense to do this:
The build the HTML from the values.
It still is not clear what you are trying to do.
Code: Select all
name description ad_tag ad_width ad_height
apples apples are fruit test-20 728 90
...Code: Select all
<script type="text/javascript"><!--
amazon_ad_tag = "<?php echo $row['ad_tag']; ?>"; amazon_ad_width = "<?php echo $row['ad_width']; ?>"; amazon_ad_height = "<?php echo $row['ad_height']; ?>";//--></script>
<script type="text/javascript" src="http://www.assoc-amazon.com/s/ads.js"></script>(#10850)
What didn't you understand so maybe I can elaborate?
My main question following my explanation is can I use tables to do this, assuming I'm continuously needing to add rows to the 3 respective columns, and if I can use tables, will I easily be able to use the contextual ad code to relate to the product name in the first column. Please let me know specifically what you don't understand, thank you!
My main question following my explanation is can I use tables to do this, assuming I'm continuously needing to add rows to the 3 respective columns, and if I can use tables, will I easily be able to use the contextual ad code to relate to the product name in the first column. Please let me know specifically what you don't understand, thank you!
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
I think you want to be able to enter keywords in a form and have the script search a database table for a match and generate a link from the data in the row found. But then you say things like, "added to a table in a new row on a main page the users see" and I get confused because tables are in databases, not one pages (which may include code that accesses tables). I am not clear about how or what you want to add based on searches.
(#10850)
arborint: I'm talking about both kinds of tables. I am talking about HTML tables with <tr><td> etc. and I've also been talking about SQL db's. When I've mentioned tables so far I'm talking about just the HTML kind. I'm looking to take the information from the SQL db which IS in a table and have it generated into a HTML table. I'm not talking about using keywords but rather having the page simply query the db and present the information in a HTML table.