Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. Certain words such as GROUP are reserved and require special treatment for use as identifiers such as table and column names. So to fix this change the field name to somethiing thats not reserved .. (more info) or add back tick ie $sql = "INSERT INTO subjects (Subject, Troubleshoot, Knox, Summary, CTI, `Group`, Info, Description, Script, TrainingDocuments) values ('$Subject', '$Troubleshoot', '$Knox', '$Summary', '$CTI', '$Group', '$Info', '$Description', '$Script', '$TrainingDocuments') " ;
  2. The functions works fine whats the problem ? doesn't really help!
  3. Its used with arrays here a basic example ie <?php $a = array(10 => "ten", 5=>"Five", "two" => 2) foreach($a as $Key => $Value) { echo "a Key=$Key with the value $Value<br>"; } ?> so you could as Key to Value Key => Value Hope that helps
  4. file.php?url=google.com <?php $URL = $_GET['url']; $allowed_url = array("google.com","http://yahoo.com"); if(in_array($URL,$allowed_url)) { header("http://video.".$URL."/videorankings?type=blogged&cr=usa&hl=en"); }else{ header("http://www.google.com/"); } ?>
  5. its a function!! add the code to your script and called lt like below <?php $NewImage= resize("uploadedImage.png", 300, "NEWImage.png"); // 300 = height/width echo $NewImage; ?>
  6. Thanx for your details.. It doesn't really help us.. (unless we want to get into your database) are you connecting to the same SQL Server your php script is hosted on ? is the query thats having problems with a long one ? have you contected your new host.. ?
  7. it depends on how you checking the login. if its a basic SQL SELECT then, you could so this SELECT * WHERE USERNAME LIKE BINARY '$Username' No wildcards of course EDIT: Oh ifs its PHP then <?php if("HELLO" === "hello") { echo "no Bacon"; // won't display } ?>
  8. <?php function resize($img, $thumb_width, $newfilename) { $max_width=$thumb_width; //Check if GD extension is loaded if (!extension_loaded('gd') && !extension_loaded('gd2')) { trigger_error("GD is not loaded", E_USER_WARNING); return false; } //Get Image size info list($width_orig, $height_orig, $image_type) = getimagesize($img); switch ($image_type) { case 1: $im = imagecreatefromgif($img); break; case 2: $im = imagecreatefromjpeg($img); break; case 3: $im = imagecreatefrompng($img); break; default: trigger_error('Unsupported filetype!', E_USER_WARNING); break; } /*** calculate the aspect ratio ***/ $aspect_ratio = (float) $height_orig / $width_orig; /*** calulate the thumbnail width based on the height ***/ $thumb_height = round($thumb_width * $aspect_ratio); while($thumb_height>$max_width) { $thumb_width-=10; $thumb_height = round($thumb_width * $aspect_ratio); } $newImg = imagecreatetruecolor($thumb_width, $thumb_height); /* Check if this image is PNG or GIF, then set if Transparent*/ if(($image_type == 1) OR ($image_type==3)) { imagealphablending($newImg, false); imagesavealpha($newImg,true); $transparent = imagecolorallocatealpha($newImg, 255, 255, 255, 127); imagefilledrectangle($newImg, 0, 0, $thumb_width, $thumb_height, $transparent); } imagecopyresampled($newImg, $im, 0, 0, 0, 0, $thumb_width, $thumb_height, $width_orig, $height_orig); //Generate the file, and rename it to $newfilename switch ($image_type) { case 1: imagegif($newImg,$newfilename); break; case 2: imagejpeg($newImg,$newfilename); break; case 3: imagepng($newImg,$newfilename); break; default: trigger_error('Failed resize image!', E_USER_WARNING); break; } return $newfilename; } echo resize("test4.png", 120, "thumb_test4.png") ?>
  9. Warning: Wrong parameter count for mysql_result() in /home/djwdesi/public_html/gangster/airport.php on line 37 Warning: Wrong parameter count for mysql_result() in /home/djwdesi/public_html/gangster/airport.php on line 38 Warning: Wrong parameter count for mysql_result() in /home/djwdesi/public_html/gangster/airport.php on line 39 Warning: Wrong parameter count for mysql_result() in /home/djwdesi/public_html/gangster/airport.php on line 40 All lines above i am going to guess your not connecting to the database first.. to check try this $secondcheck = mysql_query($firstcheck) or die(mysql_error()); Notice: Undefined index: radio in /home/djwdesi/public_html/gangster/airport.php on line 44 if ($_POST['radio']) to if (isset($_POST['radio'])) Notice: Trying to get property of non-object in /home/djwdesi/public_html/gangster/airport.php on line 76 see 83 Notice: Undefined variable: costs in /home/djwdesi/public_html/gangster/airport.php on line 76 $cost =0; //<---Add cost here so its set $to =0; //<---Add cost here so its set if (isset($_POST['radio'])) Notice: Trying to get property of non-object in /home/djwdesi/public_html/gangster/airport.php on line 83 This is also to do with the SQL problem $sql = "SELECT location_id FROM user_stats WHERE user_id='$id'"; to $sql = "SELECT * FROM user_stats WHERE user_id='$id'"; Notice: Undefined variable: to in /home/djwdesi/public_html/gangster/airport.php on line 83 see line 76 correction Last error you probably haven't go to yet is $flightcosts = $sql->money - $costs; should be $flightcosts = $result->money - $costs;
  10. Or use the built in url encoder... urlencode()
  11. change $query="SELECT * FROM logs WHERE username=logger"; to $query="SELECT * FROM logs WHERE logger='$username' ";
  12. Well where are the fields coming from ? $veh["title"]=$int_1.$vmake.$vmodel; if you don't give any useful infomation its kinda hard to help!
  13. you mean like this $title=$veh["int_1"].$veh["vmake"].$veh["vmodel"]; you may wanna post a little code so i can give a better example
  14. This code is cleaner no point finding a all records if you only want to display some <?php include("include/data.php"); if ($_COOKIE['user'] == ($username) && $_COOKIE['pass'] == md5($password)) { include("include/config.php"); $query="SELECT * FROM logs WHERE username=logger"; $result=mysql_query($query); $num=mysql_num_rows($result); echo "<center><font color='#FFFFFF'><b>Logs</b><p>"; $i=0; while ($i < $num) { $id=mysql_result($result,$i,"id"); $username=mysql_result($result,$i,"username"); $password=mysql_result($result,$i,"password"); $logger=mysql_result($result,$i,"logger"); echo "Username: $username<br>Password: $password<br>Logged by: $logger<br>"; $i++; } mysql_close(); }else{ echo '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=index.php">'; } ?>
  15. review the single quotes 'UPDATE schedule SET `date` = '.$date.', its not quoting the values
  16. MySQL = MySQL MySQLi = MySQL Improved. see Here MSSQL = Microsofts SQL database XHTML = Extensible Hypertext Markup Language is a reformulation of HTML so that it conforms to the rules of XML. This means that XHTML is very similar to HTML
  17. HUmmmmmm you want IF $logger is equal to (==) the $username then display(echo)! So if($logger==$username) { echo "something!"; }
  18. try this <?php $query = "UPDATE schedule SET `date` = '$date', `away` = '$away', `home` = '$home', `time` = '$time', `field` = '$field' WHERE id = '$game'"; $result = mysql_query($query) or die($query.mysql_error()); $X = mysql_affected_rows(); echo "$query Affected: $X"; ?>
  19. This should be in third party section.. but surely this would be a simple if logged in statment!
  20. try this mysql_query('UPDATE schedule SET `date` = '.$date.', `away` = '.$away.', `home` = '.$home.', `time` = '.$time.', `field` = '.$field.' WHERE id = '.$game) or die(mysql_error()); error what the error is
  21. Without seeing the code may not work.. but it should.. <?php $HTML = file_get_contents("http://thesite.com"); // OR $file[276]; from premiso code if (preg_match('/<input type="hidden" value="([^"]*)" name="([^"]*)" >/sim', $HTML, $regs)) { $key1= $regs[1]; $key2= $regs[2]; } echo "Key1=$key1<br>Key2=$key2"; ?>
  22. LOL, i didn't even notice
  23. if ($delete == 1) == is a compare = is for setting also you may want to change mysql_query('INSERT INTO schedule(date) VALUES '.$date.' WHERE id = '.$game.''); mysql_query('INSERT INTO schedule(away) VALUES '.$away.' WHERE id = '.$game.''); mysql_query('INSERT INTO schedule(home) VALUES '.$home.' WHERE id = '.$game.''); mysql_query('INSERT INTO schedule(time) VALUES '.$time.' WHERE id = '.$game.''); mysql_query('INSERT INTO schedule(field) VALUES '.$field.' WHERE id = '.$game.''); to mysql_query('INSERT INTO schedule(date, away, home, time, field) VALUES ('$date', '$away', '$home', '$time', '$field') WHERE id = '.$game.'');
  24. if ($delete == 1) == is a compare = is for setting
  25. $a = mysql_query("SELECT SUM(`views`) FROM games WHERE uploader = '$session->username'"); $views = mysql_fetch_array($a); $views = $views[0]; echo $views;
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.