Jump to content

dtsdave

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dtsdave's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [!--quoteo(post=355883:date=Mar 17 2006, 05:11 AM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ Mar 17 2006, 05:11 AM) [snapback]355883[/snapback][/div][div class=\'quotemain\'][!--quotec--] Because it is a text string value not in quotes. [/quote] Got it! Thank you very much.
  2. keeB, When I run the code you suggest all I get is the query string spit back at me.
  3. [!--quoteo(post=355528:date=Mar 15 2006, 07:54 PM:name=keeB)--][div class=\'quotetop\']QUOTE(keeB @ Mar 15 2006, 07:54 PM) [snapback]355528[/snapback][/div][div class=\'quotemain\'][!--quotec--] well, obviously it is taking title1 as your column name.. [/quote] Why is it taking it as the column name when it doesn't do the same for page_id?
  4. [!--quoteo(post=355505:date=Mar 15 2006, 05:51 PM:name=php_b34st)--][div class=\'quotetop\']QUOTE(php_b34st @ Mar 15 2006, 05:51 PM) [snapback]355505[/snapback][/div][div class=\'quotemain\'][!--quotec--] I'm not sure if this will solve that problem but i noticed you forgot to close your quotation marks, try: [code] $query = "SELECT * FROM pages WHERE title='$_GET['title']'";[/code] [/quote] I don't think that's the problem because when I add the last quotation mark (with either page_id or title) I get a parse error.
  5. I'm trying to understand why a query on one column will work while a query on another column will not work. I use the following to create a table: [code] CREATE TABLE pages ( page_id TINYINT(5) UNSIGNED NOT NULL AUTO_INCREMENT, title VARCHAR(200) NOT NULL, PRIMARY KEY (page_id) ) [/code] And this is the query I use on a template page: [code] $query = "SELECT * FROM pages WHERE page_id=".$_GET['page_id']; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); [/code] I have some other code on the page to call various data from the row. When I go to sitename.com/template.php?page_id=1 it shows the data I want from the row where page_id=1, sitename.com/template.php?pade_id=2 shows the data I want from the row where page_id=2, etc. Now, I change the query, replacing page_id with title: [code] $query = "SELECT * FROM pages WHERE title=".$_GET['title']; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); [/code] When I go to sitename.com/template.php?title=title1 instead of showing the data from the row where I have a title = title1 I get an error that says Unknown column 'title1' in 'where clause' Where am I going wrong? Thanks in advance for the help.
  6. kamiza and keeB, thank you very much for your posts! You've got me on the right track and have been a big help.
  7. Hello. I've read a book, searched the web, read articles, and scoured forums and still am stumped. I think I'm missing something fundamental and that's why I haven't been able to find the answers I'm looking for. Basically, I'm trying to create pages from the data I've put into MySQL. For example, say I've got a database that stores article ids, titles and content. I want to create one template that will display the title of a given article and the content. I know how to get the info into MySQL. My problem is how to create pages for individual articles. I want to be able to go to [a href=\"http://www.site.com/article1\" target=\"_blank\"]http://www.site.com/article1[/a] and it'll have a page with the title and content for article 1, [a href=\"http://www.site.com/article2\" target=\"_blank\"]http://www.site.com/article2[/a] and it'll have a page with the title and content for article 2, and so on. I know naming the URLs will probably be tricky and that's not my concern right now. I'm just trying to display different articles with just one template as opposed to writing a separate template for each article. I hope I was clear in stating my problem. Any help would be greatly appreciated. Thank you very much in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.