Forum Moderators: coopster

Message Too Old, No Replies

PHP code to get only one item from recordset

Driving Me Crazy

         

BruMax

6:27 am on Jan 26, 2005 (gmt 0)

10+ Year Member



I am trying to to select
<?php echo $rs_test->Fields('c_name');?>

Where I want it to = or like a NAME, not just show the first record

I can not figure the correct syntax for that. Is there anyone willing to help me with the correct syntax. I have been just creating record sets with a name included in the recordset. But I'm getting a whole lot of recordsets doing it that way.

Timotheos

4:31 pm on Jan 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi BruMax and welcome to WebmasterWorld!

Looks like you're using some sort of special class here so it might be hard for us to help without more info. Usually you make up an sql statement like "SELECT c_name FROM mytable WHERE c_name = 'BruMax'. If you can find where the SELECT statement is built then you can manipulate it from there.

Tim

BruMax

5:07 pm on Jan 26, 2005 (gmt 0)

10+ Year Member



Using Dreamweaver MX 2004

Dreamweaver uses a connections.php to contain the dbase connection.
Then I create record sets as in my posts. Drag and drop the elements into my page as needed as in previous post <?php echo $rs_test->Fields('c_name');?>

I have tried the sql statement that you supplied as generated using phpMyAdmin, but it does not get hooked up with my "connection" statement due to the fact that there is not actual dbase conecction statement in the page.

Using the statement in the post I figured there was a way to ad the = to or Like statement to that particular php code that DW generated ie. <?php echo $rs_test->Fields('c_name')Like "brumax";?> would work but it does not.

What I'm Trying to accomplish is a List/Menu with dynamic selection of over 100 items. And that list I have created with ease and it lists oll items. But what I want it to do is go to a page that has a "name" "link" "img" "description" displayed from the selection I chose from the "list"

I have been php'n for 4 weeks now and I know ******** this much and understand ** much.

As for the MySql data base part I have been using the phpMyAdmin and found it usable for me to create my tables and manipulate them. So that part is doable. Of course I also have been Sqling for 4 weeks also so you can see that has not by any means be mastered.

Used the Dreamweaver for about a year and have pretty well mastered the basics of it. But just now have got into the "dynamic" portion of it.

Timotheos

5:23 pm on Jan 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi BruMax,

Sorry I don't know anything about DreamWeaver. There must be someplace in the code where it's generating the sql statement. Hopefully someone with some DreamWeaver experience can help.

Tim

BruMax

9:33 pm on Jan 26, 2005 (gmt 0)

10+ Year Member



Ok, I figured it out.
Just for others info...

I created a "dynamic" list/menu on one page from a simple recordset only selecting "c_name" making a drop down list.
Then I had to create the page that the form submitted to. "show page" I created another recordset that would query the entire table. The I set the recordset to filter=contains - UrlParemiter=select (that was the name of the list/menu from the other page)
Then I simply did html on the page to and inserted what I wanted from the recordset and bam! there it was!

Thanks
BruMax

[edited by: jatar_k at 6:45 am (utc) on Jan. 27, 2005]
[edit reason] no urls thanks [/edit]