
Mattyspatty
Members-
Posts
76 -
Joined
-
Last visited
Everything posted by Mattyspatty
-
[SOLVED] Help with "Attempt to assign property of non-object"
Mattyspatty replied to shelluk's topic in PHP Coding Help
i didnt exaplin properly... $mxservers[$i] becomes an int, string or whatever type $pref is, this then means that $mxservers[$i]->host does not exist as it is not an object. -
want to convert following code into function
Mattyspatty replied to tested_123's topic in PHP Coding Help
people dont like to do code for you. function rname($dirpath,$oldFileName,$newFilename) that is a step in the right direction, its just a case of renaming variables to work with the functions input. if you have a try but have errors or cannot seem to get it working correctly then post again and people will take a look -
Deleting multiple variables, but i can send one from the forum.
Mattyspatty replied to Rommeo's topic in PHP Coding Help
you need to name your check boxes like an array. <input name="fave[A]" type="checkbox" value="true"> <input name="fave[b]" type="checkbox" value="true"> <input name="fave[C]" type="checkbox" value="true"> for the POST you should use a foreach to read through each submitted value if(isset($_POST['fave'])) { foreach($_POST['fave'] as $id=>$value) { echo $id."<br/>"; } } if i checked box A and box C then i would get the output A = true B = true where A is the index array and true is the value of the checkbox (in your case, $page) hope this helps. let me know if i misunderstood your question or need more help -
[SOLVED] Limiting result display by 3 across?
Mattyspatty replied to wmguk's topic in PHP Coding Help
while ($row=mysql_fetch_assoc($result) missed a second ) and reguarding to the original problem, this should have your desired effect <?php $i=0; echo '<table>'; while ($row=mysql_fetch_assoc($result)) { if($i==0) echo '<tr>'; echo '<td>'; // do rest of column echo '</td>'; if($i==2) { echo '</tr>'; $i=0; } else { $i++ } } echo '<table>'; ?> -
[SOLVED] Help with "Attempt to assign property of non-object"
Mattyspatty replied to shelluk's topic in PHP Coding Help
this is an error of trying to assign a property of an object that does not exist (as the error suggests) assuming the error is on this page (without page name and line numbers its hard to tell). $mxservers[$i] = $pref; $mxservers[$i]->host = $host; this is the probably problem, because $pref is not an object/class and $mxservers will become the same type as $pref. (string, int etc.) perhaps you intended this: $mxservers[$i]->pref = $pref; $mxservers[$i]->host = $host; -
[SOLVED] You have an error in your SQL syntax
Mattyspatty replied to Thomisback's topic in PHP Coding Help
$check = mysql_query("SELECT * FROM phaos_users UID='$userid'") you missed a WHERE -
[SOLVED] Limiting result display by 3 across?
Mattyspatty replied to wmguk's topic in PHP Coding Help
let me clarify, you want a table something like this: RES_1 RES_2 RES_3 RES_4 RES_5 RES_6 where RES_* is a new row from the database? -
you can run an SQL query that should achieve all that for you using http://dev.mysql.com/doc/refman/5.0/en/join.html. its been a while since ive used it so try asking in the MySQL forums.
-
many variable, many if statement scenario, another way?
Mattyspatty replied to johnseito's topic in PHP Coding Help
oh sorry i slightly misunderstood your question. i think the simplest way is to just use the if statements. -
many variable, many if statement scenario, another way?
Mattyspatty replied to johnseito's topic in PHP Coding Help
try <input type="text" name="username" value="<?php echo $_POST['username'];?>"> if username is not set then it will be an empty text box -
Using the character " in html forms doesn't work?
Mattyspatty replied to pinacoladaxb's topic in PHP Coding Help
also consider using this function http://uk.php.net/manual/en/function.htmlspecialchars.php -
what exactly is the problem? ***EDIT*** was only showing the qoute :/
-
the "Oops page not found" error means that your page does not exist in the place your looking for it (perhaps a spelling mistake?) check your pages are in the correct place and spelt correctly
-
[SOLVED] Problems writing checkboxes to DB in php
Mattyspatty replied to mkalinow's topic in PHP Coding Help
if you are using an array in the form (headquaters[]) then look into using foreach to retrieve all of the values. -
its something to do with the characterset of your browser. i think you can resolve it by using the HTML code for it. try £ or £
-
[SOLVED] Problems writing checkboxes to DB in php
Mattyspatty replied to mkalinow's topic in PHP Coding Help
i think i may see what your problem is, but im not certain. what errors are you getting? and can you paste the code for the check boxes -
this piece of code will create a checkbox, $checked is either NULL or the word 'checked' which will cause the checkbox to be checked when the page is loaded shouldnt be too difficult for you to alter it. <?php if($row['checked']==1) { $checked = "checked"; } else { $checked = ""; } echo "<input name=\"image[$row['img]\" type=\"checkbox\" value=\"true\" $checked >" ?>
-
$sql = mysql_query("SELECT `money` FROM `members` WHERE `username`='$username'"); $new = $sql - 5000; $update = mysql_query("UPDATE members SET money='$new' WHERE username='$username'"); $sql will be a resourceid. you need to do a mysql_fetch_array or mysql_fetch_rows first to get the actual value of money
-
you can do all that with 1 SQL query. SELECT * FROM table_Group WHERE (ID=1 OR ID=2) AND (val=1 OR val=3)
-
do you have the code for music.php?
-
[SOLVED] selecting 3 values for same item in table
Mattyspatty replied to Hardwarez's topic in MySQL Help
what exactly isnt working about it? does it fetch no rows? does it return an error? -
[SOLVED] SQL error, cannot find the problem
Mattyspatty replied to Mattyspatty's topic in PHP Coding Help
yay! that works, must be the different PHP or MySQL version or something on the new server. thanks Ray -
my friend has created this query $res = mysql_query( "SELECT `users`.`id`, `users`.`admin`, `users`.`exp`, `characters`.*, `villages`.`element`,`villages`.`explore`, `villages`.`village` AS `villagename`, `fight_styles`.`name` AS `fightstyle`, `bloodlines`.`name` AS `bloodline` FROM `users` INNER JOIN `characters`, `villages`, `fight_styles`, `bloodlines` ON (`users`.`username` = `characters`.`username`) AND (`villages`.`ID` = `characters`.`village`) AND (`fight_styles`.`ID` = `characters`.`fight`) AND (`bloodlines`.`ID` = `characters`.`blood`) WHERE `users`.`username` = '" . $_SESSION['username'] . "' LIMIT 1" ) or die(mysql_error()); he is having some problems working out why it no lnoger works after transferring to a new server. we have checked the database but keep getting this error: You have an error in your SQL syntax near ' `villages`, `fight_styles`, `bloodlines` ON (`users`.`username` ' at line 5 does anyone know what could be a possible cause?
-
trying to get cookie info from another location
Mattyspatty replied to Mattyspatty's topic in PHP Coding Help
[quote=mattyspatty]the user visits a page, they have cookie data and i want the image to be able to read the cookie data[/quote] the image is generated on counter.php. and the page image.php shows the image (yes i realise that i should have done it the other way round now!) i want the image on counter.php to be able to collect the cookie info from image.php