Jump to content

meckr

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

meckr's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Does anyone know how I can accomplish this? I have been trying to find a method for it by examinig source codes on sites that use it, but it must be some kind of server side code. Here is an example of what I'm talking about. http://finance.yahoo.com/charts#symbol=^DWCPF;range=5y You will notice that the background has a blueish tint while the popup window is normal. Once you click OK, the window closes and the backgound (now the foreground) becomes normal again. Thanks for your help and replys.
  2. [quote author=hitman6003 link=topic=105872.msg423095#msg423095 date=1156727825] Keep your code the same as in your first post, but change: [code]$numrows = mysql_fetch_row($res);[/code] to: [code]$numrows = mysql_result($res, 0);[/code] http://www.php.net/mysql_result [/quote] Thanks Hitman6003. It worked perfect.  I didn't even think about using mysql_result().  I spent hours and hours trying to figure that out and I tried almost everything except mysql_result().  You rock dude!
  3. Thanks for your help but I have tried my current query from within SQL and it gives me the correct number.
  4. OK I need to get the total number of rows in a database Here is my entire script [code] //connect to server with username and password, this is the default settings require "includes/database.php"; //we now get get the sort parameter from the url switch ( @ $_GET ['sort'] ) {     // This checks whether sort is either one of the following     // id, offender or tstamp     // if it is it'll set sort_order to sort URL parameter     case 'id':     case 'offender':     case 'tstamp':         $sort_order = $_GET['sort'];     break;     // if sort was not one of the above we use a defualt value, id     default:         $sort_order = "id";     break; } $sql = "SELECT count(*) FROM banned_ips"; $res = mysql_query($sql); $numrows = mysql_fetch_row($res); //our SQL query $sql_query = "SELECT id, offender, tstamp FROM banned_ips ORDER BY $sort_order ASC"; //store the SQL query in the result variable $result = mysql_query($sql_query); echo (" <div align=\"center\"> <div class=\"wrapper\"> <table class=\"data\" cellspacing=\"4\" cellpadding=\"4\" width=\"500\"> <thead> <th align=\"center\" colspan=\"3\"><b><h2>Total Bans: $numrows</h2></b></th> <tr align=\"left\">     <th><a href=\"?sort=id\">Sort by ID</a> </th>     <th><a href=\"?sort=offender\">Sort by IP ADDRESS</a> </th>     <th><a href=\"?sort=tstamp\">Sort by DATE OF BAN</a></th> </tr> </thead>");   if(mysql_num_rows($result))   {     //output as long as there are still available fields     while ( $row = mysql_fetch_row ( $result ) )     { echo ( "<tbody id=\"b\"> <tr align=\"left\">         <td><b>ID:</b> $row[0] </td>       <td><b>IP:</b> $row[1] </td>       <td><b>Date:</b>" . date('Y-m-d H:i:s',$row[2]) . "<br></td>   </tr>   </tbody>");     } } //if no fields exist else {   echo "There are currently no bans at this time!"; } echo ("</table> </div> </div>"); [/code] however, all I get for the results is: Total Bans: Array. I can't figure out what is wrong ??? please help.
  5. @ Wildteen88 Both methods worked.  However, I prefer your method wildteen88.  One more question though.  How can I get it to show the total number of rows? [code]//we now get get the sort parameter from the url switch(@$_GET['sort']) {     // This checks whether sort is either one of the following     // id, offender or tstamp     // if it is it'll set sort_order to sort URL parameter     case 'id':     case 'offender':     case 'tstamp':         $sort_order = $_GET['sort'];     break;     // if sort was not one of the above we use a defualt value, id     default:         $sort_order = "id";     break; } //our SQL query $sql_query = "SELECT id, offender, tstamp FROM banned_ips ORDER BY $sort_order ASC"; //store the SQL query in the result variable $result = mysql_query($sql_query); $sql = "SELECT count(*) FROM banned_ips"; $res = mysql_query($sql); $row = mysql_fetch_row($res); echo ("<div style=\"text-align: left;\"><b><h2>Total Bans: $row</h2></b></div> <table class=\"border\" cellspacing=\"4\" cellpadding=\"4\" width=\"500\"> <tr align=\"left\">     <th><a href=\"?sort=id\">Sort by ID</a> </th>     <th><a href=\"?sort=offender\">Sort by IP ADDRESS</a> </th>     <th><a href=\"?sort=tstamp\">Sort by DATE OF BAN</a></th> </tr>");   if(mysql_num_rows($result))   {     //output as long as there are still available fields     while($row = mysql_fetch_row($result))     { echo ("<tr align=\"left\">         <td><b>ID:</b> $row[0] </td>       <td><b>IP:</b> $row[1] </td>       <td><b>Date:</b>" . date('Y-m-d H:i:s',$row[2]) . "<br></td>   </tr>");   } } //if no fields exist else {   echo "There are currently no bans at this time!"; } echo ("</table>");[/code] This gives me "Total Bans: ARRAY" as the result instead of "Total Bans: 127" as the result. Can you tell me what I'm doing wrong?
  6. here is my code: [code]$id = "id"; $ip = "offender"; $date = "tstamp"; $sort_order = "$date"; //our SQL query $sql_query = "SELECT id, offender, tstamp FROM banned_ips ORDER BY" . $sort_order . "ASC"; //store the SQL query in the result variable $result = mysql_query($sql_query);[/code] My question is I want to be able to allow the order by to be changed from within a variable.  How can I set the oreder by to be a variable which can be changed without have to change the actual code? thanks
  7. I keep receiving this error and I can't figure out why. Here is the error: [code]Fatal error: Using $this when not in object context in /home/indigosc/public_html/drive/index.php on line 12[/code] here is the code: [code] $query = "SELECT * FROM users WHERE uid='$myuid'"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); if ( ($result) && (mysql_num_rows($result) > 0) ){ $row = mysql_fetch_object($result); } $this->c=mysql_query("select * from users where uid='$myuid'"); // <--- this is line 12 <--- $this->d=mysql_fetch_object($this->c); if(is_object($this->d)) { $cusername = $this->d->username; $cpassword = $this->d->password; $cfirst_name = $this->d->first_name; $clast_name = $this->d->last_name; $cstreet = $this->d->street; $ccity = $this->d->city; $czip = $this->d->zip; $cstate = $this->d->state; $ccountry = $this->d->country; $cemail = $this->d->email; $ctelephone = $this->d->telephone; $clast_paid = $this->d->last_paid; $csignup_date = $this->d->signup_date; }[/code]
  8. I never made it open source but I offered it for free download at one time. That was a while back. My question is does anyone think I could take him/her/them to court and sue them or something. It's a good 700 lines of code and all the variables have been changed on the other author's script. The layout and everything is identical to mine. Would I have a case or what do you think?
  9. Has anyone ever heard of any court case involving one script author using the source code of another author? I have searched and searched. I am trying to find out if the source code can really be copyrighted as copyright law states that functions cannot be copyrighted. As far as I can tell, PHP scripts are nothing more than functions. Also, individual words or phrases cannot be copyrithged either, so that would apply to variables. The reason I am asking is that I think a script that I wrote was used in another script as part of that script. I have looked at my source and the part of the script that I believe to be mine and they are identicle in every way. In my java classes, we learned that webpage layouts, Java, Javascript, cannot be copyrighted or even html code. If HTML, Java, Javascript code cannot be copyrighted, then how is that PHP code can be or ASP for that matter? These are all structured languages. Of course, we all know that some text and all images may be copyrighted in a script, so my question is can the source code legally be copyrighted? Please provide examples or resources relating to this. Answering this question will benefit us all. [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]
  10. Thanks for your help wildteen88 but It seems it won't work. I have tried it numerous times without success. So let me reiterate. I have a textarea that a user will use to place a license key into. Afterwhich the user, will hit the submit button. Then, a file called install_license.php and will be written to by placing the license key the user provided, into the a variable within intall_license.php. Then install_license.php will be renamed to license.php. How can this be accomplished. I have tried using my code above but i cannot get it to work. I have checked the permissions on install_license.php and they are set to 777. Now, a differnet method that would work just as well, is if I could somehow figure out how to insert the user provided license (from the textarea) into a db. Any help would be greatly appreciated. I just cannot figure it out for the life of me. I know this is simple stuff but I'm just racking my brain. Please assist?
  11. sorry I missunderstood your post. I meant to say without a text box but within a text area and I guess it would still be the same only textarea instead of text.
  12. I would like to avoid a form if at all possible. i know this can be done as I know of other programs that use this type of code. I just can't figur out how it is done
  13. OK, I am trying to have one script prompt a user for a string (lets say a cd key) and have the user place it in a textbox as a variable. Then upon submitting the form, the script creates another php file with the user provided data placed inside the new php file. Here is my code for creating the new php file with the user data [code]if (file_exists ("data.php")) { @unlink ("inc/data.php"); }    $read=@fopen ("blank_data.php", "r");    $result=@fread ($read, 1024);    @fclose ($read);    $result=str_replace ("{{userdata}}", $userdata, $result);       $read=fopen ("data.php", "w");    fwrite ($read, $result);    fclose ($read);       chmod ("data.php", 0755);[/code] Now, my only real problem is, how do I create a textbox within a form and make whatever is placed inside the textbox a variable that can be posted to the new php file? I was thinking of something like (and it doesn't have to be inside a form necessarily) [code]<td width='25%' align='left' valign='top'>Enter data:</td> <td width='75%' align='left' valign='middle'><textarea name='license' rows='3' cols='59'>".((isset($data))?"".$data."":"")."</textarea></td>[/code] If that makes any sense at all. Any help would be so much appreciated, I might just offer an award. [img src=\"style_emoticons/[#EMO_DIR#]/huh.gif\" style=\"vertical-align:middle\" emoid=\":huh:\" border=\"0\" alt=\"huh.gif\" /]
  14. this is just a test (mod feel free to delete)
×
×
  • 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.