Jump to content

slack

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

slack's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Problem solved. Had to use 2 loops. Code looks something like this: [code] $query = "SELECT * FROM TABLE1"; $result = @mysql_query ($query); while($row = @mysql_fetch_array($result)) { echo $row["NAME"]; echo '<br>'; $Name = $row["NAME"]; $query2 = "SELECT * FROM TABLE2 WHERE TABLE2.REFNAME='$Name'; $result2 = @mysql_query ($query2); while($row2 = @mysql_fetch_array($result2)) { echo $row2["REFNAME"]; } echo '<p> </p>'; } [/code] Slack
  2. Hi all, I have problem with displaying data from two tables. There are two tables as follows: TABLE1 ID-------NAME 1--------John 2--------Mark 3--------Kelly TABLE2 ID-------REF------REFNAME 1--------A1--------Mark 2--------A2--------Kelly 3--------A3--------Kelly 4--------A4--------Mark As you can see REFNAME in TABLE2 referances NAME in TABLE1. In php I want the information to be displayed like this: John NONE Mark A1 A4 Kelly A2 A3 I am not sure if this can be done by a SQL JOIN or some sort of loop. Can someone help me display the information I want. Thanks Slack
  3. THANKS. Your advice has worked.
  4. Hi all, I have attempted to do this but I can't seem to get the results I need. Here is the scenario: I have two tables TABLE 1 and TABLE 2. Notice that CALL_ID in TABLE 2 is referencing CALL_ID in TABLE 1. [b]TABLE 1 CALL_ID -------- NAME[/b] 1 ------------------- Mike 2 ------------------- John 3 ------------------- Kelly [b]TABLE 2 ID ------------ CALL_ID [/b] 1 ---------------- 1 2 ---------------- 1 3 ----------------- 3 Info is to be displayed like below. So basically if that persons CALL_ID is in TABLE 2 then it should say YES. [b]NAME------------ ACTION[/b] Mike --------------- YES John --------------- NO Kelly --------------- YES I know I need some sort of loop that loops through TABLE 1 and for every entry it should check to see if its CALL_ID matches a CALL_ID in TABLE 2. I know that this may be a bit to ask but could somebody please post the code for the loops to get the display I want. Thank you Slack
  5. Ok.. Thanks for everyones replies. I made a stupid mistake in the code. I called the $row_rsAction = mysql_fetch_array($rsAction) twice. Sorry for the mistake.
  6. [!--quoteo(post=360918:date=Apr 2 2006, 12:25 PM:name=Desdinova)--][div class=\'quotetop\']QUOTE(Desdinova @ Apr 2 2006, 12:25 PM) [snapback]360918[/snapback][/div][div class=\'quotemain\'][!--quotec--] It seems to only find one row. Could you pass the table data from the database? so like copy the 2 rows it's supposed to find. [/quote] Sorry don't know what you mean. I am new to this. How do I do this?
  7. Hi all, I have the following which only shows one row. I want it to show all rows. -: $query_rsAction = "SELECT distinct Call_ID FROM `action`"; $rsAction = mysql_query($query_rsAction, $connClient) or die(mysql_error()); while($row_rsAction = mysql_fetch_array($rsAction)) { echo $row_rsAction['Call_ID']; echo '<br>'; } The above should display: 14 16 But this does not display. Only shows 16. Does anyone know why and how I can get it to display all results? Thank you
  8. No need for a reply as I have worked out the problem. To solve I did something like this: [code]$RID = $_GET['recordID']; $query = "SELECT * FROM `dvd` WHERE `id`='$RID'"; $result = mysql_query($query); $row = mysql_fetch_array($result); echo $row[title];[/code] This will now display the selected title
  9. Thanks for the quick reply. It sounds easy from what you have stated but I still can't seem to get it to work. I think it may be something to do with my select statement. Here is a sample of the code. [code]$RID = $_GET['recordID']; $query = "SELECT * FROM dvd WHERE id = '$RID'"; $result = mysql_query($query); print ("$result[title]");[/code] Just to let you know that the table is called 'dvd' and 'id' and 'title' are column names in my table. I am just trying to display the 'title' of the selected record. Thanks Slack
  10. [!--sizeo:2--][span style=\"font-size:10pt;line-height:100%\"][!--/sizeo--][!--fonto:Arial--][span style=\"font-family:Arial\"][!--/fonto--]Hello all, I have a page which can list all records from a table in my local database. For each record that is displayed there is link next to it. When the link is pressed another page opens up and the ID (automated primary key in my table) of the record selected is passed to the URL. So now the URL looks something like this: [a href=\"http://localhost/Webpages/newpage.php?recordID=3\" target=\"_blank\"]http://localhost/Webpages/newpage.php?recordID=3[/a] How do I display the details of the record that has been selected on this new page? Any help much appreciated! Thanks Slack[!--fontc--][/span][!--/fontc--][!--sizec--][/span][!--/sizec--]
×
×
  • 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.