TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 03-30-2008, 05:43 PM   #1 (permalink)
The Wanderer
 
Join Date: Mar 2008
Posts: 7
Thanks: 2
Face_Of_Boe is on a distinguished road
Confused getting results from database but diverent

Hey everyone im new here my mother allways told me its nice to intreduce yourself first..

So here i go my name is marco my hobbys are webdesing.
I'm learn greedy and i'm 22 years old.
Annyway Tht must be enouf hehe moving on to my qeustion

I have the following problem I'm trying to get a surtain part of my database to display in my website
But the only thing i seem to get is a tabel and i dont want a table i just want the information to be displayed where i wanted.
(sorry if it sounds fage)
To make it more clear I'll just link you to a site tht has it like i want 24 Episode Guide - 24 Season Episodes - TV.com
please help me anny more info needed ill add on question im just new to it so please forgive me if i do something wrong.
sinds im ferry ferry new to php ive been going crazy by browsing true i think more then a hundred tutorials without anny sucsess

Please help me

Thx in advanced,
Marco
Face_Of_Boe is offline  
Reply With Quote
Old 03-31-2008, 04:48 PM   #2 (permalink)
The Contributor
 
flyingbuddha's Avatar
 
Join Date: Jan 2008
Location: Birmingham, UK
Posts: 60
Thanks: 10
flyingbuddha is on a distinguished road
Default

Hi Marco,

Perhaps you could post a sample of your code so we can see how far you've got so far, then we can help you fill the holes :)
__________________
Pro. Geek
http://www.mikeholloway.co.uk
flyingbuddha is offline  
Reply With Quote
Old 04-01-2008, 06:47 AM   #3 (permalink)
The Wanderer
 
Join Date: Mar 2008
Posts: 7
Thanks: 2
Face_Of_Boe is on a distinguished road
Default

Sorry not ferry smart of me not to include that.

The problem with this script is when i have two records in my db for acsample:
test the name & test the name2
it displays both of them in stead of just one, and i have no clue how to make it work around this.

PHP Code:
<?php
include ("connect.php");

mysql_select_db("test_db"$con);

$result mysql_query("SELECT * FROM test");

while(
$row mysql_fetch_array($result))
  {
  echo 
"<td>" $row['name'] . "</td>";
  }
mysql_close($con);

?>
------edit--------
sorry for the <td> tags forgot to edit em out
------edit--------
Face_Of_Boe is offline  
Reply With Quote
Old 04-01-2008, 10:07 AM   #4 (permalink)
The Contributor
 
marxx's Avatar
 
Join Date: Sep 2007
Location: Finland
Posts: 45
Thanks: 3
marxx is on a distinguished road
Default

Well if you have to get just one of them then try this.
PHP Code:
<?php
include ("connect.php");

mysql_select_db("test_db"$con);

$result mysql_query("SELECT * FROM test");
$res mysql_fetch_array($result);

print(
"<td> " $res['test the name'] . " </td>");

mysql_close($con);

?>
Send a message via MSN to marxx
marxx is offline  
Reply With Quote
The Following User Says Thank You to marxx For This Useful Post:
Face_Of_Boe (01-06-2009)
Old 04-01-2008, 12:21 PM   #5 (permalink)
The Contributor
 
abiko's Avatar
 
Join Date: Feb 2008
Location: Croatia
Posts: 90
Thanks: 4
abiko is on a distinguished road
Default

You can always use the WHERE in your SQL. Of course you will have to know the id or any other "connection" you can make to get that item out.

Your query would look like then
PHP Code:
<?php
include ("connect.php");

mysql_select_db("test_db"$con);

// The ID part
// Lets say you have index.php?id=12
$id $_GET['id'];
if ( 
is_numeric$id ) ) {
$result mysql_query("SELECT * FROM test WHERE id = '".$id."'");

while ( 
$res mysql_fetch_array($result) ) {
 echo 
"<td> " $res['test_the_name'] . " </td>";
}


print(
"<td> " $res['test the name'] . " </td>");

mysql_close($con);
} else {
 die( 
"Error");
}

?>
I'm just guessing here, can you post your db table structure?
__________________
Back from sysadmins to the programmers.
Send a message via ICQ to abiko Send a message via MSN to abiko
abiko is offline  
Reply With Quote
The Following User Says Thank You to abiko For This Useful Post:
Face_Of_Boe (01-06-2009)
Old 01-06-2009, 12:02 PM   #6 (permalink)
The Wanderer
 
Join Date: Mar 2008
Posts: 7
Thanks: 2
Face_Of_Boe is on a distinguished road
Default

Thank you for your reply's this didt solve my problem thank you :D sorry it took so long for me to reply but i had some acc problems :)
__________________
I think a second Email would count as spam so I would like to thank the person that reseted my pass :D
Face_Of_Boe is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:40 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design