Jump to content

lilgezuz

Members
  • Posts

    49
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

lilgezuz's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Never mind forgot to put return mysqli_query($conn,$sql);
  2. Not sure if this is right. I can't get it to insert my record. Can someone please tell me if I'm doing it right? cus_functions.php function dbRowInsert($table_name, $form_data) { global $conn; $fields = array_keys($form_data); $sql = "INSERT INTO ".$table_name." (`".implode('`,`', $fields)."`) VALUES('".implode("','", $form_data)."')"; return mysqli_query($sql); } process.php include("new_db.php"); include("cus_functions.php"); $do=$_GET['do']; if($do=='addpro'){ if(isset($_POST['submit'])){ $input = $_POST['title']; $comp = '0'; $form_data = array('title' => $input, 'completed' => $comp); dbRowInsert('projects', $form_data); }}
  3. I'm new to using ajax, jquery, and java so I'm not 100% sure how to do a for loop in this case
  4. I'm using the following script to load information into a div. It works fine expect I want to make it do more and can't figure it out. <script> function loadingAjax(div_id) { var divIdHtml = $("#"+div_id).html(); $.ajax({ type: "POST", url: "testmash.php?tag=<? echo $ptag; ?>", data: "tag=John&id=28", beforeSend: function() { $("#loading-image").show(); $('#message').html("Importing Profile Information"); }, success: function(msg) { $("#"+div_id).html(divIdHtml + msg); $("#loading-image").hide(); $('#message').html("Successfly Imported Information"); } }); } </script> So I got 3 or 4 php pages that access a api. I want each page to process then return the message into my div. So I could either combine all my php pages into one page and have the message get returned depending on what function the php is running or load them one by one. I'm not sure how to do that. When page one is loading I want it to say something like Importing Page 1 details when it gets done I want it to say successfully imported page 1 details then below that says importing page 2 details, so by the time the fourth page is getting processed it will say Successfully Imported Page 1 Successfully Imported Page 2 Successfully Imported Page 3 Importing Page 4 Sorry this is hard for me to explain I hope someone can help. Thanks ahead of time
  5. I got it the result I needed by using this, not sure if its the best way but it works $str2 = substr($res, 21,-7); echo $str2;
  6. So I'm using the below code to decode some strings. $str = '0jc8P2NhbC9HXxtUGltTWDE5L2FjaC8wL2UzAAAAAVBQUP26AZg='; $str1 = base64_decode($str); echo nl2br(htmlspecialchars($str1, ENT_QUOTES)); After decoding I get this as my result 7<?cal/G_T[SX19/ach/0/e3PPP Now how do I go about getting just this section /ach/0/e3 of the above result? I need to take just that section of the string and insert it into a datebase. But I can't figure out how to pull just that section out? Thanks in advance
  7. the username is a id the tid and gameid are numbers. not working means that its not returning and results when it should be. I posted the query in my above post
  8. I deleted it already from my file but it was something like this $sql = mysql_query("SELECT gameid FROM earned WHERE userid='username' and tid='trophyid'"); if(mysql_num_rows($sql) >= 1){ ; ?>
  9. I need to check my database to see if a user has earned a trophy. I have a table that holds the user id, game id, trophy id, and date earned. When I go to run my cron job It pulls data that may already be in my database so I need to check if a user has earned that trophy id for that game id. There is multiple game ids and each game id could have the same trophy id for example game 1 trophy 1 game 1 trophy 2 game 2 trophy 1 game 2 trophy 2 I tried to use mysql_num_rows but its not working for me
  10. Thanks mate worked like a charm. Not sure why I didn't have quotes around the num1 I know better then that
  11. Its suppose to be pid=$id. So I could have Id1 Pid1 Trophy 1 Id2 Pid2 Trophy 1 Id3 Pid2 Trophy 1 Id4 Pid2 Trophy 2 See how Pid2 records for Trophy 1 I need to count that as one result not two
  12. I need help with a count query and displaying it. Right now have the following query $query = "SELECT COUNT(*) as num1 FROM spoiler WHERE id='$id"; $total_trophies = mysql_fetch_array(mysql_query($query)); $total_trophies = $total_trophies[num1]; So I have another query that pulls how many trophies there are. That way I can do the following ? echo $total_trophies; echo 'of'; echo $row[trophy_count]; ?> But the problem is sometimes in my database I could have mulitple entrys per trophy. For Trophy 1 I might have only one record so It counts it correctly for trophy 2 I could have 3 records so It counts each one of those records when I only one to count it once for that trophy
  13. Here is some more of my code that I'm working with. //$url = 'http://example.com/image.jpg'; $savedir = '/home/content/mypath/html/images/tmp_images'; //or anything else you want $overwrite = true; //or false if image has to be renamed on duplicate $urlinfo = parse_url($url); $filename = basename($urlinfo['path']); $target = $savedir.'/'.$filename; if(file_exists($target) && !$overwrite){ //break up file in parts: $pathinfo = pathinfo($target); //max 50 tries $max = 50; //loop for($i = 1;$i<=$max;$i++){ $target = $pathinfo['dirname']. '/' . $pathinfo['filename'] . '[' . $i . '].' . $pathinfo['extention']; //break on success, do not use file_exists to avoid race $fh = @fopen($target,'x'); if($fh) break; } //alternatively, if you don't care about the name, you can just: //$target = tempnam($savedir); if(!$fh) die('Too many retries, no unique filename found.'); } else { $fh = fopen($target,'w'); } $check = fwrite($fh,file_get_contents($url)); fclose($fh); // echo (($check) ? 'Successfully saved '.$target : 'Failure'); $src = imagecreatefrompng($target); $width=imagesx($src); $height=imagesy($src); $newwidth=54; // new width of image $newheight=54; $tmp=imagecreatetruecolor($newwidth,$newheight); imagealphablending($tmp, false); imagesavealpha($tmp, true); imagefill($tmp, 0, 0, imagecolorallocatealpha($tmp, 0, 0, 0, 127)); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); $image1 = imagecreatefrompng('Surround.png'); imagealphablending($image1, false); imagesavealpha($image1, true); imagecopymerge($image1, $tmp, 5, 5, 0, 0, 54, 54, 100); if($type == 'PLATINUM'){ $image_name= 'images/games/'.$folder.'/0'.$id.'.png';} if($type == 'GOLD'){ $image_name= 'images/games/'.$folder.'/0'.$id.'g.png';} if($type == 'SILVER'){ $image_name= 'images/games/'.$folder.'/0'.$id.'s.png';} if($type == 'BRONZE'){ $image_name= 'images/games/'.$folder.'/0'.$id.'b.png';} imagepng($image1,constant('UPLOAD_DIR').$image_name, 9); [code=php:0] Attached images. The trophy is the image I'm resizing to 54 x 54 then placing it in the center of the surrond.png file. I think the problem is with the surrond.png or both images. I dunno
  14. still coming out black, this stuff is confusing
×
×
  • 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.