-
Posts
3,372 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Muddy_Funster
-
If we aren't looking at all the code it's because you didn't post all the code. If code generates errors on one server and not another the code is at fault - either because one server is not showing the errors, or the code is badly written and is lacking in portability. XAMPP has been used successfully by thousands of developers for a number of years, to assume that it is at fault over the code which you yourself stated in your second post "isn't fixed" is simply stupid. If you go onto a public forum and ask for help, the logical followup to that is to accept the help given and work with the people whome you have already accepted as knowing more than you (or else you would not have posted the intial question) who are taking time out of their own day to help you for no personal gain to get a solution to your problem. In summary: XAMPP is not crap; Your code may or may not be crap (although I don't think it's actualy your code per-say); It is however you that is crap - You posted insufficent code You conflicted every one who atempted to offer advice (and even yourself at one point) You would rather blame another piece of software for the problems than accept ownership of the issues yourself You clearly don't even know the difference between Notices, Warnings and actual Errors (otherwise you would know that the first two can exist in crap code without the script it's self actually breaking - thus rendering your comment about the battlemd.net completly redundant) You have no interest in improving the code or your ability.
-
you could try $gamedata = $client->ProductItemSearch(array ('input'=>'something_to_search_for')); as you currently have an array that looks like this :array[1]( [0] =>'input') so you don't meet the requirement. failing that you will need to provide more information.
-
Embeded Web Page Leaves My Site When Links Are Clicked
Muddy_Funster replied to azpaul's topic in PHP Coding Help
Hmm....smells like a breach of just about every game sites end user agreament / terms of use on the net. I'll need some evidence that you are infact allowed to create a site of this nature (in writing and from the actual host of the actual game) before I even think about helping you achieve it - although there may be other less scupulous people on here that could assist without that. -
your error is because the query is failing, as such it is returning boolien false instead of the result resource that the mysql_result() and mysql_fetch_assoc() require. That is also not the same code that you posted in your OP. working ith the OP first - replace your single query line here : $total_record = mysql_fetch_array(mysql_query('SELECT COUNT(`product_id`) AS rows FROM `product`' )); //ERROR with the following (revised from inital post as I mixed up some variables): $sql = 'SELECT COUNT(`product_id`) AS rows FROM `product`'; $query = mysql_query($sql) or die("ERROR :<br>".mysql_error()."<br><br>Occured when trying to run the following query :<br><br>".$sql); $result = mysql_fetch_array($query); $total_record=$result['rows']; then apply the same design to the other queries in the second code section that you posted : ... $page_sql = "SELECT COUNT(*) FROM product"; $page_query = mysql_query($page_sql) or die ("ERROR :<br>".mysql_error()."<br><br>Occured when trying to run the following query :<br><br>".$page_sql); $page_results = mysql_result($page_query, 0) $pages = ceil($page_results / $per_page); $page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1; $start = ($page - 1) * $per_page; $sql = "SELECT * FROM product p JOIN category c ON p.category_ids = c.category_id LIMIT $start, $per_page"; $query = mysql_query($sql) or die ("ERROR :<br>".mysql_error()."<br><br>Occured when trying to run the following query :<br><br>".$sql); while($query_row = mysql_fetch_assoc($query)){ ... This is basic database debugging, you use the "or die()" function to stop the code execution in the event that the transaction with the database is unsuccessful. You then include the database server error and the query string that was sent to the server in there to show you what went wrong with the database transaction and what was sent in that transaction. This gives you something to work with when trying to find out what and where the problem is.
-
welcome to phpfreaks, please use the code tags around your code when posting it in the forum, it makes everyones life much easier. break down your query execution to make the code more managable, and add - as _EmilsM said - an or die() with the mysql_error() output to see what part of it is failing and why: $sql = 'SELECT COUNT(`product_id`) AS rows FROM `product`'; $result = mysql_query($query) or die("ERROR :<br>".mysql_error()."<br><br>Occured when trying to run the following query :<br><br>".$sql); $total_record = mysql_fetch_array($result); $total_record=$total_record['rows'];
-
erm...there is no loop in your PHP code. What is the content of the "guestbook.html" that you include in both those sections of code?
-
How to access a database with user logs in
Muddy_Funster replied to Icewolf's topic in PHP Coding Help
vardump will display the content of any variable that it is called against at the time that it is called. I wonder though, are you setting a cookie or are you using the PHP session superglobal? if you are setting a cookie it could be that the setting is the problem as well as/ instead of the getting. You should have some logic to check the existance of cookies and session variables before you call them in the code - people may have cookies turned off for example - to safeguard against trying to check against unset/non existant variables/content. -
inputting what errors, where and when?
-
please use code tags around your code when posting it here, it makes it much easier to read. Your error is coming from the fact that your query is failing. change your query lines to the following to better see what the problem is: $sql = "select * from users where UserName='$UserName' and Password='$Password'"; $login_query=mysql_query($sql) or die("Query Failed!<br><br>The server Reported the following : <br>".mysql_error()."<br><br> when trying to run : <br>$sql"); $row=mysql_fetch_array($login_query);
-
Error in uploading Image in Database
Muddy_Funster replied to tahakirmani's topic in PHP Coding Help
why on earth would you want to put the actual images into your database?- 4 replies
-
- mysql database
- uploading image
-
(and 2 more)
Tagged with:
-
How to access a database with user logs in
Muddy_Funster replied to Icewolf's topic in PHP Coding Help
var_dump() is used to "dump" the contents of a variable, it's used like var_dump($_COOKIE['username']); you can wrap it insord a die() for debugging variables as you work through your code, die(var_dump($_COOKIE['username'])); Actualy, unless defined in the code, mysql_fetch_array returns both associative and numerical array data - see here : http://php.net/manual/en/function.mysql-fetch-array.php -
I don't actualy get what you are trying to do here...
-
Untested, but something like the following should be close: SELECT factor_key, factor_m_time, factor_status FROM factors LEFT JOIN (SELECT factor_key, MAX(factor_time) AS factor_m_time, factor_status FROM factor_times GROUP BY factor_key) AS max_time_factors ON factors.factor_key = max_time_factors.factor_key
-
more information on your setup is required to answer this question.
-
Need help opening up a file and replacing text between 2 delimiters
Muddy_Funster replied to OM2's topic in PHP Coding Help
lookup the following on the manual website : file_get_contents(), substrpos() and substr_replace() - they should get you going along the right lines. -
what do you meen it works? you dont have anything in the success function for it to do...
-
How to access a database with user logs in
Muddy_Funster replied to Icewolf's topic in PHP Coding Help
you don't pass in the member id, you pass in what you think is the username (have you done a var_dump() of the actual cookie contents to check what's actualy in there?), also, you haven't called your sprintf properly, it should look something a bit like : $query = sprintf("SELECT Member_ID, Bank, Reward_1, Reward_2, Reward_3 FROM Points_Rewards WHERE username = %s", $memid); you don't need to "or die" the sprintf() function as it's coverd bt PHP's native error capture. Have you looked at using PDO at all? -
Print data in pdf or send data to printer
Muddy_Funster replied to maideen's topic in PHP Coding Help
You're actualy looking for javascript help here, not PHP, unless you want to print it out to a printer that is attached and installed on the actual webserver... -
Variable from one Function to another
Muddy_Funster replied to JarrodCoder's topic in PHP Coding Help
that's not really an object. You have basicly written procedural code and wrapped an object container around it, you could actualy take away the class{} from the outside of that code, drop the scope deffinitions and that would work just as it is in the raw page. Some key points to address - you have echo's within the methods within your object you never actually assign anything to your objects parameters you have a require within your object you have everything as public and - not specific to oop, but - you have a method named the same as a parameter -
want to upload image in the specified ul tag please help me
Muddy_Funster replied to rahultakle89's topic in PHP Coding Help
expand your question please -
unless you want to use something like PDO...then you'll need to get used to seeing -> about the place. To expand only a little bit on what KevinM1 has stated, the use of $this and -> are tools that only apply in PHP when you are working with objects. $this is called a psudo-variable as it is used to refference the object that it is within, and does not contain a value in and of it's self - it is dependant on the object that it is inside to five the value. -> is a lot like what it looks like, it lets you drill into an object to call non-static(and perhaps static?) methods (what you casll a functon that is within an object) and parameters (variables that are at the top level of the object). so for example: //declare the object by declaring a new class: class thisIsMyObject{ //make some parameters... public $a_parameter; public $another_parateter; //make a method... public funtion setParameter($val1, $val2){ $this->a_parameter = $val1; $this->another_parameter = $val2; } } //create the object : $myObj = new thisIsMyObject(); //assign values to the parameters using the method inside the object: $myObj->setParameters("first value", "second value"); //access the values: echo "Parameter 1 = {$myObj->a_parameter} and Parameter 2 = ".$myObj->another_parameter; //change the parameter directly: $myObj->a_parameter = "I changed this directly!"; $this doesn't seem to do much here, except maybe make things a little quicker and shorter. However, it does become really rather powerfull when you take it up a gear and use inheritnace, so even if you are just starting to touch the surface of PHP OOP you really do want to be getting into the habbit of using it.
-
Multiple Word Search Form MYSQL Database Help Please
Muddy_Funster replied to markguitarplayer's topic in PHP Coding Help
data sanitization is where you take what the user enters and clean it up, making it safe to send it to your back end. if you aren't doing this then anyone could come along and enter a value in your form that will drop all your tables and leave you with nothing. if you don't have any as of yet I would suggest that you include this. look into using mysql_real_escape_string() and also look into pregReplace to change all your spaces into either % or ? wildcards, depending on how loose you want to make the search. -
Multiple Word Search Form MYSQL Database Help Please
Muddy_Funster replied to markguitarplayer's topic in PHP Coding Help
where is your data sanitization? -
and the php for your email? EDT: Please use code tags when posting code - it makes everyones life much easier.
- 2 replies
-
- forms
- sending email to my self
-
(and 1 more)
Tagged with:
-
rpg attack system, need help on to make unique forms
Muddy_Funster replied to Monkuar's topic in PHP Coding Help
preventing people from botting has been a bugbear of MMO developers for as long as there have been MMOs. There's not enough to work with for us to make practical suggestions for your code,