Jump to content

Fetching rows


Recommended Posts

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


// 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






Link to comment
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.



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

Link to comment
Share on other sites

  • 2 weeks later...
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.

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.