
twistedvengeance
Members-
Posts
19 -
Joined
-
Last visited
Profile Information
-
Gender
Not Telling
twistedvengeance's Achievements

Newbie (1/5)
0
Reputation
-
I may have been confused as to what you were planning on doing. I assumed you wanted it to pop up, like Facebook, when the event happens. PHP can't do that, since it would be active-reload. My apologies.
-
Upload The Image To A Folder In Server
twistedvengeance replied to arunpatal's topic in PHP Coding Help
Aside from the fact that I gave him 99% of what he needs, nothing with this code is wrong. I have re-coded this so it works properly. Don't be an ass if you don't have the desire to try and help someone out. -
ASP and Ruby. PHP will not do this to the full extent you want.
-
Upload The Image To A Folder In Server
twistedvengeance replied to arunpatal's topic in PHP Coding Help
Despite how long and hard I worked on this, I'll give you the beginning of what you need. This will not insert any information into a database. Also, the top part of this is on google. <?php $uploaded = false; $name = 1; if(isset($_POST['Upload'])){ $allowedExts = array("jpg", "jpeg", "png", "gif"); $extension = end(explode(".", $_FILES["file"]["name"])); if (($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")){ if($_FILES["file"]["size"] < 2000000){ if(in_array($extension, $allowedExts)){ if ($_FILES["file"]["error"] > 0){ echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; }else{ $_FILES["file"]["name"] = $name . ".jpg"; while(file_exists("template/gallery/" . $_FILES["file"]["name"])){ $name++; $_FILES["file"]["name"] = $name . ".jpg"; } while(file_exists("template/php/user/uploaded/" . $_FILES["file"]["name"])){ $name++; $_FILES["file"]["name"] = $name . ".jpg"; } $location = "template/php/user/uploaded/"; move_uploaded_file($_FILES["file"]["tmp_name"], "$location" . $_FILES["file"]["name"]); echo "Thanks for uploading!"; echo "<a href=\"$location$name.jpg\">Click to see</a>"; $uploaded = true; } }else{ echo "Invalid file"; } }else{ echo "File is too big!"; } }else{ echo "Invalid File Type"; } } if($uploaded == false){?> <div id="posts"> <form method="post" action="" enctype="multipart/form-data" name="form1"> <span>Picture:</span> <input name="file" type="file" class="box"/> <input type="submit" id="mybut" value="Upload" name="Upload"/> </form> <span>Only JPG(JPEG) files allowed.</span> </div> <?php } ?> -
Struggling With Provided Follow Code
twistedvengeance replied to justlukeyou's topic in PHP Coding Help
<?php $id = $_SESSION['userID']; if (($_GET['do'] == 'follow') && !empty($_GET['id'])){ if(($_SESSION['auth']) && !empty($_SESSION['current_user_id'])){ if ($_SESSION['current_user_id'] == $_GET['current_user_id']){ $you = intval($_SESSION['current_user_id']); $them = intval($_GET['id']); $sql = "INSERT INTO `follow` (`user_id`, `follow_user_id`) VALUES ('$you', '$them')"; if (!mysql_query($sql)){ if (mysql_errno($link_identifier) == 1062) { /* Why is this even here? */ } } } } } ?> Your problem was you didn't have your variables escaped with ' '. so you were saying VALUES(code,code) not VALUES('code','code'); -
Then you have an error somewhere else in your code, post 5-10 more lines on either side of the code so we can see what might be causing errors. Or even the entire script if it's not huge.
-
You are calling if(array_search($id, $ids) == true){ Which isn't true. You are defining $ids = $a['ids']; $ids = explode(",", $ids); So just set it to $id = $a['ids']; $ids = explode(",", $id);
-
Create And Copy Table Concatenation Help
twistedvengeance replied to BigTime's topic in PHP Coding Help
$usr = "user"; $pwd = "pass"; $db = "schedules"; $db2 = "schedulesArchive"; $host = "localhost"; # connect to database $cid = mysql_connect($host,$usr,$pwd); if (!$cid) { echo("ERROR: " . mysql_error() . "\n"); } $year=Date("Y"); $db2 = $db2 . $year . "foo"; SQL = "CREATE TABLE $db2 SELECT * FROM $db.foo"; $result = mysql_db_query($db,$SQL,$cid); # check for error if (!$result) { echo("ERROR: " . mysql_error() . "\n$SQL\n"); } -
eval("$keys .= " . $value['set_function'] . "'" . $value['value'] . "','" . $key . "');");
-
body{ position: relative; } .footer{ position: fixed; bottom: 10px; }
-
You have too many spaces in your query.
-
<table width="525" border="0" cellpadding="40" height="63" > <?php $query = "select * from fixtures group by date having count(*) > 1"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $date= $row['date']; $oDate = strtotime($date); $sDate = date("D M j Y",$oDate); ?> <tr><td colspan="8" align="left" class="td"><b><?php echo $sDate; ?></b></td></tr> <?php $query2 = "select * from fixtures where date = '$date'"; $result2 = mysql_query($query2); while($row2 = mysql_fetch_array($result2)) { $first = $row2['firstTeam']; $second = $row2['secondTeam']; $time = $row2['time']; $gameid = $row2['gameId']; $date_now = date("Y-m-d"); $time_now = gmdate("H:i:s"); $time2 = strtotime($time); $real_time = date("H:i", $time2); $timeMinus1Hour = gmdate("H:i", strtotime("-1 hour", strtotime($time))); if( $date <= $date_now && $time_now <= $timeMinus1Hour) { ?> <script type="text/javascript"> $('#fixtures').click(function (){ return false; }); </script> <tr class="big"> <td width="56" align="left" style="color:#709b52;"><a href="" class="result_hover">results</a></td> <td width="182" align="right"><a href="forecast.php?first1=<?php echo $first; ?>&second1=<?php echo $second; ?>&game_id=<?php echo $gameid; ?>" id="fixtures"> <?php echo $first; ?></a></td> <td width="-31" align="center"><a href="forecast.php?first1=<?php echo $first; ?>&second1=<?php echo $second; ?>&game_id=<?php echo $gameid; ?>" id="fixtures">vs</a></td> <td width="-12" align="left"><a href="forecast.php?first1=<?php echo $first; ?>&second1=<?php echo $second; ?>&game_id=<?php echo $gameid; ?>" id="fixtures"><?php echo $second; ?></a></td> <td><a href="forecast.php" id="fixtures"><?php echo $real_time; ?></a></td> </tr> <?php } } } ?> Reposting for code syntax
-
Using array from previous function
twistedvengeance replied to john_doemoor's topic in PHP Coding Help
You could also use classes, I think. <?php class Beginning{ function Opening(){ ['your code'] } } class End extends Beginning{ function End(){ ['ending code'] } } -
Calling Custom Functions Problem
twistedvengeance replied to twistedvengeance's topic in PHP Coding Help
Thanks for trying to help guys, I figured it out. My function wasn't being called in the right place. -
Calling Custom Functions Problem
twistedvengeance replied to twistedvengeance's topic in PHP Coding Help
So I did that, and got a "unknown variable" blah blah, and fixed that by placing all of my POST checks into a function and calling it inside of my CheckInput function, but I'm still getting the error.