Jump to content

radar

Members
  • Posts

    645
  • Joined

  • Last visited

Everything posted by radar

  1. What errors are you getting?  Also on the page if it is trying to do an image.. right click on it and hit properties and make sure it is giving you the right url...
  2. Okay -- I was going to do a large setup using arrays and stuff from the form to determine how many were selected, etc..  though at this time i am brain dead so this will have to work... [code] <?php if (!$_POST) { print_r ($_POST); echo "error"; } else { if ($_POST[checkbox] ) { $checkbox = $_POST[checkbox]; } if ($_POST[checkbox2] ) { $checkbox2 = $_POST[checkbox2]; } if ($_POST[checkbox3] ) { $checkbox3 = $_POST[checkbox3]; } if ($_POST[checkbox4] ) { $checkbox4 = $_POST[checkbox4]; } } echo (($checkbox) + ($checkbox2) + ($checkbox3) + ($checkbox4)); ?> [/code] Now one thing I was having trouble with is i named my check boxes cc, cc2, cc3 and cc4.. though when i typed this.. print_r ($_POST); it gave me the name as checkbox -- so at the beginning of your processing script I would add the print_r line i just typed and see what it puts your name as..  after that just put whatever that is into the code and it should work..  take if statements out if need to or add some in...  if you add any in you'll have to add them into the echo field as well with () around them...
  3. change premium back to how I had it main...  that is how you need it because of this... $sql1="select * from photo where username='$identity' and main='Y'"; main="Y" now if you have a row in your database where premium = Y too then that should work as it.. but try changing premium to main and it should work...
  4. Well you see the value submits what is passed through to the php script.. so if each one has a value of on -- then when you take cc1 + cc2 you are going to either get an error or get onon which probably isnt what you want... So if you decide you want to add 2 more check boxes you would do something like this..  first off have the value of checkbox the number you want them to equal... I am working on a code that will allow you to add as many check boxes as you would like.
  5. First off neither code will work I don't think.. So here is a code that should work..  I am just working off what you've got here and not re-writing the whole thing...  I'm not going to be re-writing the whole thing just some of it.. [code] <?php $sql1="select * from  loggedin where username='$identity' and main='Y'"; $res1=mysql_query($sql1,$db); $row1=mysql_fetch_array($res1); if($row1[main] == 'Y'){ $images = "images/silvermember.gif"; } else { $images = "images/freemember.gif"; }//end if echo '<img src='.$images.'/>'; ?> [/code] this code should work...  the reason why the other wouldnt work is because #1 where it sets the image the syntax appears to be all wrong...  And then of course it doesnt echo out the image code to print the image to the end user...  Since in the $row1 array there is more than likely not an entry called SilverMember.gif or Free_Member.gif that is an obvious flaw in the coding...  In the original code there were a lot more errors than that though were fixed by paco..  though some errors were still left -- the code i have provided should do the job. Now I'm not sure what you are building -- though if $identity contains the username of a person who is logged in.. ie the end user..  The image will only show up under their name for them if they are online which defeats the purpose because if they are online they know they are online..  So anyway hope the code helps..
  6. Well if I am understanding you correctly it would be something like this.. [code] <?php $num = $_POST; $res = $cc + $cc1; echo $res; ?> [/code] Also -- you might make your check boxes named different...  otherwise they will overwrite each other...
  7. I would like to know how to do this as well..  Great Question..  In my example I will have the categories for Tutorials such as Photoshop, Illustrator, PHP, ASP, CSS, JavaScript, ETC... But then some of them may have sub categories such as for Photoshop might have.. Text Effects Photo Manipulation Brushing etc... That'd be a good thing to know..
  8. Sweet looks like it's working..  I had to go through my form and make sure all the form fields were named the same as the config_name in the database to make sure that would work.. and then I had to edit my error checking and edit a couple custom functions i wrote for my radial buttons.. but it saved my domain name, site name and site descrip so it seems as though it works... Thank you for the help... // Justin aka Radar
  9. I did try it out.. It seems to work now as in the output has the correct names and stuff..  though when I try and run it, it doesn't update the things in the database..  here is how I have it set as of now.. [code] <?php $names = array(); $data = array(); $names = mysql_fetch_array(mysql_query("SELECT config_name FROM config")); $data = $_POST; foreach($data as $datas => $names) {     $mysite = "UPDATE `config` SET `config_value` = ".$datas." WHERE CONVERT( `config_name` USING utf8 ) = ". $names .""; $mysite = mysql_query($mysite); } ?> [/code] edit: well i feel like an idiot i re-looked at the output and they are just backwards lol.. let me try that.. so I got them in the right order but it still doesnt update in the database...
  10. in my config table of my database i have to colums.. one is config_name the other is config_value.. here is the basics of config_name domain_name site_name site_descrip site_disable user_activation visual_conf and it goes on from there..  I have the form fields set up on the page in the exact same listing as they are in the database..  So row 1 is the domain name, row 2 is the site name, etc... Now the code you gave me seems to work.. as in the output is what it needs to be..  though when I run the query it doesn't seem to change it...
  11. Okay so I have a rather large form for my config which is set up the way I like it.. though I need to do the queries to add them all into the database.. now with 50+ form fields I'm sure you can see why I am not inclined to do each query seperately by typing each query..  So I've come up with a little code, though it doesnt work as I had hoped....  Now I've altered it a little bit so that I could see the output of the file...  So here is the code... [code] <?php $names = array(); $data = array(); names = mysql_fetch_assoc(mysql_query("SELECT config_name FROM config")); $data = $_POST; for ($i = 0; $i < sizeof($data); $i++) { $mysite .= "UPDATE `config` SET `config_value` = ".each($data)." WHERE CONVERT( `config_name` USING utf8 ) = ".each($names)."<br>"; $tpl->assign('errmsg', $mysite); ?> [/code] note that this is not the actual beginning of the file -- put php tags for syntax highlighting...  anyway that is my code... and this is what it is spitting out..  it spits this out over and over until all the form fields are gone... UPDATE `config` SET `config_value` = Array WHERE CONVERT( `config_name` USING utf8 ) = Array Can anyone see why this would do this?  Perhaps I am just trying to do it totally wrong...
  12. This should be all you need to ping the addresses.. [code] <?php exec("ping 192.168.1.1",$out); echo "<pre>"; print_r($out); echo "</pre>"; ?> [/code] just change the ip address to the web address..  code thanks to the search function -- provided originally by SemiApocolyptic
  13. Okay so working on my administration panel right now..  Server I am on doesnt have phpmyadmin so I can't export all my stuff that way so I need to come up with a way to back up my entire database through php on my site.. Any clue how to do this?
  14. okay so I have a referrer that is like this... http://turbochargeadapters.com/main.php?action=replace&step=confirm&model_id=196&make=Audiovox&model_selected=CDM-8450 Now this is going to change depending on what Model of Cell phone and what Brand of cell phone..  one thing that is always going to stay the same is going to be the part that i want which is.. http://turbochargeadapters.com/main.php?action=replace So question is how do I take the first referrer and turn it into the second?
  15. well i didnt know which string is what in that.. but here would be the way to do it.. if ($whatever == "") { } else { output stuff here } that'd be the easy part..  I wasnt sure if it was $article as shown in GetDef function or $text as shown in def_fy function..
  16. Tomorrow when I go to work I'll have to open this scripting up and take a look and see if I can figure out how to do the second part -- see the problem is I am not the original programmer on this and I'm not understanding more than half of the code -- and using smarty isnt helping much either as ive never used it before...  so if i cant im sure i'll be making more posts here..  thanks for the help thus far...
  17. I guess that would have been a good thing to include...  there will be multiple entries.. and here is a sample take on it.. config_name    config_value domainname    www.mysiste.com site_name        My Web Site site_descrip      the elitest of the elite site_enable      1 req_act            0 req_vis_act      1 It is in that type of setup... goes on an on  holds all the important configuration of my site in this table....
  18. Okay I have a table in my database called config...  this table has 2 cells.. one called config_name and the other config_value... Well I need to be able to write to this via a form... The only thing thats ever going to change is config_value -- so how do I take the contents of the form and put it into the database? Only way i could think of would be to do every query individually.. which would suck...  then i thought someone here might now a bit about doing something like this.. so let me know.. and thanks in advance...
  19. How your actual query and everything...  like yes this is your mysql part of the query but where is the php.. and give like 3 lines before and 3 lines after -- might help a little bit more ...
  20. radar

    Fatal Error

    show us the code you're using -- it'll help to give a more educated answer....
  21. Now the only thing I have to figure out is how to seperate them.. so that the advisors are seperated by institution in the display... note: you can check this out by going to http://www.recommendmyadvisor.com -- click on the button that says browse by advisor
  22. I kinda figured this out...  It was running on a INNER JOIN before and when I put a RIGHT JOIN in it seemed to work... so thats what i'm sticking with for now... Ya know im glad this site is around for me while I am at work (I am a developer by trade)...
  23. Okay I know this is supposed to be in the MySQL area but no one is over there.. Okay first thing I should let you know is I am using the Smarty Template engine...  Now for this site I am working on  I've got 2 tables.. one is advisors and one is recommendations.  They both have quite a bit of the same information...  Here is my query I have right now [CODE] <?php $data = $turbo->get_all("SELECT advisors.fname, advisors.lname, advisors.advisor_id, count(recommendations.rec_id) as tot_rec, avg(recommendations.total_score) as avg_score, recommendations.total_score FROM advisors INNER JOIN recommendations ON advisors.advisor_id = recommendations.advisor_id GROUP BY advisor_id ORDER BY advisors.lname"); ?> [/CODE] Now this works for the most part -- but right now there is 21 entries in the advisors table and this is only picking up 14 of them..  Also something new I have to figure out is... In the Advisors table there is a list of advisors at different institutions.. So say there is a John Smith at University of Marylyn and a John Smith at University of Southern California..  In the output I need to have it like Smith, John University of Marylyn Smith, John University of Southern California So that the recommendations are not combined for the advisor.  Any help on this would be grateful..  Thanks in advance.
  24. Okay first thing I should let you know is I am using the Smarty Template engine...  Now for this site I am working on  I've got 2 tables.. one is advisors and one is recommendations.  They both have quite a bit of the same information...  Here is my query I have right now [CODE] <?php $data = $turbo->get_all("SELECT advisors.fname, advisors.lname, advisors.advisor_id, count(recommendations.rec_id) as tot_rec, avg(recommendations.total_score) as avg_score, recommendations.total_score FROM advisors INNER JOIN recommendations ON advisors.advisor_id = recommendations.advisor_id GROUP BY advisor_id ORDER BY advisors.lname"); ?> [/CODE] Now this works for the most part -- but right now there is 21 entries in the advisors table and this is only picking up 14 of them..  Also something new I have to figure out is... In the Advisors table there is a list of advisors at different institutions.. So say there is a John Smith at University of Marylyn and a John Smith at University of Southern California..  In the output I need to have it like Smith, John University of Marylyn Smith, John University of Southern California So that the recommendations are not combined for the advisor.  Any help on this would be grateful..  Thanks in advance.
  25. Now the question is, does it work...  lol..  I haven't actually tested that right this second but i did it once and i think thats the way i did it...
×
×
  • 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.