-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
[SOLVED] Warning message when I try to run script
.josh replied to mariocesar's topic in PHP Coding Help
assuming your code for actually connecting to the database is in your config.php, if you are calling your changepw function before your other functions that include config.php, no connection is being established, because you are having it be included in your other functions. Based on the code you have provided, I think if you simply include the config.php inside your changepw function, it should work.... assuming config.php is in fact where you connect to the db. p.s. - $query="Select pw from user where uname='$name'" or die(mysql_error()); $result= mysql_query($query); I think you probably meant to do this: $query="Select pw from user where uname='$name'"; $result= mysql_query($query) or die(mysql_error()); The way you have it now, the only way a mysql_error will be executed is if the assignment of your query string to your $query variable somehow fails... -
by "we" you mean you right? Or did my monthly check get lost in the mail
-
for added protection, depending on the type of data you are expecting, you can have an array of allowed data and check if it specifically matches. for instance, if you have a dropdown in a form or a get var or something and let's say the options are colors, like red, green or blue. you could specifically check it like so: $allowed = array('red','green','blue'); $color = (in_array($_GET['color'], $allowed) ? $_GET['color'] : 'red'; // or some other default this obviously only applies to data that the user isn't supposed to enter some arbitrary thing. However, expanding on that principle, you should check for what IS expected. Is the user supposed to be entering in a url or email address? Do some regex to see if it's the right format. Some piece of info in the data that you are expecting it to contain? Check for it. etc...
-
[quote author=Nameless12 link=topic=124424.msg516336#msg516336 date=1170100340] [quote author=Crayon Violent link=topic=124424.msg516261#msg516261 date=1170095211] So you're going to give up on WAMP, just like that? So what happens if you have issues installing Xampp? Are you gonna go find something else? If you don't take the time to figure out what is wrong and fix it, you will never learn anything. You wonder why people get frustrated with you. Well that's why, right there. People offer advice and try to help, and you casually push it to the side, without even making an effort. Now you can argue that you are making an effort. You can argue that you spent hours, days, weeks on it. But I refuse to believe that you are making a serious effort...unless you just aren't capable of doing it. Are you not capable of doing it? [/quote] So you are telling him to go and learn WAMP?? that is the dumbest idea I have heard. People use WAMP and things like it because they require no effort to setup. It is stupid to learn WAMP and if you wanted to tell him to learn something tell him to start learning apache\php\sql administration but that said, administration and programming are different jobs for a good reason..... [/quote] Why are you being a jackass? That's not what I said and you know it.
-
So you're going to give up on WAMP, just like that? So what happens if you have issues installing Xampp? Are you gonna go find something else? If you don't take the time to figure out what is wrong and fix it, you will never learn anything. You wonder why people get frustrated with you. Well that's why, right there. People offer advice and try to help, and you casually push it to the side, without even making an effort. Now you can argue that you are making an effort. You can argue that you spent hours, days, weeks on it. But I refuse to believe that you are making a serious effort...unless you just aren't capable of doing it. Are you not capable of doing it?
-
Well then I guess some cosmic fluke might have happened. Maybe some error occured in the download process that cause a single bit of data to be lost or something, and that single bit of data happened to be whatever mechanism involved in showing your phpinfo. I mean sure, that sounds incredibly unlikely; laughably unlikely even, but it's not impossible... so maybe you should uninstall it, go back and download it and try again. Surely lightening won't strike the same place twice.
-
[quote author=steelmanronald06 link=topic=124424.msg516131#msg516131 date=1170084306] i have used WAMP5 server and phpinfo works perfectly for me. Which means you have deviated your settings from the initial install settings [/quote] Same here. I downloaded it, clicked the install button, left everything as default, and it worked right out of the box. No having to tweak nothin', no having to google some issue or ask some question to figure out why something won't work..nothin'. So I'm not trying to imply nothin' here, so please don't take it the wrong way, but honestly, I don't see how someone can screw up installing WAMP.
-
You know, it's been my personal experience that people usually don't get all that upset when other people accuse them of doing something wrong...unless they are in fact doing something wrong.
-
i'm a noob at php.ini config, but would it not show if php was in safe mode? just a random guess.
-
@chronister: the do..while loop is technically fine. The difference between do..while and while... is that the stuff inside the do...while loop will always be executed at least once: the first time. With the while... loop, it will only execute (even the first time) if the condition is met. @edawg: when you execute a query, it returns a result source. You must then use a function to grab the info from the result source (mysql_fetch_assoc is one such function). mysql_fetch_assoc grabs the info one row at a time, so you that's why you loop the actual function call. example: [code] $sql = "select column1 from table"; $result = mysql_query($result); while ($list = mysql_fetch_assoc($result)) { echo $list['column1'] . "<br/>"; } [/code]
-
okay you're over-complicating it. Look at this example: [code] function blah($something) { echo $something; } blah("foobar"); // will call function blah, which will echo "foobar" blah(); // will produce an error, because it expects an argument to be passed [/code]
-
that error means that your function is expecting another argument to be passed to it, but you are only passing 1 argument.
-
All of the suggestions here should work. If it's not working, then your problem is somewhere else. You're going to have to post some other code. For instance, post the portion of your code and surrounding lines, where you call this function, including where you assign the data that's being passed to the function.
-
look into the gd library
-
[code] function setup_page ($title) { $title = (isset($title) || trim($title) != 0) ? "My Database $title" : "NO TITLE"; echo "<html><head><title>$title</title>"; } [/code] but orio's is better. kinda. I guess it depends on where the $title data is coming from.
-
Output Rows In Pagination In Descending Manner
.josh replied to itsureboy's topic in PHP Coding Help
SELECT * FROM pages order by desc LIMIT $from, $max_results -
first thing I would do is separate my query string from my query and echo the query to see if I'm sending what I think I'm sending to the db.
-
are you sure your file is in the right public directory? I believe wamp's default public directory is c:\wamp\www\yourscript.php Are you sure you are typing the right address in your url? It should look like http://localhost/yourscript.php
-
that's not quite right. all your unset is doing is unsetting the current $value variable, not the array. It needs to be more like: [code] foreach($array as $key => $val) { if $(val['name'] == '-') { unset($array[$key]); } } [/code]
-
... he just showed you? $result executes the $sql query string. Then the while loop fetches an array of all the column in your table, one row at a time. Inside this loop, $thing, $thing2, and $thing3 are all being assigned specific elements in that fetched array - specific data from the columns of your table. Then he shows an example of echoing that data out. The only thing he really left out is wrapping an html img tag around one of the $thing variables; whichever one represents your image name. But surely you at least know how to do that...
-
So nameless, to sum up your thoughts, basically what you are saying is that until you can bust out good code, you are a beginner. Is that right? If not, please clarify, because several people (myself included) have tried to explain that "good" is just some arbitrary term when it comes to coding, and that whether it is "good" or not is largely determined by the circumstance at hand. It seems to me that you fail to really understand that. Or at least, agree/accept that. Do you happen to have some hard and fast rule to determine whether code is "good enough" or not, irrespective of circumstance? If so, I would be most interested in hearing/discussing it.
-
To clarify though, I disagree with the notion that that makes PHP a "noob" programming language, where people would step up to "bigger and better" languages eventually. It is not some simple, poor quality language.
-
I'll agree with that statement. PHP is free, therefore more people flock to it.