I have some code where everything is inserting into one row instead of separate rows. I am not sure what I am missing. Any pointers would greatly be appreciated. $p = ''; foreach($html->find('.td.thing) as $price) { $p.= $price->innertext.''; // $p.= $price->innertext.'td'; } $q = "INSERT INTO something (`one`, `two`) VALUES ('$a', '$p')"; PHP:
The code is horrible, I'm not sure the quotation marks are proper, but anyway, you're ending the loop before the insert, hence, only one insert
I moved the bracket but that didn't seem to work. As for horrible what do you mean by horrible. Thank you for your help so far.
Is that your whole code? Because not only is your query outside the loop, but you're also not actually executing it.
What nico said.. and being the query is in a string,you're probably still using the soon to go the way of the dodo that we've been told for eight years to stop using mysql_ functions, right? Though you seem to be parsing data out of HTML -- without seeing that data and a whole lot more of your code there's really not a lot we can offer for help.
there she blows... \/ I have updated it a little. thank you for the help so far. $p = ''; foreach($html->find('.td.thing) as $price) { $p.= $price->innertext.''; $q = "INSERT INTO something (`two`) VALUES ('$p')"; $b= mysqli_query ($dbconnect, $q) or die ("Update query failed : " . mysql_error()); } PHP: Actually I just found one error I had a extra ; and I had to remove the dot in front of the p and works like lucky charms magically php. thank you for everyones help.. It was just no loop like what they said above. I will give you best answer.