0

I'm stuck in trying to send my streamitem_id over to my likes page with the Lightface popup. I can do this with a normal link as I had my likes page showing who had liked a post. But I fail to do the same when trying to send the id over with the javascript.

Here is what I have and have tried to do.

<script>
window.addEvent('domready',function(){          
document.id('start').addEvent('click',function() {
var number1=".$streamitem_data['streamitem_id'].";
light = new LightFace.IFrame({ height:400, width:800, url:'http://www.rawfeeds.co.uk/include/likes.php?streamitem_id='+number1+'', title: 'Likes' }).addButton('Close', function() { light.close(); },true).open();
});
});
</script>

I had an error in my select so printed the the streamitem_id out and it doesn't show. So I'm pretty sure its giving me this because no id is being sent over.

Array ( [streamitem_id] => .$streamitem_data['streamitem_id']. ) SELECT Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '['streamitem_id']. AND feedback_rating=1' at line 1

SQL

 <? 
if (isset($_GET['streamitem_id'])){

print_r($_GET);
$likes = mysql_query('SELECT feedback_streamid,feedback_userid,feedback_rating FROM streamdata_feedback WHERE feedback_streamid='.$_GET['streamitem_id'].' AND feedback_rating=1') or die("SELECT Error: ".mysql_error());
$numRowslikes= mysql_num_rows($likes);
while($row = mysql_fetch_array($likes)){
echo" $likes";
dave
  • 1,009
  • 5
  • 15
  • 26
  • You have a mysql error. Which part of it is not clear to you? And where is the related SQL query? It is missing, please add it to your question. – hakre Aug 06 '12 at 12:22
  • My apologies. I've updated it with the SQL. – dave Aug 06 '12 at 12:25
  • That actually is not the SQL, that is the PHP code that builds the SQL string. Instead please add the created SQL string (not the code that creates it) that is triggering the error. Also you might want to make your live more easy with some simple database class that gives more information in case of an error: http://stackoverflow.com/a/11580420/367456 – hakre Aug 06 '12 at 12:27
  • Like I stated before. How can the page work fine if I navigate there from the link..But not work fine from the lightface link..Its got the same code in the same page it navigates to... Makes no sense. – dave Aug 06 '12 at 12:56
  • Never mind. I've got it working. – dave Aug 06 '12 at 13:14
  • Please add your solution below as an answer then. You can accept it then, too. – hakre Aug 06 '12 at 13:23

0 Answers0