denno020
Members-
Posts
761 -
Joined
-
Last visited
-
Days Won
3
Everything posted by denno020
-
So is the onChange event to grab the states that are in the given country? You will need to add some PHP so that when the country is chosen (and the form is subsequently submitted), the PHP checks for submission, and then builds a new form that has all the posted variables pre-loaded into the form fields. so for example, the first_name field will become <input type="text" name="first_name" size="25" value="<?php $_POST["first_name"] ?>"> Hope that helps.. Denno
-
phpMyAdmin picking up strange value from somewhere
denno020 replied to crmamx's topic in PHP Coding Help
Try exporting the sql for the problem table and then create a new one. See if that helps. -
It really isn't that hard at all. The best way for you to do it is to sit down with a pen and paper, and work out what bits of information you need for each item. This will be how many columns your products table has. Add one for id, which is completely necessary, and which you will also make the primary key (unique identifier). Once you have your tables worked out on paper, you can translate that into a database. I would highly suggest using phpMyAdmin. It will make everything soooo much easier.Go to youtube and see what you can find on how to create tables using phpMyAdmin. I promise you it isn't as scary as you're thinking it is. Denno
-
I had a play around with your CSS, and I've got it to line up. Is this the best way? Probably not, but I get them displaying all across the same line on the screen. The part of the CSS that I edited (in styles.css), was #bottom ul.social{ float: right; list-style: none outside none; margin-bottom: 20px; margin-top: -7px; <-- obviously added this line here. } To the naked eye, this looks about lined up, but play with that value, it could be -8 or -6 that is needed. I guess that's a simple way to fix your problem Denno
-
You really should end your thread with a question saying exactly what you want. Luckily I can understand what you're after from your thread title. So, you will want to use javascript most probably. That will allow for a dynamic change of the background (without a page refresh). Otherwise you're going to have to submit the form (that is around the TWO radio buttons), and then do the appropriate things in php, which could mean loading a different CSS sheet, as if you have a fancy background, that could mean text colours might need to change etc. For the javascript option, you will add an onClick event to each radio button, with a link to a function that will change the background. In PHP, you will just check the posted variables and see which was selected using a simple if statement, and do appropriate actions for each option. Denno
-
Find some tutorials. I've only learnt PHP myself in the last couple of months by watching youtube videos, and now I'm very confident working with it. Just read what you can. It's better to learn how to code that to use a GUI (which is what I think the SQLMaestro thing is), as it will allow you to better understand what you're writing, and also make it more efficient. Other than that, I'd suggest paying someone . Denno
-
Ok so I've been trying to figure this out, how to change the contents of the array, but it doesn't seem to be working for me. The first one will change fine, however when getting the second or further cards, it seems to pass the original array back through. I reckon the reason for this is because the array that I pass to the getRandom() function is the one that's edited. This array isn't returned back to the original function to change the original array. I'll give you the code I have now, so you can see where I was headed with it, however the problem is being able to edit the original array still.. Once that is figured out, I reckon using this kind of layout will make it super simple to add as many players as you want. And should make the code nice and neat too. <?php function poker() { $cards = array("Ah", "Ac", "Ad", "As", "2h", "2c", "2d", "2s", "3h", "3c", "3d", "3s", "4h", "4c", "4d", "4s", "5h", "5c", "5d", "5s", "6h", "6c", "6d", "6s", "7h", "7c", "7d", "7s", "8h", "8c", "8d", "8s", "9h", "9c", "9d", "9s", "Th", "Tc", "Td", "Ts", "Jh", "Jc", "Jd", "Js", "Qh", "Qc", "Qd", "Qs", "Kh", "Kc", "Kd", "Ks"); $x = getRandom($cards); echo "-" . $x . " "; $y = getRandom($cards); echo "<br/>-" . $y; $z = getRandom($cards); echo "<br/>-" . $z; echo "<br/>"; for ($i=0 ; $i<52 ; $i++){ echo $cards[$i] . " | "; } } function getRandom($cards){ while(1){ $rand = rand(0,51); $player = $cards[$rand]; if($player != 0){ $cards[$rand] = 0; break; } } return $player; } poker(); ?> Thinking about your original question, I have probably provided you with no useful information at all, as I'm stuck with how to unset an array too lol. Sorry mate.. I'll continue to look into it myself, for my own benefits. If I come up with something, I'll let you know, but don't hold your breath. Denno
-
Any change your screen res on your laptop is just screwed up? I don't see any obvious problems viewing on a 24" widescreen (1920 x 1080).. Nor on my laptop screen (1366 x 768). Denno
-
Is there a reason you have put this information across multiple tables? The best way would be to have all of it in one table, and then have different columns for each of the data you want entered. Denno
-
I would probably suggest keeping the email box, it is kind of important in a registration thing. But it's up to you if you remove it. Assuming you already know how to add the text box for the input of a password (which you said in the post above this), change line 107 of demo.php from: $pass = substr(md5($_SERVER['REMOTE_ADDR'].microtime().rand(1,100000)),0,6); to $pass = $_POST['pass']; This is very simply grabbing the password that is posted to the form, same as the email and username are grabbed. That is all you need to change, the sql can stay as it is (I think, there is some .md5 stuff there, and I'm not familiar with it and how it operates, all I know is that it encrypts data). Try that and see how you go. Even though I've given the answer, I second what crabfinger said. Googling and reading for yourself will give you a much greater chance of remembering how to do something later. Denno
-
Oh and also, you can just call poker(); You don't have to echo it, as you're already echoing $x and $y inside the function itself. Denno
-
function poker() { $cards = array("Ah", "Ac", "Ad", "As", "2h", "2c", "2d", "2s", "3h", "3c", "3d", "3s", "4h", "4c", "4d", "4s", "5h", "5c", "5d", "5s", "6h", "6c", "6d", "6s", "7h", "7c", "7d", "7s", "8h", "8c", "8d", "8s", "9h", "9c", "9d", "9s", "Th", "Tc", "Td", "Ts", "Jh", "Jc", "Jd", "Js", "Qh", "Qc", "Qd", "Qs", "Kh", "Kc", "Kd", "Ks"); $x = $cards[rand(0,51)]; echo "$x "; while(1){ $y = $cards[rand(0,51)]; if ($y != $x) { echo $y; break; } } } echo poker() . "<br>"; So what I have added above is a while loop. The purpose is to continually try to grab a random number for $y until it doesn't equal $x. So, if $y == $x, then the if statement won't be satisfied, therefore it will skip it, and then loop back to the start of the while, where $y will get a new value using the rand() function. If they're not equal (therefore satisfying the if condition), then $y is printed, and the while loop is broken. Hope that helps. Denno
-
try initialising $c and $f to 0 before the for each loop? I'm not sure if that would help, but it may.. Denno Edit: sorry didn't realize the forum was marked solved. I came in through an email link and didn't see until after I posted it..
-
Don't display them right away. Wait until the for each loop has completed, and then run the display for loops.. $cat_name = array(); $forum_name = array(); foreach($result as $key => $val) { if($result[$key]['f_pid'] == 0) { $cat_name[$c] .= $result[$key]['f_name']; $c++; } else { $forum_name[$f] .= $result[$key]['f_name']; $forum_desc = $result[$key]['f_description']; $f++; } } for($c=0; $c<count($cat_name); $c++) { echo $cat_name[$c]; } for($f=0; $f<count($forum_name); $f++) { echo $forum_name[$f]; } This way you wait until the array is full with all names, and then you display them all. Denno
-
$cat_name = array(); $forum_name = array(); foreach($result as $key => $val) { if($result[$key]['f_pid'] == 0) { $cat_name[i] .= $result[$key]['f_name']; i++; } else { $forum_name[k] .= $result[$key]['f_name']; k++; } $forum_desc = $result[$key]['f_description']; } Then to display you grab the lengths of each array, and use a for loop to cycle through all of them. Denno
-
Sorry to be a jerk with my reply. But you'll get much more value out of it if you can learn for yourself. Not only will you be quite proud of yourself, you'll also remember it way easier. I've just found a youtube tutorial series that I've started watching, looks ok. Here is the link if you're interested: Hope that helps mate Denno
-
Put the names into an array with index i that you increment each time. That will solve the problem. Denno
-
That's awesome man! Thanks heaps. I don't know why it wouldn't work for me when trying :S. Thanks for providing the working example too, very helpful. Denno
-
for(int i = 0 ; i < array length ; i++){ arraytotal[i] = array1[i] + array2[i]; } change 'array length' to whatever the php function is that will get the length of an array. Denno
-
How to run php code that is stored in a database?
denno020 replied to denno020's topic in PHP Coding Help
ahk just read it. That seems way involved. I'm only creating a website for my local footy club lol. I'll just go with the option that I didn't want to, and if they want another section or something set up, I'll just have to code that in.. Not ideal, but it will do.. Thanks mate. Denno -
How to run php code that is stored in a database?
denno020 replied to denno020's topic in PHP Coding Help
haha I'm not surprised you didn't read it all. Can you suggest another way to get this done? So without storing code in the database? (I think you get the idea of what I'm after?) Cheers Denno -
Dude, just google AJAX. You'll find alot more help than many people will give you in a forum. I doubt very much you'll get an AJAX class in a forum response, no one has that much time. It's really not that hard to find information nowadays. I typed 'ajax' into google, and look what I found: http://www.w3schools.com/Ajax/Default.Asp. Easy. Denno
-
<img src="image.png" border="0" That will remove the border altogether. <SCRIPT> var imageURL = "images/clock.jpg"; if (document.images) { var clock = new Image(); clock.src = "images/clock.jpg"; var cup = new Image(); cup.src = "images/cup.gif"; var car = new Image(); car.src = "images/car.gif"; var ball = new Image(); ball.src = "images/ball.gif" } function changeImage() { if (document.images) { if(imageURL == "images/cup.jpg") imageURL = "images/clock.jpg"; else if(imageURL = "images/clock.jpg") imageURL = "images/car.gif; else if(imageURL = "images/car.gif") imageURL = "images/ball.gif; else imageURL = "images/cup.gif"; document.myImage.src = imageURL; } } </SCRIPT> <FORM> <INPUT TYPE="Button" VALUE="Change the image source" onClick="changeImage();"> </FORM> <IMG SRC="clock.jpg" NAME="myImage"> That is how you add more pictures. I've added 'car' and 'ball'. Denno
-
perhaps you need to append the data each time then using '.=' foreach($result as $key => $val) { if($result[$key]['f_pid'] == 0) { $cat_name .= $result[$key]['f_name']; } else { $forum_name .= $result[$key]['f_name']; } $forum_desc = $result[$key]['f_description']; }
-
Does it only display the last one?