Jump to content

Fetching rows


eugene2009

Recommended Posts

Hello, im pretty sure this is simple but i just dont know how to. please help

 

<?php
// Make a MySQL Connection
$query = "SELECT * FROM example"; 

$result = mysql_query($query) or die(mysql_error());


$row = mysql_fetch_array($result) or die(mysql_error());
echo $row['name']. " - ". $row['age'];
?>

 

HOW do i make it that it would put 5 in one row and then break?

 

for example:

 

a  b  c  d  e

f  g  h  i  j

 

instead of

 

a

b

c

etc..

Link to comment
https://forums.phpfreaks.com/topic/187207-fetching-rows/
Share on other sites

thats for c++

 

The math is still the same, it works for PHP using the %.

 

So (1 % 2) would equal .5, give it a try:

$num = (1%2);
echo $num;

 

It calculates if there is a remainder, if there is then you have not reached that number, if it is equaled to 0, you have reached your number and would want to insert a break.

 

EDIT:

And for the PHP reference of its usage: Arithmetic Operators.

Link to comment
https://forums.phpfreaks.com/topic/187207-fetching-rows/#findComment-988599
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

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