Jump to content

[SOLVED] While($row = mysql_fetch) only doing first row?


cooldude832

Recommended Posts

I have this

<?php
connectSQL();
$events_old = "events";
$q = "select * from `".$events_old."` Order by Event_Year Desc";
$r = mysql_query($q) or die(mysql_error());
echo mysql_num_rows($r)." Records Found<br />";	
$i = 0;
while($row = mysql_fetch_array($r)){
$date = $row['Event_Year']."/".$row['Event_Month']."/".$row['Event_Day'];
if($date == "//"){$date = "";}
$q = "Insert Into `".E_TABLE."` 
	(CreatorID, Type, Date_start, Location, About)
	Values(
	'1', '".$row['Event_Type']."', '".$date."', '".$row['State']."', 
	\"".$row['Event_Comments']."\")";
$r = mysql_query($q) or die(mysql_error().$q);
$i++;
echo "Record: ".$i."<br />";
}
?>

 

It returns 267 records found, but only adds the first row any ideas?  Also it only does the loop for the first one as it shows Record: 1 and that is it it doesn't error, but only loops once instaed of the 267 times it should.

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.