Jump to content

Recommended Posts

I have been banging my head against the wall for about a week now trying to work out a solution but can not seem to get to one, could anyone help me out.

MY script selects all users id from users db then for each id it fetchs their status timelime from twitter, and then it checks if that status is stored in the table for their user id if it exists it updates other wise it inserts a new record to the users table.

But for some reason this script was working when I had about 10 users in the db, but I know have 18 users and it does not add the record to the table when the insert query is run. I know the query is working fine as I echoed the output to the screen.

 

Can any body help?

Code Below

 

$xml = new SimpleXMLElement($data); 
foreach($xml->status as $results) { 
$tweet = mysql_escape_string($results->text); 
$datetime = $results->created_at; 
$queryselectresult = "SELECT * FROM letwitour.".$id." WHERE statusid='$results->id'"; 
$selectresult = mysql_query($queryselectresult, $conn)or die('Error :666 ' . mysql_error()); 
if (mysql_num_rows($selectresult)) { 
$updatetweetSQL = (" 
UPDATE 
letwitour.".$id ." 
SET 
statusid = '$results->id', 
tweet_text = '$tweet', 
create_time_date = '$results->created_at' 
WHERE 
statusid = '$results->id'"); 
#mysql_query($updatetweetSQL,$conn) or die('Error 3: ' . mysql_error()); 
mysql_query($updatetweetSQL, $conn)or die('Error 3: ' . mysql_error()); 
} else { 
$insertintoTB = "INSERT IGNORE INTO letwitour.".$id ." 
VALUES ('NULL','$results->id','$tweet','$results->created_at')" ; 
mysql_query($insertintoTB, $conn) or die('Error 2: ' . mysql_error()); 
$count ++; 
} 
#echo $results->text; 
#echo $results->id .'<br /><br />'; 
} 

Link to comment
https://forums.phpfreaks.com/topic/166692-help-with-multiple-insert-into/
Share on other sites

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.