Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP MySQL Array, Help!!
Old 07-19-2006, 04:20 PM PHP MySQL Array, Help!!
UKG
Junior Talker

Posts: 3
Trades: 0
Right well all i want to do is get info from my SQL database and echo it onto my page, here's the code i have so far...
PHP Code:
<?php
function contact()
{
 include(
"../mysql.php");
 
$db2 = new db;
 
$db2->connect();
 
 
$sql "SELECT * FROM contact_page";
 
$return $db2->query($sql);
 
 while ( 
$row mysql_fetch_array($return) )
?>
 <p> 
 <?php echo @$row[Address]; ?>
 </p>
 
 <?php } } ?>
And here's my database layout....
Code:
id       title            text                    active  
1        Address      123 Test Drive         1 
2        Phone        123456789               1
Basically i want my script to get the 'text' from the row i need it from, i.e. If i want to display my 'Address' it would display '123 Test Drive' where i placed the code similar to '<?php echo @$row[Address]; ?>'.

Hopefully i've explained what i'm after well enough.
UKG is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-19-2006, 04:41 PM Re: PHP MySQL Array, Help!!
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
It looks like you have your table data stored wrong.

Code:
id     address          phone          active
1      123 Anywhere St  555-1212        1
2      123 Test Drive   555-3331        1
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP MySQL Array, Help!!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10234 seconds with 12 queries