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
CREATE ARRAY FROM DATABSE MySQL
Old 06-12-2008, 11:53 PM CREATE ARRAY FROM DATABSE MySQL
Junior Talker

Posts: 1
Name: Laura
Trades: 0
Hi,
I have a table mysql, Now I need put field 1 of all rows in a array but I don't know how to put in. I really appreciate if you can assistance me. thanks
This is table linkauto
id link link_url
1 newyork museum http://www.abc.com/newyork_museum.html
3 newyork http://www.abc.com/newyork.html
4 newyork hotel http://www.abc.com/newyork_hotel.html
5 newyork tour http://www.abc.com/newyork_tour.html

I need a query to get auto field link as
$link= Array('newyork museum','newyork','newyork hotel','newyork tour')
laura29 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-13-2008, 12:05 AM Re: CREATE ARRAY FROM DATABSE MySQL
Arenlor's Avatar
Ultra Talker

Posts: 462
Name: Jerod Lycett
Location: /home/arenlor
Trades: 0
Try this:
PHP Code:
$query "SELECT link FROM `table`";
$result mysql_query($query);
$num mysql_num_rows($result);
for(
$i=0;$i<$num;$i++){
    
$sql_arr mysql_fetch_array($result);
    
$link_arr[$i] = $sql_arr[0];

__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 06-13-2008, 11:23 AM Re: CREATE ARRAY FROM DATABSE MySQL
Super Spam Talker

Latest Blog Post:
PSD Squirrel Launched
Posts: 932
Trades: 7
PHP Code:
<?php 
$result 
mysql_query($sql); 
for(
$rowset = array(); $row mysql_fetch_array($result); $rowset[] = $row); 
?>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Sir P is offline
Reply With Quote
View Public Profile Visit Sir P's homepage!
 
Reply     « Reply to CREATE ARRAY FROM DATABSE MySQL
 

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.11288 seconds with 12 queries