
The14thGOD
Members-
Posts
256 -
Joined
-
Last visited
Never
Everything posted by The14thGOD
-
[SOLVED] I dont seem to understand this...
The14thGOD replied to The14thGOD's topic in PHP Coding Help
thank you -
I'm trying to get this so that in a while loop, theres a variable that is added each time a row from the database is present and displayed it adds one too it. now i want it if it's divisible by 2 it will make a new row, here's the code I'm using, it works for if it's divisible by 4...so im kind of confused, if anyone could explain it a bit, that would be helpful: <?php if (!(($x-1) % 2)) { echo("</tr>\n"); echo("<tr>\n"); }?> Thanks, Justin
-
help please: unexpected T_ENCAPSED_AND_WHITESPACE
The14thGOD replied to The14thGOD's topic in PHP Coding Help
ah alright, I think I understand now. Thank you. -
help please: unexpected T_ENCAPSED_AND_WHITESPACE
The14thGOD replied to The14thGOD's topic in PHP Coding Help
yep,the second method worked, though im confused because I have never had to do that before and it works on my site....if possible would you mind explaining what exactly that does? thank you for the help -
I keep getting this error but i can't figure out why, I believe it is this code: <?php while($row = mysql_fetch_array($results)) { $row['image'] = str_replace("../","",$row['image']); $row['body'] = str_replace("\r\n","<br /><br />",$row['body']); $row['body'] = str_replace("\n","<br /><br />",$row['body']); echo("<h3>$row['headline']</h3>"); echo("<img src=\"$row['image']\" width=\"334\" height=\"184\" />"); echo("<p>$row['body']</p><br />"); } ?> when i take it out it doesn't do it anymore help asap please thanks
-
I'm having a problem of uploading an image, it keeps saying the file is not the correct size..but it is the same size. Perhaps I'm missing something? Or perhaps a server/php reads the size a little different? here's the code if anyone can take a look at it and help me id be very great full: <?php import_request_variables('pg'); //First check that file ext = .jpg then rename file and location, also upload to perminate location{ $extension = explode('.',$_FILES['photo']['name']); if ($extension[1] == 'jpg') { $uploaddir = '../images/news/'; $filename = $_FILES['photo']['name']; $file_dir = "$uploaddir" . "$filename"; move_uploaded_file($_FILES['photo']['tmp_name'], "$file_dir"); $size = getimagesize($file_dir); if($size[0] != 334 or $size[1] != 184) { $error = 'file'; unlink($file_dir); header("Location: add_news.php?error=$error"); exit(0); } $size_true = 'true'; } elseif ($extension[1] !== 'jpg' or !$size_true) { $error = 'file'; header("Location: add_news.php?error=$error"); exit(0); }?> Thanks in advance
-
thank you
-
ya, id try it, but im currently in class at the moment, and for some reason their wireless wont connect to my server i didn't want to code it all based on a switch if it did not work. so ill probably be sticking with if statements.
-
I was wondering, can you use logic in case statements? ie switch($variable){ case($variable<10): blah blah blah } Thanks the14thgod
-
alrighty, i may try that then. i might as well try new things hah. thanks again for the help.
-
a problem im seeing, mainly due to me not explaining it well and possibly not understanding the above to it's full extent(i'm pretty sure i get most of it) but also, id like to use one table, and there are different types, fractal, drawings, raster, etc. and I need to total them and then do math through the PHP. so i guess i'm looking for the most efficient way possible.
-
I am working on a rating system, and I have users. The problem I have is that I need to be able to tell if the user has already rated the item already. My question is I guess, is what should I do to try and do this? Right now, my table for sure needs: Columns: id art type art id total votes total score rating But I have no idea how I am going to store the user id for each and every user. Any suggestions? I was thinking maybe trying to make an array, but not sure if there may be a easier way. Thanks in advanced.
-
sorry, but I just noticed, it's still echoing : onclick="editText(" 10="" )="" any ideas?
-
im not 100% sure what exactly I did, but I got it lol, thank you for your help now onto javascript debuggin /cry
-
I am at a complete loss. Same files are located in my live version, and testing area, the live version works, I can edit my blog on the fly, in my testing area though, it doesn't work, the username is "S" /shrug
-
$select_row:Array ( [username] => xxMandersxx ) $_SESSION:Array ( [username] => S ) Not sure why $_SESSION['username'] is showing up as S... Especially since this line works: <?php if ($_SESSION['username'] == "MyUserNameHere") { echo("ondblClick=\"editText('blog')\""); }?> ***************EDIT************* I'm going to reupdate my files, yay for backups. I'll post results after this.
-
thanks for the info, so if i went back and changed all my scripts to have the single quotes, would it mess up anything do you think?(i did look at some of the earlier code I wrote for my site and I was using single quotes, I must have just forgot lol) also i switched out the function since there was no need for it, and it works, except for now instead of always getting the edit text i get the onclick="no_edit();" so, the new code looks like: <?php if ($select_row['username'] == $_SESSION['username']) { echo ' onclick="editText("' . $com_row['id'] . '")" '; }else { echo ' onclick="no_edit();" '; } ?>
-
it's defined in a loop that calls the function ajax_edit. i am not familiar with functions, but now that I think of it, I may not need the function since it's in a loop, I'll test that to see if it makes a difference, but it is still echoing onclick="editText(" )="". I have a question about the single quotes in say $com_row['username'] or $_SESSION['username'], but I just noticed I'm not using the quotes often in my code, and everything works out. I know I've used them before, I'm almost positive that I learned it that way in class, but don't know why I'm not using them right now lol. So the question, what is the difference? Thanks in advanced
-
it seems my server went boom... i did switch that line, and it didn't work. ill have more info when it comes back up..
-
ya i have the session_start() it keeps echoing onclick="editText(" )=""
-
Currently I'm messing around with some ajax, and I am running a function that well echo the correct javascript function depending on the user who is logged in. I tried a couple of methods, both time's it didn't echo the right code, having a problem with mixing the php and javascirpt into an echo: <?php function ajax_edit() { //Matches user to see if they can edit that comment if ($select_row[username] == $_SESSION[username]) { echo(" onclick=\"editText(\"$com_row[id]\")\" "); }else { echo(" onclick=\"no_edit();\" "); } } ?> Both times it echoed the editText function, I wasn't logged in so it should have displayed "no_edit" I think it's just syntax because everything else works. Thanks in advance.
-
ah, thanks, damn, i should have looked for minor errors like that. thanks
-
Working on a mini project, and when the page first loads it works correctly. The link is domain.com?collapse=2,1,1 Once I click the link, and it refreshed, the link reads as: domain.com?collapse=,1,1 I'm not sure why... so heres the code b4 the beginning of the html tag: <?php $thispage = $_SERVER['PHP_SELF']; $thispage .= "?collapse="; //array if (!$_GET['collapse']) { $array = array(1,1,1); }else { $collapse = $_GET['collapse']; $array = explode(",", $_GET['collapse']); echo($array[0]); } ?> code for the link: <?php $thispage2 = "$thispage"; if ($array[0] == 1) { $sub0 = 2; $thispage2 .= "$sub0,$array[1],$array[2]"; }else{ $sub0 == 1; $thispage2 .= "$sub0,$array[1],$array[2]"; } echo($thispage2); ?> So the problem is, why is the $sub0 after you click the link one time reading as nothing... Any help would be appreciated. Thanks in advanced, The14thGOD
-
Hey, I was wondering, how would you go about getting an array form the URL? can you just post it like this "domain.com/index.php?array=1,2,3,4 and then use: <?php $array = $_GET['array']; and then the array would read as: $array[0] == 1 $array[1] == 2 etc... thanks in advance
-
Thanks for reminding me of what I already knew. I was more looking for a function, code, or a link to a tutorial or something like that. I've been googling and havn't found a method that would work with the way I'm doing it. I don't want the page to refresh, but the methods I keep finding would require the page to refresh.