Jump to content

steveangelis

Members
  • Posts

    94
  • Joined

  • Last visited

    Never

Contact Methods

  • MSN
    steveangelis@neraxia.com
  • Website URL
    http://neraxia.com

Profile Information

  • Gender
    Male
  • Location
    Canada

steveangelis's Achievements

Member

Member (2/5)

0

Reputation

  1. I am attempting to create an image and I have run into a snag. I want to add both text and another image to the image I am making. Here is the code so far minus unnecessary parts: header ("Content-type: image/png"); $name = $fetch_user['username']; $rank = $fetch_rank['rank_title']; $img_url = 'path''. $fetch_rank['rank_image']; $im = @imagecreatefrompng("$img_url") or die("Cannot Initialize new GD image stream"); // try changing this as well $font = 4; $width = imagefontwidth($font) * strlen($string) ; $height = imagefontheight($font) ; $im = imagecreatefrompng("image.png"); $x = imagesx($im) - $width ; $y = imagesy($im) - $height; $backgroundColor = imagecolorallocate ($im, 255, 255, 255); $textColor = imagecolorallocate ($im, 255, 255, 255); //imagestring ($im, $font, $x, $y, $string, $textColor); imagestring ($im, $font, 100, 10, $name, $textColor); imagestring ($im, $font, 100, 22, $rank, $textColor); imagepng($im); Everything works UNTIL I added in this part: $im = @imagecreatefrompng("$img_url") or die("Cannot Initialize new GD image stream"); Any idea what I am doing wrong? All that comes up is "Cannot Initialize new GD image stream"; and I know the URL's work.
  2. I am working on a site that was made a while ago and on a custom page I am making I am needing to call up variables and my brain is too fried to think up the solution for this. The standing code is this: class site{ var $name = 'Site'; var $data = 'on'; { What I need to do is callup the variables, such as $name, as simple as possible. How would I do this?
  3. I have a query, which works perfectly fine, that pulls up random information from two tables with this query: $q_test = mysql_query("select q2.*,q3.* from q2,q3 where q2.bta='$course_test' or q3.bta='$course_test' order by rand() limit 2") or die(mysql_error()); That all works perfectly fine, no problems at all. Now, I have this code coming up later on in the page, which also works perfectly fine: while ($g_test = mysql_fetch_array($q_test)) { //all the stuff it should do here } All that works fine and dandy. The problem comes in when I need to know which table is being selected. Table q2 has a field called "numans" and q3 has a field called "answer". What I need to do is have it so when it draws an entry from table q2, it shows the value of numans and when it is from table q3 it shows the value of answer. Anyone know how?
  4. Just do this: <img src="<?PHP echo FROMDB_URL; ?>">
  5. Does anyone have any idea if this is possible or how to make this work?
  6. }else{ if (!(isset($tos))) { echo 'you must agree to our TOS'; }else{ This it the problem. You do not end with a } after the TOS'; line.
  7. I am attempting a query to gather data from two tables that are almost identical. My goal with the script is to get random entries from the database from both tables till s et amount. My current script is this: $q_test = mysql_query("select * from q2,q3 where bta='$course_test' order by rand() limit 2") or die(mysql_error()); Obviously this is failing. Does anyone know how I can get this to work? The field 'bta' is in both tables and I want it to draw entries from both tables as such.
  8. Never mind, the $id2 needed ' ' around it. Hence the stupid error. Thank you anyways.
  9. For the life of me I cannot figure out where the error in this code is: $q_test3 = mysql_query("select * from ans2 where test_id='$id' order by id asc") or die(mysql_error()); while ($g_test3 = mysql_fetch_array($q_test3))$num_ans = $num_ans+1; { $var = "q2a".$num_ans; $var2 = "corans".$num_ans; $ans = $_POST[$var]; $chk = $_POST[$var2]; $id2 = $g_test3['id']; mysql_query("update ans2 set ans='$ans', corans='$chk' where id=$id2")or die(mysql_error()); } I stripped the code down to only the parts that could potentially be affecting the error. I am getting the following error: I have checked all the needed variables, and $ans and $chk both are producing results from the previous form (The num_ans is a number always going up by one which is needed for this script). The $ans field comes from a text box and $chk is a check box. My test is running 4 fields right now, and the first entry updates without a problem but the next one produces this error. Any ideas? Edit: I noticed that it is updating the first entry but it is not producing a confirmation after the update that is needed. IE The tables are all updated but the error is coming from the first entry.
  10. I was able to modify this enough with my current code to get it to work. Thank you
  11. I do an echo of the $_POST and all I get is the num_q showing up.
  12. That is actually exactly what I have done. The problem lies with the code here not working: $num_ans = $_POST['question'.num_q]; All that does is show me the variable num_q.
  13. Your code is currently inputting blank lines into your database because it has no variables to deal with. You are calling up variables such as $_POST[name] before the form is submitted, which is making $_POST[name] equal to nothing, hence why the entries are being made blank.
×
×
  • 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.