-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
move this: $_SESSION["username"] = "$username"; to here: [code] if (mysql_num_rows($result) != 1) { include("signin.php?error=invalid"); exit(); }else { $_SESSION["username"] = $username; header('Location: memers/index.php'); } ?> [/code]
-
That dress looks very becoming on you. If I were on you, I'd be <badword> too.
-
unless you have set your server to parse the file type (.php, .html, .blah) as php, it won't parse the php.
-
can you show a db structure?
-
There is no way anybody could possibly even begin to suggest a database structure for you. We don't know what your client's needs are. We don't know what "items" they may or may not have. We don't know how they want those "items" handled. In short, we know absolutely nothing about your clients. You did not get more specific; all you did was rephrase your vague question into something else equally as vague. But here's the catch-22: If you are going to go through the trouble of spelling out each and every single facet of your company's needs (which you would have to do), and if we are going to go through the trouble of creating a structure to fit those needs, then this would be going beyond helping you fix your code, to writing your code for you, which we don't do here. If that is what you are looking for, then take AndyB's suggestion and ask someone to do it for you in the freelance forum. Or just hand the project off to someone else. Or something. Because no offense, but if you are asking really vague questions like these: then chances are you are in over your head in the first place.
-
Please refer to rule #1 in the link of my siggy.
-
kinda off topic, but speaking of your game, sharkbait, did you ever finish it?
-
yeah i scoured the admincp and usercp from top to bottom and just couldn't find an option for that (on my board where I have full admin rights). I also tried to do a forum search for it on smf's forums, but didn't really come up with anything. I didn't try that hard, though. I kept getting these posts with a bunch of code in them, so i gave up. I then tried googling it but didn't come up with anything either. Again, I didn't really try all that hard though. However, I did notice that on smf's board, if you go to the user profile, it is missing a whole bunch of stats altogether. So there must be some way to alter it. Maybe only from the code itself; i dunno.
-
[code] echo $priceList[0][0]; // echos 12 echo $priceList[0]['price']; // still echos 12, since you used fetch_array echo $priceList[0][1]; // echos blah echo $priceList[0]['item']; // still echos blah, since you used fetch_array echo $priceList[1][0]; // echos 56 echo $priceList[1]['price']; // still echos 56, since you used fetch_array echo $priceList[1][1]; // echos blah2 echo $priceList[1]['item']; // still echos blah2, since you used fetch_array echo $priceList[2][0]; // echos 72 echo $priceList[2]['price']; // still echos 72, since you used fetch_array echo $priceList[2][1]; // echos blah3 echo $priceList[2]['item']; // still echos blah3, since you used fetch_array [/code] notice the pattern, the [i]loop[/i] you could make, because of the pattern...
-
I think it would help clarify this whole array thing if I were to explain it with a query that pulls data from more than 1 field. if you were to do (using this example data in your table): selling: price item 12 blah 56 blah2 72 blah3 "select price, item from selling" then you would have 2 elements in your fetch array. example: [code] $sql = "SELECT price, item FROM selling"; $result = mysql_query($sql); $price = mysql_fetch_array($result); echo $price[0]; // echos 12 echo $price['price']; // still echos 12, since you used fetch_array echo $price[1]; // echos blah echo $price['item']; // still echos blah, since you used fetch_array [/code] notice how $price[1] does not echo out 56, but the 2nd field. The fetch array returns an array of all of the fields you selected from the query. so if you select only price, you only have $price[0]. In my example, I selected price and item, so now you have 2 elements, 0 and 1. If you want to get the next row of values, you need to do another fetch_array. Each fetch_array function call returns the next row in the result source that you assigned to $result. that is why the while loop is introduced. we retrieve the row from the result source and store that array in another array, making an array of arrays (a multi-dimensional array). Using my example of pulling data from more than 1 field: [code] while ($price = mysql_fetch_array($result)) { $priceList[] = $price; } echo $priceList[0][0]; // echos 12 echo $priceList[0]['price']; // still echos 12, since you used fetch_array echo $priceList[0][1]; // echos blah echo $priceList[0]['item']; // still echos blah, since you used fetch_array echo $priceList[1][0]; // echos 56 echo $priceList[1]['price']; // still echos 56, since you used fetch_array echo $priceList[1][1]; // echos blah2 echo $priceList[1]['item']; // still echos blah2, since you used fetch_array [/code]
-
okay you are overcomplicating it. [code] $sql = "SELECT price FROM selling"; $result = mysql_query($sql); while ($price = mysql_fetch_array($result)) { $priceList[] = $price; } [/code] okay now you have an array called $priceList. Each position in the array is a "row" returned from your query. so: [code] $sql = "SELECT price FROM selling"; $result = mysql_query($sql); while ($price = mysql_fetch_array($result)) { $priceList[] = $price; } echo $priceList[1]; // echos the 2nd one // echos all of them foreach ($priceList as $val) { echo "$val <br/>"; } [/code]
-
It includes "blank" lines. However, your error may or may not actually be on that line. That line is where php first runs up against disagreable code. Example: if you forgot to close out a string (the closing " quote) php will go on parsing stuff as if it were still a string, until it hits something else that terminates the string (like the next instance of a " it finds) and then it expects a ; but since chances are that " it found was the beginning of some other string you had, it won't have a ; after it so it will throw you an error on [i]that[/i] line, even though your missing " happened somewhere before that - maybe 1 line before it, maybe 100 lines.
-
okay so you made a new object called $session and you have a __contstruct which calls Initialize when you instantiated $session. All Initialize() does is session_start();. It doesn't actually call your other methods, like SetValue or anything. After $session = new CSession(); you need to add something like $session->SetValue("somevariablename","somevalue"); however, i'm not sure you are really going about this the right way. It doesn't make sense for you to make a new object like that for every single page. It kind of defeats the purpose of session vars? I think what you should probably be doing is remove the Initialize method from your class and just put session_start(); at the top of your pages. Then declare your class in a require_once() somewhere, make your object and then carry your object over as a session variable.
-
Sit down and figure out about how long it will take you to make it, test it, put it on their server if needs be, whatever else it takes for you to hand it to them and walk away never to touch it again, etc.. in hours. Then multiply that by how many dollars/pounds/whatever an hour you think you are worth. Offering maintenance/support for it should be an entirely different fee. That should be your minimum fee. Then sit down and think about..for lack of better words..how much extra you can squeeze out of them. For instance, if you feel it will cost them $1,500 for you to even consider it, ask for $2,000 or even $2,500. That extra $500-$1000 is a buffer for you two to negotiate. Me personally, I would ask for $2,500 but do it for no less than $1,500. But that's a tentative number, based on the info you provided. That number would be subject to change based on lots of other factors that would come into play, like further details about the company, time tables, etc... But I have to add a disclaimer to my personal estimate: I know my estimate would way underbid the going rate for things like that. I figure about 80 hours (2 weeks) worth of work at about $20 an hour for that = $1,600 then throw on a buffer to negotiate with. But that's me. $20 an hour is pretty cheap labor for coding. I see most people charging $40+ an hour. But like I said, that's just a rough estimate. You have to sit down and figure out exactly to the letter what they want out of you, from design to functionality to support for it, to how soon they want it, etc.. You just have to balance fair with profit. You're there to make money, but you wanna be fair too. If you can bust it out in a week or less, don't charge them for 2 weeks or a month's worth of work. But also, don't make promises you can't keep, either. My personal estimate on that is going off practically making it from scratch. Ideally you would have your own library of classes and functions you've already made throughout your time of coding, that would speed up your work in the first place.
-
who's the quickest draw? Crayon is the quickest draw! blam blam blam!
-
you forgot the ; to end your $csv = "..." line.
-
you are going to have to be more specific. $blah = "1,2,3"; is that what you have? you can explode at the commas, creating an array with 3 seperate variables..but then what? are you wanting to add 1 2 and 3 together? add them to your constant, seperately?
-
okay..i am assuming you are trying to do something like this (since you (still) haven't shown you're code): [code] $board_vars = array($board_id, $board_name, $board_description); foreach ($board_vars as $val) { echo $val; } [/code] is that about what you're code looks like? Then do this: [code] $board_vars = array($board_id, $board_name, $board_description); foreach ($board_vars as $val) { echo "$val </br>"; } [/code] I'm not tryin' to be rude or nothin'. You just need to show your code if you expect people to accurately help with the problem. P.s. - I still insist that it is not a php but an html problem. Unless you have some conditions or something that prevents your (tried) html code from being output: but again, show some code.
-
this isn't even a php problem it's an html problem. how about throwing in some [code]<br>[/code] tags. p.s. - moving to html forum.
-
..and you are calling your function by doing: [code=php:0] $result = returnResult(); // this right here? while($row = mysql_fetch_array($result)) { // do this } [/code]
-
perhaps you should be more clear in your explanation. Are you wanting a variable to persist each time someone is clicking submit? Are you looking to do something like make a session variable?
-
Mysql Help Needed (haha, once again, this time serious)
.josh replied to marcus's topic in PHP Coding Help
one of your post or get variables is somehow not being passed. therefore, in your query, it is doing like "select * from table where blah=" sql is looking at that and wondering what blah equal to. echo out all your get and posted variables. -
well..actually, your database [i]is[/i] being updated. It is being updated where ID='' (nothing) but you do need to define $ID to get rid of that error.
-
There is a quick reply box. You need to enable it. Click the "Profile" button above the breadcrumbs at the top of the page. Then on the lefthand side of the screen, click on "Look and Layout Preferences." It will give you a list of options you can change. "Use quick reply on topic display: <dropdown box>" is one of them. re: RESOVED feature: The SMF team is supposed to be working on it, or something.