expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'

Thread Solved

Join Date: May 2009
Posts: 81
Reputation: tulipputih is an unknown quantity at this point 
Solved Threads: 0
tulipputih tulipputih is offline Offline
Junior Poster in Training

expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'

 
0
  #1
Jul 22nd, 2009
I have error on this line..
what should I change..thank you
  1. mysql_query("INSERT INTO lesson (subject,year,learningArea,objectives,ability) VALUES
  2. ('<?php echo $onrow["subject"]', '<?php echo $onrow["year"]', '<?php echo $onrow["learningArea"]', '<?php echo $onrow["objectives"]', '<?php echo $onrow["ability"]' ") or die(mysql_error());
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 1,402
Reputation: ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light 
Solved Threads: 225
Sponsor
ShawnCplus's Avatar
ShawnCplus ShawnCplus is offline Offline
Code Monkey

Re: expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'

 
1
  #2
Jul 22nd, 2009
you're already in PHP, you don't need to do <?php echo Also, you're in double quotes so you must surround the $onrow["index"] with {} ie., {$onrow["index"]}
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,466
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso

Re: expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'

 
1
  #3
Jul 23rd, 2009
Try something like this
  1. mysql_query('INSERT INTO lesson (subject, year, learningArea, objectives, ability) VALUES ("'.mysql_real_escape_string($onrow["subject"]).'", "'.mysql_real_escape_string($onrow["year"]).'", "'.mysql_real_escape_string($onrow["learningArea"]).'", "'.mysql_real_escape_string($onrow["objectives"]).'", "'.mysql_real_escape_string($onrow["ability"]).'"') or die(mysql_error());
You may also want to post what was on the line before this as it too may also have an effect.
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 81
Reputation: tulipputih is an unknown quantity at this point 
Solved Threads: 0
tulipputih tulipputih is offline Offline
Junior Poster in Training

Re: expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'

 
0
  #4
Jul 23rd, 2009
thanks cwarn23 and shawncplus..
I have tried before..
there is no error now..but the new record is not saved .
What I intend to do is to save a new record after customization.
I do not use update since this is a set of new record..(customised from the displayed record..

thank you for your help.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 81
Reputation: tulipputih is an unknown quantity at this point 
Solved Threads: 0
tulipputih tulipputih is offline Offline
Junior Poster in Training

Re: expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'

 
0
  #5
Jul 23rd, 2009
thanks..
i have solved this
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC