lonewolf217
Members-
Posts
642 -
Joined
-
Last visited
Never
Everything posted by lonewolf217
-
[SOLVED] Can't get PHP to print a result of an sql query.
lonewolf217 replied to heldenbrau's topic in PHP Coding Help
change $mysql->query() to $mysqli->query() -
[SOLVED] Can't get PHP to print a result of an sql query.
lonewolf217 replied to heldenbrau's topic in PHP Coding Help
also, put this at the top of your page to view any other errors <?php error_reporting(E_ALL); ini_set("display_errors", 1); -
[SOLVED] Can't get PHP to print a result of an sql query.
lonewolf217 replied to heldenbrau's topic in PHP Coding Help
maybe its just MSSQL, because when I run this select * from table where action like "%login%" i get "Invalid column name '%login%'" -
[SOLVED] Can't get PHP to print a result of an sql query.
lonewolf217 replied to heldenbrau's topic in PHP Coding Help
take out the slashes <?php $sql = "SELECT rating from users where username = 'Chris'"; I am not entirely sure if this will work with your class structure, but try it <?php $result = $mysqli->query($sql) or die(mysql_error()); if it doesn't, then you should just take exactly what you have for your $sql statement and throw it into your sql query engine and try to run it manually to see what the errors are -
[SOLVED] Can't get PHP to print a result of an sql query.
lonewolf217 replied to heldenbrau's topic in PHP Coding Help
SQL requires single quotes for text fields (i.e. around 'Chris'), double quotes wont work from my understanding. your bigger problem though is you do not close the bracket for your else statement which is probably causing the page to not show. You need to turn on error reporting to see the errors for stuff like this -
I am not sure if this was your latest code or not, but i think the problem may be here else{echo "<option value='$noticia2[cat_id]'>$noticia2[category]</option>";} you are assigning a value to the option of the category ID rather than the name. the "value" field is what will be sent to the next page. Change it to else{echo "<option value='$noticia2[category]'>$noticia2[category]</option>";} and i think it should work
-
php isn't used for design. that is javascript or css typically
-
this means there is something wrong with either your database connect or your query. try putting "or die(mysql_error());" at the end of those lines to see what the problem is
-
you can look into the suckerfish menu for a nice simple sample http://htmldog.com/articles/suckerfish/dropdowns/
-
i wouldn't turn that down if its solved, dont forget to click the Topic Solved button !
-
and what happens when you make the modification to $location in your script ? You will probably also have to manually update what is already in your database <?php $location = "/profileimages/$name";
-
link to results rather than automatically display
lonewolf217 replied to DanielHardy's topic in PHP Coding Help
http://www.w3schools.com/PHP/php_file.asp look into using a for or while loop with fgets and a simple counter. once you hit the 5 records you want, display a link and close the file -
try just opening "www.domain.com/profileimages/(name of the image)" from your browser and see if it shows up properly. If it does, I would suggest taking out the dirname(__FILE__) from your $location variable. If it doesn't, you need to check what the actual path to the file is
-
[SOLVED] Yet again, more homework help... :/
lonewolf217 replied to Joe Sai's topic in PHP Coding Help
Regardless if you dont know exactly what your code does, your syntax needs to be correct so you can take it one step at a time to make sure each part works. That is how you debug code, not posting it to a site and hoping for a magic response -
[SOLVED] Yet again, more homework help... :/
lonewolf217 replied to Joe Sai's topic in PHP Coding Help
the first thing to fix is your syntax errors. turn on error reporting and make sure your parenthesis match up -
How to make a page to complete the updating.
lonewolf217 replied to mister X's topic in PHP Coding Help
where is the code that uses PHP_SELF ? are you referencing it as $_SERVER['PHP_SELF'] ? -
i think the problem lies here <?php $location = dirname(__FILE__)."/profileimages/$name"; from here http://us2.php.net/manual/en/function.dirname.php it looks like this will get the pathname of the page that is currently loaded, or "/customers/squiblo.com/squiblo.com/httpd.www". You then append the path that you do want to the end of this, bringing you to the monstrosity in your database. do you happen to know what the correct path of the file SHOULD be ? perhaps then we can see exactly where the problem is, but right now I do not know what your expected directory structure is
-
[SOLVED] problem with select button & array
lonewolf217 replied to yami007's topic in PHP Coding Help
are you talking about foreach ? in your case, what happens if $countries array changes in size in your included file. then you will have to remember somehow to change the value of your while loop else it will start chopping off countries. with a foreach loop it will automatically go through each index of the array no matter how large it is. Did it not work when you pasted my code ? -
[SOLVED] simple html applied to output
lonewolf217 replied to DanielHardy's topic in PHP Coding Help
dont forget to mark the topic solved -
[SOLVED] simple html applied to output
lonewolf217 replied to DanielHardy's topic in PHP Coding Help
i think the problem is with your quotes here $string .= "<font color="#2766c5">" . $_POST['message'] . "\n<hr>"; to $string .= "<font color=#2766c5>" . $_POST['message'] . "</font>\n<hr>"; and also you aren't closing any of your HTML tags, which can cause problems with strip_tags. make sure your <b> and <font> tags are all properly closed -
[SOLVED] problem with select button & array
lonewolf217 replied to yami007's topic in PHP Coding Help
<?php sort($countries); foreach($countries as $tempCountry) { echo "<OPTION value='" . $tempCountry . "'"; if($country == $tempCountry) { //country is a match echo " selected='selected'"; } echo ">" . $tempCountry . "</OPTION>"; } [code] the problem in your code is that you are echoing the value of the array index regardless of it matches or not, then you are echoing it a second time if it does match. Regardless, using foreach is always cleaner than trying a while loop to go through an array -
[SOLVED] simple html applied to output
lonewolf217 replied to DanielHardy's topic in PHP Coding Help
thanks, didn't read that far in the manual -
check two things 1) what is the location that is in the database 2) is the file actually at the location that you want it to be in ? I am a little hazy on file uploads, but I do not understand this part <?php //get file attributes $name = $_FILES['myfile']['name']; $tmp_name = $_FILES['myfile']['tmp_name']; // <----------- where is 'tmp_name' coming from ?? // and then later move_uploaded_file($tmp_name,$location); // <------- are you sure it is moving the file where you want it to be ?
-
[SOLVED] simple html applied to output
lonewolf217 replied to DanielHardy's topic in PHP Coding Help
when you view the page source what does the output look like ? it seems you are running strip_tags before writing to the file. This will remove any type of formatting that you use -
I KNOW ITS A SIMPLE MISTAKE!!! WERE IS IT -_-
lonewolf217 replied to duffman014's topic in PHP Coding Help
dont forget to mark the topic solved