Jump to content

help in convert php code to mysql command


gratsami

Recommended Posts

Hi, 

 

I've table called (rr) with 3 columns id int, name varchar 100, and cnt int.

 

I wrote php code to loop each record depending on cnt:

<?php
$getAll = mysql_query("SELECT * FROM rr");
while ($v = mysql_fetch_array($getAll)){
	for( $i=1; $i <= $v['cnt']; $i++ ){
		echo $i ." - ". $v['name'] ." - ". $v['cnt'] . "<br />";
	}
}
?> 

I need to convert this code to MySQL command to get same result or creating a view with a same results.

Can any body help me please?

 

Thanks.

 

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.