![]() |
I need of some help here
Sorry i misspell the topic name xD
Is the problem in this script that i am not calling out the news part with PHP Code:
It is suposed to switch around to news cat 1 news cat 2 so all the post with cat id 1 gets that in cat 1 etc.. it worked with my links but not on this so whats wrong ??.. Thank you in advance PHP Code:
My cat table, Code:
CREATE TABLE `cat` (my news table Code:
CREATE TABLE `news` (Code:
CREATE TABLE `users` ( |
|
i found a bug i had 2 "where" changed it to and but still not working
PHP Code:
|
this is the complete code
PasteBin.be |
like 100 php Guru's here and no one can help me? :S
|
while($website_row = mysql_fetch_array($web_result))
check $web_result before that line and post it here please. --- sorry, $cat_result |
PHP Code:
|
I am not fully understaing what is not working, but here are some things I have noticed that may be messing with things:
-Is your query returning with anything? Because your sprintf is looking for the string while you appear to be needing an integer. -You check cat_result before your assign it, you also dont use a $ sign. Your program will most likely die nothing (mysql_error will be blank) every time since you are checking a blank variable for being blank. It could also be of error that sprintf may be canceling the value out (this is, among other reasons, why I don't use sprintf). |
hum how can i still do the thing i am doing with the spaces,
with out sprintf? EDIT: while($cat_row = mysql_fetch_array($wes)) { is causing problems :S 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 '= '2'' at line 1 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource on line 90 Aaron: noting of that helped. and PS, i did not want to have all the code on the same post to much better spreed it out, PS, Free Wordpress Themes for wordpress styles. |
You need to get rid of the spaces around the equal sign... and your quotation marks seem weirdly placed.
Also, there is an edit button right next to quote post, so you don't need to keep replying :/ |
From what i can gather, you want the news to be displayed depending on the cat GET request value, i.e. filtering if its specified?
Your code was abit of a mess, alot of breaking in and out of PHP cycles for no reason, i attempted to clean it up abit but it still needs work, but that said it now filters the news, i.e. index.php?cat=1 will display all news with cat_id of 1: PHP Code:
|
thank you but i keep it messy because its my way of learning i keep it dirty its my way but thank you for your help but i still want to figure out what the error was..
so i wont use your code :) but thank you so much for your time! + when i try to use the script the firefox stops and prints cookie error :S |
Quote:
|
sketchMedia:
have you any idea why i get cookie error? when i test your script :S |
THIS IS THE USER CODE PHP Code:
|
try moving the session_start(); to the top, as you are getting headers already sent errors.
|
Okay, first of all, and please don't take offense, but that's some messy code. Even starting out you should start to learn and employ practices that will greatly reduce and aid in your future debugging issues. You can learn some of these practices by paying attention to the coding practices of other members here (something that has greatly influenced and helped mine), or you can develop your own style ground up, but the more readable your code is, the better you are going to code, period.
Edit: I just noticed sketch told you this too, I'm not trying to rag on you for it, and trust me mine gets messy when I get going too. It's just good practice to clean up a little, especially when you start to have problems you can't figure out. Sometimes just cleaning things up will help you discover the problem. Here's what I think you're trying to do, and with as little modification as possible (I left your tables in, as opposed to doing up some CSS for you, for example), how I might do it. See if it works for you. PHP Code:
|
Quote:
|
if you are trying to give out pointers with a code please don't
give a snippet of code with a new error ;) PS thank you! PHP Code:
Quote:
|
You guys had a nice little conversation there while I was going over everything. FINE. I'll just sit in the corner.
-m |
| All times are GMT. The time now is 02:13 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0