PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 31st, 2000, 03:57 PM
Beezzo Beezzo is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 6 Beezzo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I'm getting a parse error on this statement. The script originally ran on PHP 4 and it worked fine, but I had to switch it to a server running PHP 3 and now it doesn't work. Any ideas?

$qid = db_query("INSERT INTO clients_categories (categories_id, clients_id) VALUES ('{$frm["categories"][$i]}', '$id')");

Below is the text of the error:
expecting `STRING' or `NUM_STRING' or `'$''

Reply With Quote
  #2  
Old May 31st, 2000, 04:04 PM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 17
Send a message via AIM to rod k
Remove the {}. They aren't necessary here (because of the single quotes) and aren't supported under PHP3.

Reply With Quote
  #3  
Old May 31st, 2000, 04:17 PM
Beezzo Beezzo is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 6 Beezzo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
OK. I removed the {}, but unfortunately I still get the same error. Any other ideas? I appreciate the help, I'm still pretty new at this.

Reply With Quote
  #4  
Old May 31st, 2000, 08:30 PM
CS CS is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2000
Posts: 44 CS User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
I'm a relative newbie myself (I learn mostly from trial and error, so if this doesn't work; ignore me

$qid = db_query("INSERT INTO clients_categories (categories_id, clients_id) VALUES ('($frm["categories"][$i])', '$id')");


You may also want to consider creating a new variable for $frm["categories"][$i]; so you're only inserting 1 variable instead of 2.

Reply With Quote
  #5  
Old May 31st, 2000, 09:55 PM
okhvatstas okhvatstas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 33 okhvatstas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
Aren't the double quotes around categories supposed to be escaped like "categories"? Maybe PHP4 was made to recognize and fix this mistake while PHP3 wasn't.

Reply With Quote
  #6  
Old June 1st, 2000, 06:53 AM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 17
Send a message via AIM to rod k
Ooops, didn't see those " in there.

With PHP4 you can use the {} and it will recognize the " inside the {} as part of that expression and NOT the closing " of the statement.

Just remove the " as they aren't necessary or escape them as suggested.

Reply With Quote
  #7  
Old June 1st, 2000, 02:58 PM
Beezzo Beezzo is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 6 Beezzo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for all the help. I ended up just putting it in a separate variable and this worked.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > What's wrong with this?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap