MySql won't write !
Posted by: Lord Cupid (209.183.34.---)
Date: January 27, 2008 01:56AM

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\wamp\www\cupidscrystals.com\Apps\index.php on line 2 [not the exact url.]

From 2 different tutorial schools and my Host Server, I get this exact same message.

It's got to be a configuration issue, only I have yet to locat it. php.ini has mysql inialized, as well as Wamp Server, and Apache. So, what's left? Where do I look now?

Peace, Grace & Love;

Lord Cupid
Heaven's Spokesman

Options: ReplyQuote
Re: MySql won't write !
Posted by: Lord Cupid (209.183.34.---)
Date: January 27, 2008 04:34AM

Alright, I'll re-examine the config files.

Options: ReplyQuote
Re: MySql won't write !
Posted by: Lord Cupid (209.183.34.---)
Date: January 27, 2008 07:02AM

Ok, so far, this has turned out to be a case of syntax errors accquired from the Tutorial. You know, cut and paste, and apparently the ',' comma is no more, though it was probably once allowed in an earlier technological age.

The database created & selected just fine. However, that's not the problem I had all day. Perhaps it is time to visit that error again, though I'd like to see if I can write to the database that was just created, first.

Options: ReplyQuote
Re: MySql won't write !
Posted by: yfastud (Moderator)
Date: January 27, 2008 07:04AM

To create db, you should check Setup Database guide on my personal websites

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: MySql won't write !
Posted by: Lord Cupid (209.183.34.---)
Date: January 27, 2008 07:46AM

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /cupidscrystals.com/public_html/Apps/db_io.html on line 39


mysql_query("insert into $cmchat_GLOBL['DB_TABLE'] values ($User_Data)"winking smiley;


What exactly is wrong with this coding?



Edited 1 time(s). Last edit at 01/27/2008 08:13AM by Lord Cupid.

Options: ReplyQuote
Re: MySql won't write !
Posted by: Lord Cupid (209.183.34.---)
Date: January 27, 2008 07:47AM

All variables are defined prior

Options: ReplyQuote
Re: MySql won't write !
Posted by: tollen (---.dyn.iinet.net.au)
Date: January 28, 2008 09:44AM

Lord Cupid Wrote:
-------------------------------------------------------
> Parse error: syntax error, unexpected
> T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or
> T_VARIABLE or T_NUM_STRING in
> /cupidscrystals.com/public_html/Apps/db_io.html on
> line 39
>
>
> mysql_query("insert into $cmchat_GLOBL['DB_TABLE']
> values ($User_Data)"winking smiley;
>
>
> What exactly is wrong with this coding?


inside double quotes string quotes must be removed

this should work:

mysql_query("insert into $cmchat_GLOBL[DB_TABLE] values ($User_Data)"winking smiley;

to illustrate the difference, you need unquote first if you want to keep the single quotes, this will work also:

mysql_query("insert into ".$cmchat_GLOBL['DB_TABLE']." values ($User_Data)"winking smiley;

Options: ReplyQuote
Re: MySql won't write !
Posted by: Lord Cupid (209.183.34.---)
Date: January 31, 2008 12:29AM

Reply

Okay, I'm back!

Took some time to work on other aspects of the program, and of course, having a difficult time there as well.

Nonetheles, the Tutorials did not point out that part about those quotes.

Did you know that God Hates Quotation Marks??? Jesus is rather indifferrent, Himself, and Xanadu, The Holy Ghost could take them or leave them. And NEVER make the quote signs with your fingers as God Absolutely hates that. Found this out by Experience!

Okay, so Programmers have to live with quotes - or do we? Well, I can't think of anything right off the bat as raw string data is unmarked, though string variables & numeric variables contain "machine code" that signify what's what to the computer. So, possibly, anything that is raw string would be unmarked and could be treated as a quoted string until otherwise specified.

Ok, that's my thoughts on the subject. Also, just wanted to pass on that info about Our LORD so that you avoid a blunder if you're ever in His Presence. Praise The LORDS!

Grace, Peace & Love;

Lord Cupid

Options: ReplyQuote
Re: MySql won't write !
Posted by: Lord Cupid (---.mycingular.net)
Date: February 04, 2008 01:12AM

tollen Wrote:
-------------------------------------------------------
> Lord Cupid Wrote:
> --------------------------------------------------
> -----
> > Parse error: syntax error, unexpected
> > T_ENCAPSED_AND_WHITESPACE, expecting T_STRING
> or
> > T_VARIABLE or T_NUM_STRING in
> > /cupidscrystals.com/public_html/Apps/db_io.html
> on
> > line 39
> >
> >
> > mysql_query("insert into $cmchat_GLOBL['DB_TABLE']
> > values ($User_Data)"winking smiley;
> >
> >
> > What exactly is wrong with this coding?
>
>
Ok, after much research and many tutorials later, here's the answer:

$query="INSERT INTO ". $cmchat_GLOBL['DB_TABLE']." VALUES (". $User_Data ."winking smiley";
$results=mysql_query($query,$con) or die("Unable to insert ". mysql_error());

See, the trick is to embed your command request and variables into a string, such as $query. That way, when the php file gets parsed, the string value you used meets all of the criterion of the mysql_query command.

The way I originally had it, the command line was jumping in and out of string value. This way just described, has the whole thing as one big string! smiling smiley

Peace, Grace & Love;

Lord Cupid

Options: ReplyQuote


Sorry, only registered users may post in this forum.