Philip
Staff Alumni-
Posts
4,665 -
Joined
-
Last visited
-
Days Won
20
Everything posted by Philip
-
$query="UPDATE City SET CityName='$CityName'" . "WHERE ID=$ID "; Should have single quotes around $ID, as with all variables, and a space between cityname var and WHERE: $query="UPDATE City SET CityName='$CityName'" . " WHERE ID='$ID'";
-
Well, why do you have "dirname(__FILE__)" in there if the file is not in the same directory? EDIT: are you wanting ../ClanApp/admin/ClanAppView/language.php? If so you need: include(dirname(__FILE__)."/ClanAppView/language.php");
-
Even the file that creates them? Ill try Edit: Wow i dont know why i didnt try that in the first place, such a waste of my time googling all that time Thanks guys Yup. The only time you don't need it is in an included file. It should throw an error. Like, if I had index.php <?php session_start(); include 'functions.php'; //... echo $_SESSION['name']; ?> I wouldn't need to call session_start in functions.php, but I will in index.php However, if I didn't include functions.php and instead I went straight to that file or had my form posted there and wanted to create a session, I'd need to call session_start Does that make sense?
-
Hmm, mind showing some code?
-
can't find: but then again I always get confused with includes and paths. Other way around The script has: include(/home/public_html/ClanApp/adminClanAppView/language.php);
-
You must call session_start() at the top of the main pages. Example, I have these pages: index.php login.php logout.php news.php Each, of those must have session_start() at the top in order to check for a session.
-
use: <?php session_start(); $_SESSION['name'] = 'my name'; echo $_SESSION['name']; ?> session_register is deprecated
-
Why do you say that? I'm pretty sure you can do that with CSS. You'd be surprised at its power. http://www.picment.com/articles/css/funwithforms/ If you need help with CSS, we have a few CSS gurus on the forum: http://www.phpfreaks.com/forums/index.php/board,5.0.html
-
Okay, for the first one - it's kinda what I thought it would be. You can find some info on this: http://www.phpfreaks.com/forums/index.php/topic,148399.0.html or http://forums.devshed.com/javascript-development-115/how-to-fill-a-select-menu-from-an-javascript-array-28438.html I don't have any code handy, since I've never actually done it - but i know the concept. That'll take care of 1 & 2. For 3 + 4, take a look at ajax forms. There are tons of examples out there
-
So, this would be more of an AJAX question - since you want to retrieve data from the other website and display it on yours, without refreshing the page. Correct? If so, have ever done any AJAX requests before? If not, maybe you can help me out by explaining the question/problem again Read that, and answer the 2 questions
-
@OP: Typically, using $_SERVER['REMOTE_ADDR'] will give you the correct IP. <?php echo $_SERVER['REMOTE_ADDR']; ?> That'd show your IP when you visit. Printf was talking about how it can be spoofed, hidden, etc.
-
Wow, that's some hard to read code, especially since I have no clue what most of it does (i.e. $data['hm'], $data['fm']...) One thing, find: $_SESSION['status'] = $status; Add the line below: print_r($_SESSION); Make sure the other pages have the session_start(); at the top, and always use long tags (<?php) not short tags (<?)
-
How do you have the images named?
-
You can use mysql's encode/decode http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html edit: by encode/decode, I should've mentioned to use AES - more secure.
-
You can't. md5 is a one-way encryption.
-
Look at your browser's source code when you view the page. What do you see? You should see: <img src="http://localhost/test/thumbs/t-blank.gif" border="0"> That's what I see when I run the code. I'm thinking maybe your wanting to check to see if the file exists, and not if the variable is empty?
-
[SOLVED] I've never see this error/notice before
Philip replied to mike12255's topic in PHP Coding Help
Pretty much, it simplified the random process & will allow for easier expansion (and prevents the error you originally had - missing one of the captions/urls). The only thing it doesn't do is show the image, but that's just because of the difference in ways I would do the sponsor image (I'd use their name, instead of a number) If you wanted yours to work, pretty much just put: <tr> <td align="center"><img src="images/random/<?php echo $randoms.".jpg" ?>" height="25" /></td> </tr> <tr> <td align="center"><a href="<?php echo $img ?>" class="link"><?php echo $caps ?></a></td> </tr> Inside the loop: for ( $i = 0; $i < 3; $i++){ $caps = $captions[$randoms[$i]];; $img = $urls[$randoms[$i]]; } -
<img src="http://localhost/test/thumbs/t-<?php if(!isset($url) || empty($url)) echo 'blank'; else echo $url; ?>.gif" border="0"> What does the source show?
-
[SOLVED] I've never see this error/notice before
Philip replied to mike12255's topic in PHP Coding Help
The reason it wasn't working, is because you're calling $caps, $img, $randoms outside the loop, so it'll just show the last element. for ( $i = 0; $i < 3; $i++){ $caps = $captions[$randoms[$i]];; $img = $urls[$randoms[$i]]; } I could set $caps equal to 5, then 3, and finally 2. However, when you call the variable outside the loop, the only one that you can see is 2 since you overwrote the others. I played around with your code a bit. It won't work to your full intents, i.e. there is no dashed line, and you'd have to rename your images probably. Nonetheless, it'd be a lot easier to expand your list later on: <?php // Create image array $imageArray = array( 'RBC' => 'http://www.royalbank.com', 'Prodomax' => 'http://prodomax.com/', 'Liews Motors' => 'http://www.lewismotorsinc.com/', 'Advanced Motion Controls' => 'http://a-m-c.com/', 'Burnside' => 'http://www.rjburnside.com/', 'TD Canada Trust' => 'http://tdcanadatrust.com', 'Reinhart' => 'http://www.reinhartfoods.com/', 'SCDSB' => 'http://www.scdsb.on.ca/', 'ARO' => 'http://www.aronet.com/', 'Stayner Lions' => 'http://www.lionsclubs.org/', 'test' => 'test', 'ComTek' => 'http://www.comtekcomputers.com/', ); // Select a few items $imageRand = array_rand($imageArray, 3); // Run the loop foreach($imageRand as $name) { echo '<tr><td align="center"><a href="',$imageArray[$name],'" class="link">',$name,'</a></td></tr>'; ?> By the way, with the code you gave, there were several minor things wrong with it. "$caps = $captions[$randoms[$i]];;" - double semicolons, your table code isn't lining up (I had a hard time finding the matching opening closing cell & row tags), yeah... Anyways, feel free to play around with what I gave you. -
Err, I misread the question. premiso is correct. If that is your page though, use $_GET['lot'] to get the number
-
If you echo that out you should see something like: Do you really want that ' . in front of the value?
-
What does your code look like?
-
Are you reading anything we are putting out in front of you? Your code... if (trim($_POST['psswrd']) != trim($_POST['repsswrd']) && (strlen(trim($_POST['psswrd']))>=4 && strlen(trim($_POST['repsswrd']))>=4)) ... reads: If the passwords are not equal AND the length of both passwords are greater than 4, throw an error. Also, you don't need to check both passwords for length - it's a waste of resources. If the passwords match, they'll have the same length. If they don't match, you're already throwing an error, so the user will have to re-enter a password anyways. In plain English, type out what are you trying to do.
-
Uhh, that doesn't really help Here's what I would suggest, and trust me, it will help you not only here but in the future as well. Go through your code, using an editor with a syntax highlighter (you probably already are.) Comment and indent your code properly. There are a lot of mysql queries, that I don't really have a clue on what they are doing, lol. Example, and I'm just guessing: // Get replies: $qry = mysql_query("SELECT * FROM `mainreplys` WHERE `topicid` = '$topicid' AND `forum` = '$forum' ORDER BY `id` DESC LIMIT $forum_look , $forum_count")or die(mysql_error()); A lot of your queries could also be combined into fewer queries. Have you ever used a JOIN?
-
Okay, in your query you have AND `Lock`='$lock', however I can't find where you are getting $lock from, AND you're setting the query result to that same variable name ($lock) Try: $lock = mysql_query("SELECT * FROM `maintopics` WHERE `id` = '$topicid' LIMIT 1")or die(mysql_error());