Jump to content

Recommended Posts

Hello,

Can someone tell me how I can do this.

I want to get the location from the database which i can do:

$getbanners = mysql_query("select location from banners where frequency='{$basis}'");

list($location) = mysql_fetch_array($getbanners);

 

There may be more than one record, therefore how can I put all the locations from the db into one array?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/47053-solved-get-from-db-and-put-into-an-array/
Share on other sites

Yeah, well considering I asked for help could you explain how to implement that into my setup. Otherwise that doesnt really help me.

edit: You changed it.

 

 

<?php

$MyArray = array();

for($n = 0; $n < $rows; $n++)

{

$mysql_fetch_assoc($n);

$MyArray[] = rows['TheData'];

}

 

?>

But what you posted wont work.

I am here to help not to write the whole thing for you, their are many sections

if you don't know how to use MySql with PHP you could of just asked

 

what i posted was an example (which i updated to as it included some OOP)

 

anyways good luck and good day

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.