Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Old 11-05-2009, 09:18 AM   PM User | #16
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 5,123
Thanks: 2
Thanked 554 Times in 542 Posts
Fou-Lu is a jewel in the roughFou-Lu is a jewel in the roughFou-Lu is a jewel in the rough
Sorta, printf takes variables and replaces them based on datatypes.
PHP Code:
$var 'hello';
echo 
$var ' world'// prints 'hello world'
printf('%s world'$var); // Interprets $var as a string and prints hello world 
sprintf is identical except it stores its result in a variable instead of printing it. Something retained from C.

Edit:
Got you're last post in there. Check to make sure that the file is being saved as plain text. I don't know where the problem is coming up (mind you, I left my mysql connection string in there, but I assume you already have that in there somewhere).
Edit:
Wait you said you're error is on line 29? That does correspond to the *'s. Ensure that they are not actually in there, or BOM of some sorts hindering it.

__________________
Code:
struct User *upFou;
userInit(upFou, "Fou-Lu", 1);
printf("%s has %s to %s\n", (*upFou).Name, !quitSmoking(upFou) ? "FAILED" : "SUCCEEDED", (*upFou).Smoker == 1 ? "FAIL" : "PASS");
// Fou-Lu has FAILED to FAIL?  Lol

Last edited by Fou-Lu; 11-05-2009 at 09:23 AM..
Fou-Lu is offline   Reply With Quote
Old 11-05-2009, 09:26 AM   PM User | #17
puglover
New Coder

 
Join Date: Oct 2008
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
puglover is an unknown quantity at this point
whats BOM?? and i dont think its corresponding to the *s...this is driving me crazy!!!! lol...but i really do appreciate all the help

what do u mean plain text?? its saved as a .php file

Last edited by puglover; 11-05-2009 at 09:29 AM..
puglover is offline   Reply With Quote
Old 11-05-2009, 09:32 AM   PM User | #18
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 5,123
Thanks: 2
Thanked 554 Times in 542 Posts
Fou-Lu is a jewel in the roughFou-Lu is a jewel in the roughFou-Lu is a jewel in the rough
BOM = byte order markers, generally within the first 4 bytes of a file saved as unicode.
I don't know how to change it in linux, in windows its a matter of opening it and saving as ANSI in notepad. All I can suggest is dump you're IDE and use a plain text editor like kate.
__________________
Code:
struct User *upFou;
userInit(upFou, "Fou-Lu", 1);
printf("%s has %s to %s\n", (*upFou).Name, !quitSmoking(upFou) ? "FAILED" : "SUCCEEDED", (*upFou).Smoker == 1 ? "FAIL" : "PASS");
// Fou-Lu has FAILED to FAIL?  Lol
Fou-Lu is offline   Reply With Quote
Old 11-05-2009, 09:36 AM   PM User | #19
puglover
New Coder

 
Join Date: Oct 2008
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
puglover is an unknown quantity at this point
you just used a lot of big words that i didnt understand...lol
puglover is offline   Reply With Quote
Old 11-05-2009, 09:40 AM   PM User | #20
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 5,123
Thanks: 2
Thanked 554 Times in 542 Posts
Fou-Lu is a jewel in the roughFou-Lu is a jewel in the roughFou-Lu is a jewel in the rough
Are you using a particular environment to write code? If so, abandon it and use a plain text editor (vi from the command line or kate if you're using kde).
__________________
Code:
struct User *upFou;
userInit(upFou, "Fou-Lu", 1);
printf("%s has %s to %s\n", (*upFou).Name, !quitSmoking(upFou) ? "FAILED" : "SUCCEEDED", (*upFou).Smoker == 1 ? "FAIL" : "PASS");
// Fou-Lu has FAILED to FAIL?  Lol
Fou-Lu is offline   Reply With Quote
Old 11-05-2009, 09:42 AM   PM User | #21
puglover
New Coder

 
Join Date: Oct 2008
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
puglover is an unknown quantity at this point
im using textwrangler...im on a mac...does that make a difference
puglover is offline   Reply With Quote
Old 11-05-2009, 09:48 AM   PM User | #22
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 5,123
Thanks: 2
Thanked 554 Times in 542 Posts
Fou-Lu is a jewel in the roughFou-Lu is a jewel in the roughFou-Lu is a jewel in the rough
No clue I'm afraid, I know nothing about macs >.<
Best I can tell, you should have an application called TextEdit. Looks like you'll need to change you're preferences to ignore rich text. Beyond that I'm afraid I can't help, but I'm betting you'll get some interesting characters to show up.
__________________
Code:
struct User *upFou;
userInit(upFou, "Fou-Lu", 1);
printf("%s has %s to %s\n", (*upFou).Name, !quitSmoking(upFou) ? "FAILED" : "SUCCEEDED", (*upFou).Smoker == 1 ? "FAIL" : "PASS");
// Fou-Lu has FAILED to FAIL?  Lol
Fou-Lu is offline   Reply With Quote
Old 11-05-2009, 05:56 PM   PM User | #23
Coyote6
Regular Coder

 
Join Date: May 2009
Location: Horn Toad Ville, CA
Posts: 144
Thanks: 7
Thanked 30 Times in 30 Posts
Coyote6 is an unknown quantity at this point
If you are using TextEdit you have to be careful how it processes line breaks... Sometimes it works when you make it plain text other times it keeps the format of the original file on the line breaks. I used to run into problems with it when editing .htaccess files that were accidently started as rich texts then converted over because the line breaks stayed in the wrong format.

Here is a link someone gave me from the MacForums.


http://hayne.net/MacDev/Notes/unixFAQ.html

The 12th item down is about the end line. It's sad to say but Notepad on Windows is about the most reliable thing without going through a file conversion. Sometimes I get TextEdit to work and others not so that's about the extent of my knowledge on that.
Coyote6 is offline   Reply With Quote
Old 11-05-2009, 07:33 PM   PM User | #24
puglover
New Coder

 
Join Date: Oct 2008
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
puglover is an unknown quantity at this point
thanks for all the help...after hours of trying i still couldnt get this to work on text wrangler...im just gonna go sit at my dads computer and copy everything into notepad++ and hope to dear god that works...if not ill be back
puglover is offline   Reply With Quote
Old 11-05-2009, 08:41 PM   PM User | #25
Coyote6
Regular Coder

 
Join Date: May 2009
Location: Horn Toad Ville, CA
Posts: 144
Thanks: 7
Thanked 30 Times in 30 Posts
Coyote6 is an unknown quantity at this point
Just be sure to check the line endings in the original Notepad... Notepad 2 uses different line endings than the original... I don't know about Notepad++ though. I'd copy paste all your code over when your done to double check it.
Coyote6 is offline   Reply With Quote
Old 11-06-2009, 01:33 AM   PM User | #26
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 5,123
Thanks: 2
Thanked 554 Times in 542 Posts
Fou-Lu is a jewel in the roughFou-Lu is a jewel in the roughFou-Lu is a jewel in the rough
Indeed, it may be appear as a single line in notepad. If thats the case, open it first in wordpad than choose save as a new filename. Than open in notepad, I think thats how I used to fix it between the Linux and M$ machines.
__________________
Code:
struct User *upFou;
userInit(upFou, "Fou-Lu", 1);
printf("%s has %s to %s\n", (*upFou).Name, !quitSmoking(upFou) ? "FAILED" : "SUCCEEDED", (*upFou).Smoker == 1 ? "FAIL" : "PASS");
// Fou-Lu has FAILED to FAIL?  Lol
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:52 AM.

Home - Contact Us - Archives - Link to CF - Resources - Top 

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.