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!
Thanks but I just get this:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #2' at line 1
I even changed the db field name to CWith and still get that.
I don't think that error is being caused by that call to mysql_query(), because it seems you are passing a resource ID to mysql_query() where the error is triggered, which basically means you're trying to execute a resultset as a query.
Try putting all your queries into a query variable and changing all your mysql_query() calls to something like:
Can some one tell me how I could go about retrieving data from db then some how putting different data in different areas of the page without having to echo all the html within the php blocks. Are there global variables or something I don't know about?
vexus wrote:I fixed it by using a different method.
Wait. How did you fix it? Someone in the future (maybe me) may run into the same problem and read here only to have the last page of the story ripped out!
vexus wrote:Can some one tell me how I could go about retrieving data from db then some how putting different data in different areas of the page without having to echo all the html within the php blocks
What's wrong with PHP blocks? Perhaps you mean without using quoted strings. In that case, PHP was built for such syntax. You can see examples of doing this here: http://www.php.net/manual/en/language.basic-syntax.php
I can't help but remember the story of the guy who's driving around San Francisco's financial district, desperately looking for a parking place, since he's already late for a very important meeting. (If you're not familiar with S.F. downtown parking, just take my word for it, it's practically impossible!) He starts praying, "Oh Lord, this is SO important to me! I've just got to park this car and get to the meeting! I know I haven't been a faithful husband, and I drink too much, and I haven't been to church in years, but if You would only help me find a parking place right NOW, I promise I will quit running around on my wife, and I'll stop drinking, and I'll be in church EVERY Sunday, and ..." Suddenly, right in front of him, miraculously, a car pulls out of a space. The guy darts into the space, as he looks heavenward and says, "...oh, never mind, I just found one!"