Make A Horizontal Loop?

Mar 16, 2010

how to make a horizontal loop.. i've searched some codes but didn't work this is my sample code:

$movies=mysql_query("SELECT * FROM movies ORDER BY movie_id DESC");
<?php
while($rows=mysql_fetch_array($movies)){
?>
<tr>
<td><? echo $rows['title'];?></td>
</tr>
<?php
}
?>

the output is:

title1
title2
title3
Next>>

the output that i want is: title1 title2 title3 Next>> i'm a newbie in programming that wants to learn

ADVERTISEMENT

Make Array Object In For Loop With Horizontal View?

Jun 23, 2010

<?php
$xml = simplexml_load_file('http://www.google.com/ig/api?weather=London');
$information = $xml->xpath("/xml_api_reply/weather/forecast_information");
$current = $xml->xpath("/xml_api_reply/weather/current_conditions");
$forecast_list = $xml->xpath("/xml_api_reply/weather/forecast_conditions");

[Code]....

I want Out somthing like this manner of the horizontal ,

Even i tried UL LI WITH display inline but it goes failed,

View 2 Replies View Related

Horizontal Loop

Oct 27, 2002

I'm building a php form that retrieves about 25 categories from a MySQL database and creates a list of check boxes so users can select multiple categories before submitting the form. Right now I'm using the code below and it creates a vertical list of categories with check boxes.

View 6 Replies View Related

Horizontal Loop For Output

Jan 22, 2003

What would be the best way to set up a loop to output the results in say counts of 4 followed by a <br> for the following code snippet:

View 2 Replies View Related

Horizontal Loop Problem

May 1, 2003

I have some data I want to export from a database, where the limit is set for pagination. However, the max per page can be changed by the user.

The following code, sometimes causes errors in the table display and does adds extra fields at the end etc, where there are none required, throwing out all of the able allignment. PHP Code:

View 1 Replies View Related

Horizontal Repeat Loop

Oct 15, 2003

I have a recordset which i want to populate a table. I want there to be 3 colums accross and as many rows down as necessary. I can loop down the row, but cant work out how i can loop horizontally only three times then go to the next row and repeat. I guess i have to use an array, Code:

View 5 Replies View Related

How To Make The Horizontal Pdf File

Jan 13, 2011

how can i make a harizontal pdf file by using php.i created for the register form(name ,email, street,city country)

View 1 Replies View Related

Make A Horizontal Bar Chart With Data From An Array

Aug 31, 2010

I'm trying to make a horizontal bar chart with data from an array

$values = implode(',', array_values($type));
$labels = implode('|', array_keys($type));
$img = "http://chart.apis.google.com/chart?cht=bhg&chs=600x300&chd=t:{$values}&chxt=x,y&chtt=Ticket+Types&chxl=1:{$labels}&chts=676767,21.5";
echo "<img src='{$img}' alt='Chart'>";

This isn't giving me what I want to achieve but I'm having a hard to fixing it. The code above gives me a horizontal bar chart with the y labels as the number of row (i.e. the first label is 1, the second label is 2) and incorrect x numbers.

I want the labels up the y axis and the values along the x.

View 2 Replies View Related

Meaning Of Phrase "Try To Make You Architecture More Horizontal Rather Than Vertical" ?

Apr 14, 2010

I've just listened to [URL] (Zend webinar about PHP performance). I can't understand what this phrase means "Try to make you architecture more horizontal rather than vertical" (see screenshot)

View 2 Replies View Related

Make Loop

Apr 8, 2006

http://www.codingforums.com/showthread.php?t=83775

The while loop only shows one result instead of all results. People said i have to use a loop, but i don't know how.

View 1 Replies View Related

Need To Make The For Loop Work

Jul 19, 2005

Can any one tell me how to execute the below mentioned for loop. as i am not able to do so and also i have tried with foreach and while statements it seems like the comparison and increament and intialization doesnt work here. $combval is the array variable which has got multiple values. and with the second snippet of the code i am able to load the first value of the array vairable ...

View 1 Replies View Related

Trying To Make A Loop, Cant Figure It Out

Jun 4, 2006

im trying to make a little loop, but i cant figure it out... i
have a string with a bunch of 1s and 0s in it: 110101010101111010101
.... i need to count the number of 1s divide it by 2 and make a table
with 2 columns and then for every one, depending on its position in the
string i need to output a word and then go to the next 1 and output a
dif word....

its amenities, winter activities and summer activities for cottages
that i store in my db with 1s and 0s when its a 1 the amenitie or
whatever exists when its a 0 then it doesent exist...

View 3 Replies View Related

Trying To Make A FTP Spider... With Loop

Jul 2, 2006

I've been trying to code a FTP spider, to function as a search engine for the FTP servers on our network.

The code writes down all of the files with the ftp server name in front in text files.
It's about to work, just one little problem...

When I want to spider a directory with directories inside of it I have a small problem. The spider only writes down the first dir in the list. However, when there are only files inside of a directory that I want to spider the script writes them down perfectly...

A week or two ago I had gotten this almost working, however because of the end of school and such I had to postpone the coding, now I'm kinda lost in my own code...

<?php
$ftp = $_GET["ftp"];
$dir = $_GET["dir"];
$ftp_host = $ftp;
$ftp_user = "anonymous";
$ftp_password = "anonymous";

echo "Connecting to $ftp_host via FTP...<BR>";
flush();
ob_flush();
$conn = ftp_connect($ftp_host);
$login = ftp_login($conn, $ftp_user, $ftp_password);

$mode = ftp_pasv($conn, TRUE);

if ((!$conn) || (!$login) || (!$mode)) {
   die("FTP connection has failed !");
}
echo "Login Ok.<BR>";
flush();
ob_flush();
$mode = ftp_pasv($conn, TRUE);

function itemize_dir($contents) {
   foreach ($contents as $file) {
       if(ereg("([-dl][rwxstST-]+).* ([0-9]*) ([a-zA-Z0-9]+).* ([a-zA-Z0-9]+).* ([0-9]*) ([a-zA-Z]+[0-9: ]*[0-9])[ ]+(([0-9]{2}:[0-9]{2})|[0-9]{4}) (.+)", $file, $regs)) {
           $type = (int) strpos("-dl", $regs[1]{0});
           $tmp_array['line'] = $regs[0];
           $tmp_array['type'] = $type;
           $tmp_array['rights'] = $regs[1];
           $tmp_array['number'] = $regs[2];
           $tmp_array['user'] = $regs[3];
           $tmp_array['group'] = $regs[4];
           $tmp_array['size'] = $regs[5];
           $tmp_array['date'] = date("m-d",strtotime($regs[6]));
           $tmp_array['time'] = $regs[7];
           $tmp_array['name'] = $regs[9];
       }
       $dir_list[] = $tmp_array;
   }
   //return $tmp_array;
   return $dir_list;
}

function spider($ftp, $dir, $conn) {
//$conn = $ftp_host;
$buff = ftp_rawlist($conn, $dir);
$items = itemize_dir($buff);
foreach($items as $line=>$item)
  {
  
$file = $ftp . $dir . $item['name'];  
$fh = fopen('ftp.txt', 'a') or die("can't open file");
fwrite($fh, $file . "");
fclose($fh);

  echo $file;
  echo "<BR>";
  //echo $item['name'];


if(strpos("/", $ftp, $dir . $item['name']) == TRUE) {
$ydir = "/";
}

if($item['type'] == 1) {
return $dir . $item['name'] . "/";
  
  } } }

$work = spider($ftp, '/', $conn );

while($var = 0) {  
if( $work != 0 ){
$works = spider($ftp, $work, $conn );
}
else {
$var = 1;}
}  
?>



And I do specify the ftp server in the variable: ?ftp=

View 3 Replies View Related

Make For Loop More Efficient?

Dec 20, 2010

So I have this for loop with 36 if-queries inside. Any advice on making it more efficient?You can view the complete code here

Here's a sample of what it looks like:

$numbers = range(1, 36);
shuffle($numbers);
for ($m =0; $m<37; $m++){
if ($numbers[$m] == "1"){
$mirza[$m] = "RUTHIE";
code....

View 5 Replies View Related

Use Array_sum Or Loop And Make Sum?

Apr 8, 2011

Have an array

array(array('a'=>'s','add'=>1),
array('a'=>'s1','add'=>2),
array('a'=>'s2','add'=>3)
...
...
);

I want to sum of all key add together.so result should be 6

View 3 Replies View Related

While Loop Make Too Many Arrays?

Dec 30, 2010

I needed to block out specific date ranges. I found a code to do this, and it utilizes arrays. I like that.What I then needed was a way to create the array with every date within the range, because I only entered the Start Date and the End Date. Found one. Works like a charm.But nw, I have a problem. It creates a new array using the same $. So the only array that the calender registers is the newest one.

Code:
function createDateRangeArray($strDateFrom,$strDateTo) //Changes a Range of Dates to Specific Dates
{
[code]...

View 3 Replies View Related

Make A While Loop With A Counter?

Feb 24, 2011

i am currently working on a mailing list and its function is to send EVERY single user a notification email once an entry they are looking for on a database is available.below is the mailing_list.php which sets up database connection and deals with the fields of the table:

PHP Code:
<?php
include('view_function.php');
global $connect;[code]....

As you can see toward the end of mailing_list.php, in the while loop i echoed out $query, but it only echoed ONE query of that entire array .so wut i am trying to do is to make a while loop with a counter in it, but still only one result shows up.Basically, i want the $query to output all items in an array so that following SELECT statement can choose the item which matches the required query and send the users the notification email bout such particular query.

View 1 Replies View Related

Make A Loop For Formula?

Sep 22, 2007

How can I make a loop for this formula?

P (1 + r/365)365

View 13 Replies View Related

Make Rows In A Loop

Jul 13, 2007

Im trying to implement the "little pic poll" in my site, but in the source its coded to diplay the images and radio buttons in a table, and the way it renders on the screen is in a straight colomn down, i want to have the picts render in like maybe 4 element wide rows going down, so first fill in the first row, then the second, so on. but as it is now it just has the picts showing each under the other. Im showing all the source code, but its not all pertinant to my question. TY.

include("lp_settings.php"); //include file containing general settings
import_request_variables("p", "p_"); //import POST variables
import_request_variables("c", "c_"); //import cookie variables

if (!isset($c_votingstep)) {
$votingstep=1;
} else { $votingstep = $c_votingstep; }
..........

View 3 Replies View Related

Make A Number From A Loop A Certain Length

Oct 4, 2001

Is there a way to make a number from a loop a certain length?

If I have the following numbers:
10
5
13
122

I want them to show up as:
010
005
013
122

If I have:
10
5
2

I want them to show up as:
10
05
02

View 9 Replies View Related

Make 3 Columns With Last Class In Loop

Dec 13, 2010

I want to make a 3 columns and add last class to third column. I tried this code:

<?php for ($i = 0; $i < 9; $i = $i + 4) { //can't touch this line ?>
<?php for ($j = $i; $j < ($i + 4); $j++) { //can't touch this line ?>

[code...]

but it doesn't work.

View 3 Replies View Related

Make For Loop Real Time?

Apr 23, 2011

I want to Make a Script which give result realtime. In My Script it have 3 steps. 1st step was to grab all links from a webpage .(i use pregmatch_all function coz all links i need are started with same domain [URL]... and grab from [URL]... ) 2nd step i have to grab direct link from all links (like [URL]...) 3rd step Upload that file to and third party site and get the upload link from there . lastly i added a function named which get the page ranges (like '1|5' ) so script upload all links from [URL]... I have done the scipt it was alo running ok but it shows result after all completed but i want a realtime result like script have grabed one link and do all steps with it and show that reult link on browser and then so on i mean a realtime solution. How can i do that i used for loop but no real time result.

View 3 Replies View Related

Make A Loop To Keep Check If Variable Changes?

Jun 7, 2010

Below is a code to check a ustream account if they are broadcasting live. What I'm trying to do is make it change live on the site if the variable changes. So if the user goes live, it updates the div tag on the site without having the user refresh. How can I do that?

HTML Code:
<div id="status" class="status"></div></p>
<script type="text/javascript">
function set_status(status)
[code]....

View 3 Replies View Related

Make Database Updates In A WHILE Loop?

Jul 26, 2011

I have a page which retrieves and displays an Audit schedule from a database. But one field in the database, 'days_til_due' I want to update dynamically, whenever the page is accessed, and  THEN display the updated database value on the page.  Basically: (Days 'til due = (Today's Date - Date Last Done) + Frequency)Everything else works okay, but 'days_til_due' in the database isn't updating.  For error checking, I'm displaying the php calculated value of $daystildue first, and then next to it the database version of this value $row['days_til_due'].  These 2 columns should be identical

Code: [Select]$q = "SELECT auditUI, audit, clause, name, DATE_FORMAT(lastaudited, '%M %d, %Y') AS la, frequency, days_til_due FROM schedule ORDER BY audit, clause ASC";
$r = mysqli_query($dbc, $q);
[code]....

View 5 Replies View Related

Make A Script Break Out Of Loop If Not Responding

Jul 26, 2006

I have a script that scrapes content from a number of partner sites, this works fine but I have a problem if one of the site's does not respond or if it take a very long time to respond.

This long response time causes to entire script to time out but what I want it to do it just move onto the next site after 5seconds.

What is the best ay to do this, it it possible to use set_time_limit() or will this cause the entine script to time out. Any help would be appreciated.

View 1 Replies View Related

Best Way To Loop Through Data To Make Nested Lists ?

Jul 19, 2007

I'm trying to turn some db data into a nested list structure to use as menus

first off, i fgured that it would be quicker to make one sql query, put the results in an array and then loop through that rather than making millions of queries - is this assumption correct ?

basically i have all my product families in a table - each family has a parent id (p_id) which is the fam_id of the family it belongs to, and its own family id (fam_id) and name (fam_nom) Code:

View 3 Replies View Related

Make The Loop And Variable Variables Into A Function?

Aug 20, 2010

How can I make the code below into a function?# split the string by string on boundaries formed by the string delimiter will split the value into an array like the example below,

# Array
# (
# [0] => pg_cat_id=1
# [1] => tmp_id=4
# [2] => parent_id=2
[code]....

View 4 Replies View Related

Make The Code Witn One Loop And One Variable?

Jun 15, 2011

Anybody can do the following code with one loop and one variable?

$result = Array();
for (
$x = 0; $x < 6; $x++)
[code]...

View 6 Replies View Related

Counter - Make The Number 1 Add 1 To Itself And Repeat In The Loop

Oct 15, 2010

i am trying to do is make the number 1 add 1 to itself and repeat in the loop so, 1 2, 3, 4, 5, 6 ect...What am i doing wrong.

$result = mysql_query("SELECT * FROM comments WHERE quoteid = ".$_REQUEST['quoteid'].""); 
while($row=mysql_fetch_array($result)){
$date = $row[date];
$name = $row[name];
$email = $row[email];
$quoteid = $row[quoteid];
$comment = stripslashes($row[comment]);
$commentid = $row[commentid];
[Code]...

View 2 Replies View Related

Make Closed Loop Which Run The Function In Unlimited Way?

Mar 3, 2011

let say we have (function) and that function has one variable which is (id)the (id) could be number any number 1 or 4 or even 49999 whatever.how to make closed loop which i mean run this function in unlimited wayeach time with new id <--- i can do it by set random()but the problem i've is how to make it repeat itself

excuted
excuted
[code]....

View 3 Replies View Related

Preg_match - Make A Loop That Reads All The Files In A Folder

May 15, 2007

I know basically what I have to do to achieve what I want, but preg_match is so confusing with its search criteria and characters. I want to make a loop that reads all the files in a folder (they are all images) and sort them by their initial filename and the number included. Each folder will have something like this:

large1.jpg
large2.jpg
large3.jpg
thumb1.jpg
thumb2.jpg
thumb3.jpg
main1.jpg
main2.jpg
main3.jpg
original1.jpg
original2.jpg
original3.jpg

I want to sort it something like "original[0-9].jpg" and either put it in array or whatever so I can count the total (like 3 of each) and use each one. I have the right loop I think for the files, but I don't know how to do the filename filter.

View 8 Replies View Related

Apache / Server Die When Make Typo And Cause Never Ending Loop?

Nov 15, 2010

this is more of a fundamental question at how apache/threading works. in this hypothetical (read: sometimes i suck and write terrible code), i write some code that enters the infinite-recursion phases of it's life. then, what's expected, happens. the serve stalls. even if i close the tab, open up a new one, and hit the site again (locally, of course), it does nothing. even if i hit a different domain i'm hosting through a vhost declaration, nothing. i normally have to wait a number of seconds before apache can begin handling traffic again.

most of the time i just get tired and restart the server manually. can someone explain this process to me? i have the php runtime setting 'ignore_user_abort' set to true to allow ajax calls that are initiated to keep running even if they close their browser, but would this being set to false affect it?

View 2 Replies View Related

Make A Password Generator And Have A While Loop And It Shows 4 Codes ?

Apr 25, 2009

im making a password genorator and i have a while loop and it shows 4 codes eg. 11123-11123-11123-11123 but it makes this in the while and i want to make the output of the whil into a varible and then add it to my sql database here is code

PHP Code:
function password(){
[code].......

View 2 Replies View Related

Make Message Appear On Screen If There Is Error In Foreach Loop?

Jun 30, 2011

Is there a way to make a message appear on the screen if there is an error in a foreach loop? I'm using the below code, and as long as valid information is entered into the form it works perfect, but if the wrong information is entered I want it to show on the screen "Wrong info entered" right now it just shows "Warning: Invalid argument supplied for foreach() in /home5/ccccomma/public_html/new/register.php on line 30" when entered wrong

[Code]...

View 4 Replies View Related

Make POST Values Dynamic Within A Loop To Store As An Array?

Nov 11, 2010

I've been working on trying to write a function that will grab the POST values of any given form submission, pop them into an array, loop through the array using trim, addslashes etcetera pass that value back to a variable where it can then be passed to a database.Now the hurdle I have atm is getting all the input,textarea,select element data into an array upon form submission. code I have follows

$fields = array($_POST['1'], $_POST['2']);
$i = 0;
foreach ($fields as $field) {
[code]....

View 2 Replies View Related

Make Function Or Loop To Check What Category User Chose?

Oct 13, 2009

I am currently creating a type of "classifieds" website, and when the user enters the site he/she is able to choose for example "Vehicles" in a dropdown list, and then choose mileage, year, price range etc. Here is my problem, I have managed to make contact with a db using Ajax to call a php script which then checks the mysql db for the search criteria and returns a result. BUT, I need to make this as "smart" as possible. How can i make a function or maybe a loop to check what category the user chose, and then to see if the user made any specifications on price or mileage for example, and then build a query_string to send to the php code, which then checks the mysql database for the search? Heres a bit of code from the Ajax file:

[Code...]

I don't have time to learn jQuery. I am sorry guys, but could you just point me in the right direction when it comes to the coding of this What would be the "best" way for doing what I want? Also, there is an error if all elements in the array that I send to the php file isn't filled with values... If an array is empty, then the script will crash.

View 5 Replies View Related

Variable Fopen File Name Loop To Make Multiple Files?

Dec 9, 2010

I'm working on a script which should read lines from a file keyword.txt create a new file with that variable name, insert the content close and loop through all the lines in the keyword file. The loop itself works but now that i'm adding the fopen fwrite and fclose i'm running into trouble.

<?php
$read_file = file('keywords.txt');
foreach($read_file as $var)
[code]....

View 9 Replies View Related

Loop - Escape First Iteration / Couldn't Manage To Make Modulus Work?

May 7, 2011

Given this PHP for loop

$row->frequency = 1;
$row->date_1 = 10000;
$row->interval = 86400;
for ($i = 0; $i <= $row->frequency; $i++) {
$cal_data[] = array(
code....

I would like the first iteration of the loop to ignore the + $row->interval giving me as a result:

10000
96400

I've seen this done with modulus but couldn't manage to make it work here.

View 2 Replies View Related

Horizontal Bar Without Gd

Feb 9, 2006

how to create a simple horizontal bar ( It should show values from 0 to 100) without gd using a pixel gradient image from yellow to red ? I am searching on google from hours but I found nothing but ultra sofisticated chart.

View 1 Replies View Related

Horizontal Bar Graphs

Sep 10, 2005

I want to create a horizontal bar graph using php with more than one bar in a series(ie in a row). I think it can be done iusing gd library ....

View 4 Replies View Related

Horizontal Row From Query

Jun 7, 2007

I am listing the contents of an sql table on a page. I can get it to list fine but it will only list vertically and all the help I can find online seems to creat the list horizontally, but simply repeats the first entry in the row in an endless neverending loop that never stops.

View 13 Replies View Related

Horizontal Looper

Jan 23, 2007

After hours of search and trial (plus sketchy internet connection), I come to ask for help. I just need to display my query results in a table where I can define the number of columns per row. The current code is very basic:

$query_photos = "
SELECT *
FROM photos
ORDER BY ID";
$result_photos = mysql_query($query_photos)
or die ("Couldn't execute query.");

while ($row_photos = mysql_fetch_array($result_photos))
{
extract($row_photos);
echo "<img src="photos/$image" alt="$text" border="0">";
echo "<br />";
}
I've tried various solutions found on here and elsewhere, but was never able to adapt them to my needs.

View 2 Replies View Related

Horizontal Navigation Bar

Jan 14, 2005

I am trying to build a horizontal navigation bar that shows page titles from a database. It needs to be able to show all pages as the user adds records to the site. I figured out how to list the pages in a repeating region vertically, but i can't make the records list horizontally.

View 1 Replies View Related

Horizontal Count

Dec 7, 2005

I have a simple form that displays a sub Catagory from my database and in (brackets) a count of how many items within the sub catagory. The list is displayed but shows the items as a vertical list. What I need to do is display the list with 4 items per row. Does anyone know a simple code to put into the display? Below is the code

[php] <form name="form1" method="post" action="shop_results.php">


<div align="justify">
<?php do { ?>

<div align="left"><span class="style2">
<input name="sub_cat[]" type="checkbox" id="sub_cat[]" value="<?php echo $row_search['sub_cat'] ?>"<?php if (!(strcmp($row_search['sub_cat'],"yes"))){echo "checked";}?>>
<?php echo $row_search['sub_cat']; ?> (<?php echo $row_search['count']; ?>)&nbsp; </span>
</div>
<?php } while ($row_search = mysql_fetch_assoc($search)); ?>
<br>
<br>
<input type="submit" name="Submit" value="Submit">


</div>
</form> [php]

View 2 Replies View Related

WordPress Sidebar: Make Custom Loop Display Posts In Same Category As Single Post?

Mar 14, 2011

This is from a sidebar set up to display 10 recent posts from the same category as the current single post being viewed. Unfortunately, it also includes the title and excerpt of the current single post in the list. how to change it so it EXCLUDES the current single post? Other than that, it works fine.

<?php
$query = "showposts=10&orderby=date&cat=";
foreach((get_the_category()) as $category)
{
$query .= $category->cat_ID .",";
}

[code]....

View 1 Replies View Related

ADVERTISEMENT