PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I'm doing a project that I am hazy on php, and I have to finish it, no matter what.
I got this code:
http://"www.domain.com/clients.php?feature_num=2 in the browser
So can you just fix it up for me and I'll study it and learn from that? Because I'm goin back and forth on this forever and reading text books and forums and I don't quite get it yet, but when I SEE it I will!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Last edited by cybergirl on Mon Aug 20, 2007 12:04 pm, edited 1 time in total.
http://"www.domain.com/clients.php?feature_num=2 in the browser
Those are totally different links, resulting from totally different lines of code. One thing that you need to realize is the the $_GET array is just an array.. Nothing special about it, so treat it like a regular array. You still have to put quotations around the associative member names.
There are two correct ways to output data from an array as a part of an echo:
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi I hope I post this right, please excuse, I'll keep trying but I didn't comprehend the posting directions because it didn't say (at the link I was given), HOW to get the code into those boxes, as in what to put to make it do that. So this is what I read, so it should be correct.
Anyway, I also don't quite understand the directions for my question, but here is my attempt. Could you please correct me where I'm wrong please, and show me how you did it, please could you?
So I'll try it. You wrote:
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Oh I see, sorry about the posting directions...I think it was dug deeper in that page, because I finally saw how it was done, and I'm truly sorry. When I took my advertising art course, they said that people are bombarded by too much information and signs, and they tend to miss a lot, so you have to be limited to few words, or else people end up missing things. At the time I was 10 years younger, and I still had the ability to keep on top of it all because younger people have more energy and it declines as you age, and since I've read so much in my lifetime, I guess I'm declining quicker!
I'm really sorry, and I apologize. I should have spotted it!
tags are important. Do you se the highlighting error? You can't use single quotation marks in that echo statement because it is completely surrounded by them. Also, why do you have a double quotation mark before your anchor tag? You're getting farther away from a solution... I think you need to take the time to stop and think about what it is that you are writing.
And a quick note, the inline way of putting the data into a string (the second way I gave you) only works inside of double quoted strings.
Thanks, I really don't have a clue what I'm doing anymore, but I think what you said should help me if I keep on trying. You're right I have trouble with quotes, once things get more complex, I really get mixed up with them. I'll try. Thanks.
If you have troubles with quotes/braces you should use some code highlighting editor and after few days of coding you will quickly find qote/brace issues.
A good approach is to write exactly what you want manually, echo it to make sure it's what you want, then slowly replace the hard-coded values with variables. This is the sort of approach that helps with debugging anything, even far beyond echoing strings, and is a good approach for staying organized and focused.
Make the result, then make it so that your code will produce the result. Give yourself a visual goal.
echo 'Using single quotes <br />';
//Using single quotes
echo "Using double quotes <br />";
//Using double quotes
//We don't need to escape different kinds of quotes when inside opposite quote type
echo 'Mixing "double" and single quotes';
//Mixing "double" and single quotes'
//We need to escape the single quotes inside this string or else php interprets it as terminating the string and causing a parse error
echo 'Escaping single quotes to use inside this \'string\'';
//Escaping single quotes to use inside this 'string'
The fourth example is why you are recieving an error. Compare your strings with the one in that example.
Thanks very much! Very helpful! I will try what you said, and I think now it's starting to come together in my mind! Where do I get a highlighter? Anyway, I'll try it tomorrow and if I still feel stuck I'll be back but just letting you know, this was really the best help I've gotten in a long time from anything or one!
hi, I got no time left, I cant' spend all day doing this, I'm ten days away from a deadline, and only 20% done, and I've been working on this for a month and a half. I've tried all manner of things, and I really cannot figure this out. Here's the last thing I tried. I need to put it in double quotes obviously, to make it pass the variables, BUT I get errors no matter what I do. How do I fix this, because I tried all kinds of things, and nothing works, just nothing. I really tried.
For the heredoc syntax no spaces may be after the echo <<<EOIMAGE and the EOIMAGE is just a unique tag so you can change it as you want. You also cannot put put in php commands hence the build of variables beforehand. More information can be found here
If the $row values are simple a-z and/or 0-9 characters (no € , or other characters) you could skip the urlencode and simply replace {$tourid} with {$row['tourid']}.
I found that the first one with htmlurlencode worked, and I guess the next one was good but it didn't do it. So this has been solved, and I'm REALLY happy! I can go on now! Thanks to bits! thanks you soooooooooooo much!