Jump to content

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


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.

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.

Guest
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.